diff --git a/src/main/java/com/gamzabat/algohub/constants/LanguageConstants.java b/src/main/java/com/gamzabat/algohub/constants/LanguageConstants.java index 546f60e1..008ddf3d 100644 --- a/src/main/java/com/gamzabat/algohub/constants/LanguageConstants.java +++ b/src/main/java/com/gamzabat/algohub/constants/LanguageConstants.java @@ -2,15 +2,15 @@ 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" @@ -18,6 +18,42 @@ public class LanguageConstants { 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"); diff --git a/src/main/java/com/gamzabat/algohub/feature/solution/repository/querydsl/CustomSolutionRepositoryImpl.java b/src/main/java/com/gamzabat/algohub/feature/solution/repository/querydsl/CustomSolutionRepositoryImpl.java index d861d15b..709ea20c 100644 --- a/src/main/java/com/gamzabat/algohub/feature/solution/repository/querydsl/CustomSolutionRepositoryImpl.java +++ b/src/main/java/com/gamzabat/algohub/feature/solution/repository/querydsl/CustomSolutionRepositoryImpl.java @@ -140,21 +140,39 @@ private void addProblemFilter(Integer problemNumber, JPAQuery query) { private void languageFilter(JPAQuery 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; } }