• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integrateddynamics/core/path/PathFinder.java
1
package org.cyclops.integrateddynamics.core.path;
2

3
import org.cyclops.cyclopscore.datastructure.DimPos;
4
import org.cyclops.integrateddynamics.api.path.IPathElement;
5
import org.cyclops.integrateddynamics.api.path.ISidedPathElement;
6

7
import java.util.ArrayDeque;
8
import java.util.HashSet;
9
import java.util.Queue;
10
import java.util.Set;
11
import java.util.TreeSet;
12

13

14
/**
15
 * Algorithm to construct paths/clusters of {@link IPathElement}s.
16
 * @author rubensworks
17
 */
18
public final class PathFinder {
×
19

20
    protected static Set<ISidedPathElement> getConnectedElements(ISidedPathElement head) {
21
        Set<ISidedPathElement> connectedElements = new HashSet<>();
×
22
        Set<DimPos> visitedPositions = new HashSet<>();
×
23

24
        // Use a queue for BFS traversal.
25
        Queue<ISidedPathElement> queue = new ArrayDeque<>();
×
26
        DimPos headPos = head.getPathElement().getPosition();
×
27
        visitedPositions.add(headPos);
×
28
        queue.offer(head);
×
29

30
        while (!queue.isEmpty()) {
×
31
            ISidedPathElement current = queue.poll();
×
32
            connectedElements.add(current);
×
33
            IPathElement currentElement = current.getPathElement();
×
34

35
            for (ISidedPathElement neighbour : currentElement.getReachableElements()) {
×
36
                DimPos neighbourPos = neighbour.getPathElement().getPosition();
×
37
                if (visitedPositions.add(neighbourPos)) { // Adds and returns true if not already present.
×
38
                    queue.offer(neighbour);
×
39
                }
40
            }
×
41
        }
×
42

43
        return connectedElements;
×
44
    }
45

46
    public static Cluster getConnectedCluster(ISidedPathElement head) {
47
        return new Cluster(new TreeSet<>(getConnectedElements(head)));
×
48
    }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc