MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / perform

Method perform

src/main/java/fieldbox/boxes/TimeSlider.java:138–176  ·  view source on GitHub ↗
(Rect was, Rect now)

Source from the content-addressed store, hash-verified

136 off(off);
137 on(on);
138 skipForward(skipForward);
139 skipBackward(skipBackward);
140
141 }
142*/
143 protected void perform(Rect was, Rect now) {
144
145 Map<Box, Double> previousMapping = LocalTime.Companion.growTimeFor(null, population().filter(x -> x.properties.get(frame).y>topLimit && x.properties.get(frame).y<bottomLimit).filter(x -> x.properties.get(frame).intersectsX(was.x)).collect(Collectors.toSet()), was.x);
146 previousMapping.entrySet().removeIf(m -> !m.getKey().properties.get(frame).intersectsX(m.getValue()));
147 Map<Box, Double> currentMapping = LocalTime.Companion.growTimeFor(null, population().filter(x -> x.properties.get(frame).y>topLimit && x.properties.get(frame).y<bottomLimit).filter(x -> x.properties.get(frame).intersectsX(now.x)).collect(Collectors.toSet()), now.x);
148 currentMapping.entrySet().removeIf(m -> !m.getKey().properties.get(frame).intersectsX(m.getValue()));
149
150 Set<Box> off = new LinkedHashSet<>(previousMapping.keySet());
151 off.removeAll(currentMapping.keySet());
152 Set<Box> on = new LinkedHashSet<>(currentMapping.keySet());
153 on.removeAll(previousMapping.keySet());
154
155
156// Stream<Box> off = population().filter(x -> x.properties.get(frame).intersectsX(was.x))
157// .filter(x -> !x.properties.get(frame)
158// .intersectsX(now.x));
159// Stream<Box> on = population().filter(x -> !x.properties.get(frame).intersectsX(was.x))
160// .filter(x -> x.properties.get(frame)
161// .intersectsX(now.x));
162
163 Set<Box> skipForward = new LinkedHashSet<>(currentMapping.keySet());
164 skipForward.retainAll(previousMapping.keySet());
165 skipForward.removeIf(x -> !x.properties.get(frame).inside(previousMapping.get(x).floatValue(), currentMapping.get(x).floatValue()));
166
167// Stream<Box> skipForward = population().filter(x -> x.properties.get(frame)
168// .inside(was.x, now.x));
169
170
171// Stream<Box> skipBackward = population().filter(x -> x.properties.get(frame).inside(now.x, was.x));
172 this.currentMapping = currentMapping;
173 this.currentMappingAtTime = now.x;
174
175 off(off);
176 on(on, currentMapping);
177 skipForward(skipForward, currentMapping);
178// skipBackward(skipBackward);
179

Callers 1

swiperMethod · 0.95

Calls 13

populationMethod · 0.95
offMethod · 0.95
onMethod · 0.95
skipForwardMethod · 0.95
growTimeForMethod · 0.80
collectMethod · 0.80
removeAllMethod · 0.80
retainAllMethod · 0.80
getMethod · 0.65
intersectsXMethod · 0.45
removeIfMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected