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

Method clean

src/main/java/trace/util/TCB3.java:165–191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163 }
164
165 public void clean() {
166 if (!dirty)
167 return;
168
169 Collections.sort(n, new Comparator<Node>() {
170 public int compare(Node o1, Node o2) {
171 if (o1.x == o2.x)
172 return Double.compare(o1.subX, o2.subX);
173 return Double.compare(o1.x, o2.x);
174 }
175 });
176
177 for (int i = 0; i < n.size(); i++)
178 n.get(i).n = i;
179
180 for (int i = 0; i < n.size(); i++) {
181 Node nn = n.get(i);
182 if (nn.refresh == null)
183 continue;
184 Node left = i > 0 ? n.get(i - 1) : null;
185 Node right = i < n.size() - 1 ? n.get(i + 1) : null;
186// System.out.println("@ " + i + " " + left + " " + nn + " " + right);
187 nn.refresh.apply(new Triple<>(left, nn, right));
188 }
189
190 dirty = false;
191 }
192
193 public double duration() {
194 clean();

Callers 3

bracketMethod · 0.95
durationMethod · 0.95
copyMethod · 0.95

Calls 3

getMethod · 0.65
applyMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected