Commit 7eba0056 authored by Ashley Chen's avatar Ashley Chen
Browse files

add isWingLight predicate

parent 063684a1
......@@ -85,14 +85,13 @@ interface GeometryConstants {
return (flyer * NUM_WINGS_PER_FLYER) + (right? 1: 0);
}
default IntPredicate isLeftWingLight() {
return lightIndex -> lightIndex % NUM_LIGHT_POINTS_PER_FLYER < NUM_LIGHT_POINTS_PER_WING;
}
IntPredicate isWingLight = lightIndex -> lightIndex % NUM_LIGHT_POINTS_PER_FLYER != LightSamplePoint.LightCorners.BODY.position;
IntPredicate isLeftWingLight = lightIndex -> lightIndex % NUM_LIGHT_POINTS_PER_FLYER < NUM_LIGHT_POINTS_PER_WING;
IntPredicate isRightWingLight = lightIndex -> (lightIndex % NUM_LIGHT_POINTS_PER_FLYER >= NUM_LIGHT_POINTS_PER_WING &&
lightIndex % NUM_LIGHT_POINTS_PER_FLYER != LightSamplePoint.LightCorners.BODY.position);
default IntPredicate isRightWingLight() {
return lightIndex -> (lightIndex % NUM_LIGHT_POINTS_PER_FLYER >= NUM_LIGHT_POINTS_PER_WING &&
lightIndex % NUM_LIGHT_POINTS_PER_FLYER != LightSamplePoint.LightCorners.BODY.position);
}
/**
* indexing scheme constants
......
......@@ -159,7 +159,7 @@ class FlightModel extends LXModel implements Flight {
public List<LightSamplePointModel> getAllWingsLights() {
return IntStream
.range(0, lightPoints.length)
.filter(i -> (i % NUM_LIGHT_POINTS_PER_FLYER != LightSamplePoint.LightCorners.BODY.position))
.filter(isWingLight)
.mapToObj(i -> lightPoints[i])
.collect(Collectors.toList());
}
......@@ -179,7 +179,7 @@ class FlightModel extends LXModel implements Flight {
public List<LightSamplePointModel> getAllLeftWingLights() {
return IntStream
.range(0, lightPoints.length)
.filter(isLeftWingLight())
.filter(isLeftWingLight)
.mapToObj(i -> lightPoints[i])
.collect(Collectors.toList());
}
......@@ -197,7 +197,7 @@ class FlightModel extends LXModel implements Flight {
public List<LightSamplePointModel> getAllRightWingLights() {
return IntStream
.range(0, lightPoints.length)
.filter(isRightWingLight())
.filter(isRightWingLight)
.mapToObj(i -> lightPoints[i])
.collect(Collectors.toList());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment