Skip to content

Commit c2c4d59

Browse files
committed
Rename forAllCombinationsOf to forEach in Editor #37
Signed-off-by: Mārtiņš Avots <martins.avots@splitcells.net>
1 parent 13a4445 commit c2c4d59

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

projects/net.splitcells.gel.editor/src/main/java/net/splitcells/gel/editor/EditorTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void testGealInterpretation() {
9595
, list(FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(FOR_EACH_NAME),
9696
list(functionCallDescForTest("examiner")))
9797
,
98-
FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(FOR_ALL_COMBINATIONS_OF)
98+
FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(FOR_EACH_NAME)
9999
, list(functionCallDescForTest("date"), functionCallDescForTest("shift")))
100100
, FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(THEN_NAME)
101101
,
@@ -105,7 +105,7 @@ public void testGealInterpretation() {
105105
, list(FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(FOR_EACH_NAME),
106106
list(functionCallDescForTest("student")))
107107
,
108-
FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(FOR_ALL_COMBINATIONS_OF)
108+
FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(FOR_EACH_NAME)
109109
, list(functionCallDescForTest("date"), functionCallDescForTest("shift")))
110110
, FunctionCallDesc.functionCallDescForTest(NameDesc.nameDescForTest(THEN_NAME)
111111
,
@@ -181,10 +181,10 @@ public void testGealParsing() {
181181
182182
solution = solution('Colloquium Plan', demands, supplies);
183183
solution .forEach(examiner)
184-
.forAllCombinationsOf(date, shift)
184+
.forEach(date, shift)
185185
.then(hasSize(1));
186186
solution .forEach(student)
187-
.forAllCombinationsOf(date, shift)
187+
.forEach(date, shift)
188188
.then(hasSize(1));
189189
solution .forEach(student)
190190
.then(hasSize(2));
@@ -254,10 +254,10 @@ public void testInput() {
254254
255255
solution = solution('Colloquium Plan', demands, supplies);
256256
solution . forEach(examiner)
257-
. forAllCombinationsOf(date, shift)
257+
. forEach(date, shift)
258258
. then(hasSize(1));
259259
solution . forEach(student)
260-
. forAllCombinationsOf(date, shift)
260+
. forEach(date, shift)
261261
. then(hasSize(1));
262262
solution . forEach(student)
263263
. then(hasSize(2));

projects/net.splitcells.gel.editor/src/main/java/net/splitcells/gel/editor/geal/runners/ForAllCombsCallRunner.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import static net.splitcells.dem.utils.NotImplementedYet.notImplementedYet;
3434
import static net.splitcells.gel.constraint.QueryI.query;
3535
import static net.splitcells.gel.constraint.type.ForAlls.FOR_ALL_COMBINATIONS_OF;
36+
import static net.splitcells.gel.constraint.type.ForAlls.FOR_EACH_NAME;
3637
import static net.splitcells.gel.editor.geal.runners.FunctionCallRun.functionCallRun;
3738
import static net.splitcells.gel.editor.geal.runners.FunctionCallRunnerParser.functionCallRunnerParser;
3839

@@ -50,7 +51,7 @@ private static class Args {
5051
Query subjectVal;
5152
}
5253

53-
private static final FunctionCallRunnerParser<Args> PARSER = functionCallRunnerParser(FOR_ALL_COMBINATIONS_OF, 1
54+
private static final FunctionCallRunnerParser<Args> PARSER = functionCallRunnerParser(FOR_EACH_NAME, 1
5455
, fcr -> {
5556
val args = new Args();
5657
fcr.requireArgumentMinimalCount(2);
@@ -61,7 +62,7 @@ private static class Args {
6162
});
6263

6364
private boolean supports(FunctionCallDesc functionCall, Optional<Object> subject, Editor context) {
64-
return functionCall.getName().getValue().equals(FOR_ALL_COMBINATIONS_OF);
65+
return functionCall.getName().getValue().equals(FOR_EACH_NAME);
6566
}
6667

6768
@Override

projects/net.splitcells.gel.editor/src/main/resources/html/net/splitcells/gel/editor/geal/examples/colloquium-planning.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ supplies = table('time slots', date, shift, roomNumber);
1212
supplies . importCsvData('supplies.csv');
1313

1414
solution = solution('Colloquium Plan', demands, supplies);
15-
solution . forAllCombinationsOf(examiner, date, shift)
15+
solution . forEach(examiner, date, shift)
1616
. then(hasSize(1));
17-
solution . forAllCombinationsOf(student, date, shift)
17+
solution . forEach(student, date, shift)
1818
. then(hasSize(1));
1919
solution . forEach(student)
2020
. then(hasSize(2));

0 commit comments

Comments
 (0)