Skip to content

Commit 13b7879

Browse files
committed
- change domain model
- for Problem, change property name function to func, as function is keyword in javascript and it cause problems ... - for Problem, change property name return to returnStatement, as return is keyword in javascript and it cause problems ...
1 parent 3102394 commit 13b7879

File tree

11 files changed

+25
-26
lines changed

11 files changed

+25
-26
lines changed

gradle/versioning.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//noinspection GroovyAssignabilityCheck
22
version = new ProjectVersion(
3-
'1', '0', '21', System.env.TRAVIS_BUILD_NUMBER
3+
'1', '0', '22', System.env.TRAVIS_BUILD_NUMBER
44
)
55

66
println "Version number: " + version

src/main/kotlin/com/jalgoarena/domain/Function.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.jalgoarena.domain
22

33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
4-
import com.fasterxml.jackson.annotation.JsonProperty
54

65
@JsonIgnoreProperties(ignoreUnknown = true)
76
data class Function(val name: String,
8-
@JsonProperty("return") val returnStatement: Return,
7+
val returnStatement: Return,
98
val parameters: List<Parameter>) {
109

1110
@JsonIgnoreProperties(ignoreUnknown = true)

src/main/kotlin/com/jalgoarena/domain/Problem.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import com.fasterxml.jackson.databind.node.ArrayNode
88
@JsonIgnoreProperties(ignoreUnknown = true)
99
@JsonInclude(JsonInclude.Include.NON_NULL)
1010
data class Problem(val id: String,
11-
val title: String,
12-
val description: String,
13-
val timeLimit: Long,
14-
val memoryLimit: Int,
15-
val function: Function?,
16-
val testCases: List<TestCase>?,
17-
val skeletonCode: Map<String, String>?,
18-
val level: Int) {
11+
val title: String,
12+
val description: String,
13+
val timeLimit: Long,
14+
val memoryLimit: Int,
15+
val func: Function?,
16+
val testCases: List<TestCase>?,
17+
val skeletonCode: Map<String, String>?,
18+
val level: Int) {
1919

2020
@JsonIgnoreProperties(ignoreUnknown = true)
2121
data class TestCase(val input: ArrayNode, val output: JsonNode)

src/main/kotlin/com/jalgoarena/judge/JvmJudgeEngine.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ open class JvmJudgeEngine(
3333

3434
val compiler = compilers.first { it.programmingLanguage() == language }
3535

36-
return compileAndJudge(className, compiler, problem.function!!, problem, judgeRequest.sourceCode)
36+
return compileAndJudge(className, compiler, problem.func!!, problem, judgeRequest.sourceCode)
3737
}
3838

3939
private fun judge(clazz: Any, method: Method, problem: Problem): JudgeResult {
@@ -118,7 +118,7 @@ open class JvmJudgeEngine(
118118

119119
private fun readInternalTestCases(problem: Problem): Array<InternalTestCase> {
120120
val testCases = problem.testCases
121-
val function = problem.function
121+
val function = problem.func
122122

123123
val parser = InternalTestCaseParser(function!!, objectMapper)
124124

src/main/kotlin/com/jalgoarena/web/ProblemsController.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class ProblemsController(
2525

2626
private fun enhancedProblem(problem: Problem): Problem {
2727
return problem.copy(
28-
function = null,
28+
func = null,
2929
testCases = null,
30-
skeletonCode = generateSkeletonCodes(problem.function!!)
30+
skeletonCode = generateSkeletonCodes(problem.func!!)
3131
)
3232
}
3333

src/test/kotlin/com/jalgoarena/domain/ProblemJsonSerializationTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ProblemJsonSerializationTest {
4747
level = 3,
4848
memoryLimit = 1,
4949
timeLimit = 1,
50-
function = TWO_SUM_FUNCTION,
50+
func = TWO_SUM_FUNCTION,
5151
skeletonCode = mapOf(
5252
Pair("java", "dummy code"),
5353
Pair("kotlin", "kotlin dummy code")
@@ -67,9 +67,9 @@ class ProblemJsonSerializationTest {
6767
"description": "dummy description",
6868
"timeLimit": 1,
6969
"memoryLimit": 1,
70-
"function": {
70+
"func": {
7171
"name": "twoSum",
72-
"return": {
72+
"returnStatement": {
7373
"type": "[I",
7474
"comment": "[index1 + 1, index2 + 1] (index1 < index2)"
7575
},

src/test/kotlin/com/jalgoarena/web/JudgeControllerSpec.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ class JudgeControllerSpec {
157157
"description": "Write the `fib` function to return the N'th term.\r\nWe start counting from:\r\n* fib(0) = 0\r\n* fib(1) = 1.\r\n\r\n### Examples\r\n\r\n* `0` -> `0`\r\n* `6` -> `8`",
158158
"timeLimit": 1,
159159
"memoryLimit": 32,
160-
"function": {
160+
"func": {
161161
"name": "fib",
162-
"return": {
162+
"returnStatement": {
163163
"type": "java.lang.Long",
164164
"comment": " N'th term of Fibonacci sequence"
165165
},

src/test/kotlin/com/jalgoarena/web/JudgeControllerTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class JudgeControllerTest {
6464
level = 1,
6565
memoryLimit = 1,
6666
timeLimit = 1,
67-
function = FIB_FUNCTION,
67+
func = FIB_FUNCTION,
6868
skeletonCode = mapOf(
6969
Pair("java", "dummy code"),
7070
Pair("kotln", "kotlin dummy code")

src/test/kotlin/com/jalgoarena/web/ProblemsClientSpec.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ProblemsClientSpec {
7373
level = 3,
7474
memoryLimit = 1,
7575
timeLimit = 1,
76-
function = FIB_FUNCTION,
76+
func = FIB_FUNCTION,
7777
skeletonCode = mapOf(
7878
Pair("java", "dummy code"),
7979
Pair("kotln", "kotlin dummy code")

src/test/kotlin/com/jalgoarena/web/ProblemsControllerSpec.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ class ProblemsControllerSpec {
7474
"description": "Write the `fib` function to return the N'th term.\r\nWe start counting from:\r\n* fib(0) = 0\r\n* fib(1) = 1.\r\n\r\n### Examples\r\n\r\n* `0` -> `0`\r\n* `6` -> `8`",
7575
"timeLimit": 1,
7676
"memoryLimit": 32,
77-
"function": {
77+
"func": {
7878
"name": "fib",
79-
"return": {
79+
"returnStatement": {
8080
"type": "java.lang.Long",
8181
"comment": " N'th term of Fibonacci sequence"
8282
},

src/test/resources/com/jalgoarena/domain/problem.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "dummy description",
55
"timeLimit": 1,
66
"memoryLimit": 1,
7-
"function": {
7+
"func": {
88
"name": "twoSum",
9-
"return": {
9+
"returnStatement": {
1010
"type": "[I",
1111
"comment": "[index1 + 1, index2 + 1] (index1 < index2)"
1212
},

0 commit comments

Comments
 (0)