Skip to content

Commit

Permalink
refactor:필터링 언어 목록 수정 (#306)
Browse files Browse the repository at this point in the history
* refactor:필터링 언어 목록 수정

* refactor : case 조건 상수화

* refactor : Language 수정
  • Loading branch information
s-hwan authored Jan 24, 2025
1 parent c127a39 commit 7b9ae86
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,58 @@

public class LanguageConstants {
public static final String[] C_BOUNDARY = {
"C99", "C11", "C90", "C2x",
"C99 (Clang)", "C11 (Clang)", "C90 (Clang)", "C2x (Clang)"
"C99", "C11", "C90", "Objective-C",
"C99 (Clang)", "C11 (Clang)", "C90 (Clang)"
};
public static final String[] CPP_BOUNDARY = {
"C++11", "C++14", "C++17", "C++20", "C++98",
"C++11", "C++14", "C++17", "C++20", "C++26", "C++98", "Objective-C++",
"C++11 (Clang)", "C++14 (Clang)", "C++17 (Clang)", "C++20 (Clang)", "C++98 (Clang)"
};
public static final String[] JAVA_BOUNDARY = {
"Java 8", "Java 11", "Java 8 (OpenJDK)"
"Java 8", "Java 11", "Java 15", "Java 8 (OpenJDK)"
};
public static final String[] PYTHON_BOUNDARY = {
"Python 3", "PyPy3"
};
public static final String[] RUST_BOUNDARY = {
"Rust 2015", "Rust 2018", "Rust 2021"
};
public static final String[] SCRIPT_BOUNDARY = {
"Ruby", "Python 3", "PyPy3", "Bash", "Lua", "Perl", "sed", "awk",
"Tcl", "Rhino", "Pike", "PHP", "Text"
};
public static final String[] SYSTEM_BOUNDARY = {
"C99", "C99 (Clang)", "C11", "C11 (Clang)", "C90", "C90 (Clang)",
"C2x", "C2x (Clang)", "C#", "Rust 2018", "Rust 2015", "Rust 2021",
"Go", "Go(gccgo)", "D", "D(LDC)", "Pascal"
};
public static final String[] WEBAPP_BOUNDARY = {
"Java 11", "Java 8 (OpenJDK)", "Java 8", "Java 15", "Kotlin (JVM)",
"Swift", "node.js", "TypeScript"
};
public static final String[] FUNCTION_BOUNDARY = {
"Scheme", "OCaml", "F#", "Haxe", "Ada"
};
public static final String[] LOW_BOUNDARY = {
"Assembly (32bit)", "Assembly (64bit)", "Fortran",
"FreeBASIC", "Visual Basic"
};
public static final String[] OTHER_BOUNDARY = {
"Brainf**k", "Whitespace", "Golfscript", "INTERCAL", "Algol 68",
"Befunge", "아희", "SystemVerilog", "bc"
};

public static final String C = "C";
public static final String CPP = "C++";
public static final String PYTHON = "Python";
public static final String JAVA = "Java";
public static final String RUST = "Rust";
public static final String SCRIPT = "Script Language";
public static final String SYSTEM = "System Language";
public static final String WEBAPP = "Web/App Language";
public static final String FUNCTION = "Functional Language";
public static final String LOW = "Low-Level Language";
public static final String OTHER = "Others";

private LanguageConstants() {
throw new RuntimeException("Can not instantiate : LanguageConstants");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,39 @@ private void addProblemFilter(Integer problemNumber, JPAQuery<Solution> query) {

private void languageFilter(JPAQuery<Solution> query, String language) {
switch (language) {
case "C":
case LanguageConstants.C:
query.where(solution.language.in(LanguageConstants.C_BOUNDARY));
break;
case "C++":
case LanguageConstants.CPP:
query.where(solution.language.in(LanguageConstants.CPP_BOUNDARY));
break;
case "Java":
case LanguageConstants.JAVA:
query.where(solution.language.in(LanguageConstants.JAVA_BOUNDARY));
break;
case "Python":
case LanguageConstants.PYTHON:
query.where(solution.language.in(LanguageConstants.PYTHON_BOUNDARY));
break;
case "Rust":
case LanguageConstants.RUST:
query.where(solution.language.in(LanguageConstants.RUST_BOUNDARY));
break;
case LanguageConstants.SCRIPT:
query.where(solution.language.in(LanguageConstants.SCRIPT_BOUNDARY));
break;
case LanguageConstants.SYSTEM:
query.where(solution.language.in(LanguageConstants.SYSTEM_BOUNDARY));
break;
case LanguageConstants.WEBAPP:
query.where(solution.language.in(LanguageConstants.WEBAPP_BOUNDARY));
break;
case LanguageConstants.FUNCTION:
query.where(solution.language.in(LanguageConstants.FUNCTION_BOUNDARY));
break;
case LanguageConstants.LOW:
query.where(solution.language.in(LanguageConstants.LOW_BOUNDARY));
break;
case LanguageConstants.OTHER:
query.where(solution.language.in(LanguageConstants.OTHER_BOUNDARY));
break;
}

}
Expand Down

0 comments on commit 7b9ae86

Please sign in to comment.