@Test public void testFindPathLargerDepth() { final Kam kam = createTestKAM(); final PathFinder pathFinder = new BasicPathFinder(kam, 6); SimplePath[] pathsFound = pathFinder.findPaths(kam.findNode(1), kam.findNode(5)); assertNotNull(pathsFound); assertEquals(2, pathsFound.length); List<KamEdge> edges = pathsFound[0].getEdges(); assertEquals(3, edges.size()); KamEdge[] edgeArray = edges.toArray(new KamEdge[edges.size()]); assertEquals(TRANSCRIBED_TO, edgeArray[0].getRelationshipType()); assertEquals(TRANSLATED_TO, edgeArray[1].getRelationshipType()); assertEquals(ACTS_IN, edgeArray[2].getRelationshipType()); edges = pathsFound[1].getEdges(); assertEquals(5, edges.size()); edgeArray = edges.toArray(new KamEdge[edges.size()]); assertEquals(TRANSCRIBED_TO, edgeArray[0].getRelationshipType()); assertEquals(TRANSLATED_TO, edgeArray[1].getRelationshipType()); assertEquals(HAS_COMPONENT, edgeArray[2].getRelationshipType()); assertEquals(HAS_COMPONENT, edgeArray[3].getRelationshipType()); assertEquals(INCREASES, edgeArray[4].getRelationshipType()); }
@Override public SimplePath[] findPaths(KamNode source, KamNode target) { if (source == null) { throw new InvalidArgument("Source kam node cannot be null."); } if (target == null) { throw new InvalidArgument("Target kam node cannot be null."); } if (!kam.contains(source)) { throw new InvalidArgument("Source does not exist in KAM."); } if (!kam.contains(target)) { throw new InvalidArgument("Target does not exist in KAM."); } final Set<KamNode> targets = sizedHashSet(1); targets.add(target); List<SimplePath> pathsFound = runDepthFirstSearch(kam, source, targets); return pathsFound.toArray(new SimplePath[pathsFound.size()]); }
BasicPathFinder implements PathFinder { @Override public SimplePath[] findPaths(KamNode source, KamNode target) { if (source == null) { throw new InvalidArgument("Source kam node cannot be null."); } if (target == null) { throw new InvalidArgument("Target kam node cannot be null."); } if (!kam.contains(source)) { throw new InvalidArgument("Source does not exist in KAM."); } if (!kam.contains(target)) { throw new InvalidArgument("Target does not exist in KAM."); } final Set<KamNode> targets = sizedHashSet(1); targets.add(target); List<SimplePath> pathsFound = runDepthFirstSearch(kam, source, targets); return pathsFound.toArray(new SimplePath[pathsFound.size()]); } }
BasicPathFinder implements PathFinder { @Override public SimplePath[] findPaths(KamNode source, KamNode target) { if (source == null) { throw new InvalidArgument("Source kam node cannot be null."); } if (target == null) { throw new InvalidArgument("Target kam node cannot be null."); } if (!kam.contains(source)) { throw new InvalidArgument("Source does not exist in KAM."); } if (!kam.contains(target)) { throw new InvalidArgument("Target does not exist in KAM."); } final Set<KamNode> targets = sizedHashSet(1); targets.add(target); List<SimplePath> pathsFound = runDepthFirstSearch(kam, source, targets); return pathsFound.toArray(new SimplePath[pathsFound.size()]); } BasicPathFinder(final Kam kam);  BasicPathFinder(final Kam kam, final int maxSearchDepth); }
BasicPathFinder implements PathFinder { @Override public SimplePath[] findPaths(KamNode source, KamNode target) { if (source == null) { throw new InvalidArgument("Source kam node cannot be null."); } if (target == null) { throw new InvalidArgument("Target kam node cannot be null."); } if (!kam.contains(source)) { throw new InvalidArgument("Source does not exist in KAM."); } if (!kam.contains(target)) { throw new InvalidArgument("Target does not exist in KAM."); } final Set<KamNode> targets = sizedHashSet(1); targets.add(target); List<SimplePath> pathsFound = runDepthFirstSearch(kam, source, targets); return pathsFound.toArray(new SimplePath[pathsFound.size()]); } BasicPathFinder(final Kam kam);  BasicPathFinder(final Kam kam, final int maxSearchDepth); @Override SimplePath[] findPaths(KamNode source, KamNode target); @Override SimplePath[] findPaths(KamNode[] sources, KamNode[] targets); @Override SimplePath[] interconnect(KamNode[] sources); @Override SimplePath[] scan(KamNode source); @Override SimplePath[] scan(KamNode[] sources); }
BasicPathFinder implements PathFinder { @Override public SimplePath[] findPaths(KamNode source, KamNode target) { if (source == null) { throw new InvalidArgument("Source kam node cannot be null."); } if (target == null) { throw new InvalidArgument("Target kam node cannot be null."); } if (!kam.contains(source)) { throw new InvalidArgument("Source does not exist in KAM."); } if (!kam.contains(target)) { throw new InvalidArgument("Target does not exist in KAM."); } final Set<KamNode> targets = sizedHashSet(1); targets.add(target); List<SimplePath> pathsFound = runDepthFirstSearch(kam, source, targets); return pathsFound.toArray(new SimplePath[pathsFound.size()]); } BasicPathFinder(final Kam kam);  BasicPathFinder(final Kam kam, final int maxSearchDepth); @Override SimplePath[] findPaths(KamNode source, KamNode target); @Override SimplePath[] findPaths(KamNode[] sources, KamNode[] targets); @Override SimplePath[] interconnect(KamNode[] sources); @Override SimplePath[] scan(KamNode source); @Override SimplePath[] scan(KamNode[] sources); final static int DEFAULT_MAX_SEARCH_DEPTH; }