Skip to content

Commit d8cabe8

Browse files
mfkahnSamCarlberg
authored andcommitted
Fixes #920 incorrect java codegen for filter lines (#923)
Original VM template was reassigning the filtered list to the outputs variable which would have no effect on the contents of the passed-in argument. Working pipelines in the GRIP GUI would show zero filtered lines when the generated class was used.
1 parent e3280bb commit d8cabe8

File tree

1 file changed

+3
-2
lines changed
  • ui/src/main/resources/edu/wpi/grip/ui/codegeneration/java/operations

1 file changed

+3
-2
lines changed

ui/src/main/resources/edu/wpi/grip/ui/codegeneration/java/operations/Filter_Lines.vm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
*/
99
private void $tMeth.name($step.name())(List<Line> inputs,double minLength,double[] angle,
1010
List<Line> outputs) {
11-
outputs = inputs.stream()
11+
outputs.clear();
12+
outputs.addAll(inputs.stream()
1213
.filter(line -> line.lengthSquared() >= Math.pow(minLength,2))
1314
.filter(line -> (line.angle() >= angle[0] && line.angle() <= angle[1])
1415
|| (line.angle() + 180.0 >= angle[0] && line.angle() + 180.0 <= angle[1]))
15-
.collect(Collectors.toList());
16+
.collect(Collectors.toList()));
1617
}

0 commit comments

Comments
 (0)