예제 #1
0
  private Iterable<Path> internalPaths(Node start, Node end, boolean stopAsap) {
    if (start.equals(end)) {
      return Arrays.asList(PathImpl.singular(start));
    }

    Hits hits = new Hits();
    Collection<Long> sharedVisitedRels = new HashSet<Long>();
    MutableInteger sharedFrozenDepth = new MutableInteger(MutableInteger.NULL);
    MutableBoolean sharedStop = new MutableBoolean();
    MutableInteger sharedCurrentDepth = new MutableInteger(0);
    final DirectionData startData =
        new DirectionData(
            start,
            sharedVisitedRels,
            sharedFrozenDepth,
            sharedStop,
            sharedCurrentDepth,
            relExpander);
    final DirectionData endData =
        new DirectionData(
            end,
            sharedVisitedRels,
            sharedFrozenDepth,
            sharedStop,
            sharedCurrentDepth,
            relExpander.reversed());

    while (startData.hasNext() || endData.hasNext()) {
      goOneStep(startData, endData, hits, startData, stopAsap);
      goOneStep(endData, startData, hits, startData, stopAsap);
    }

    Collection<Hit> least = hits.least();
    return least != null ? hitsToPaths(least, start, end) : Collections.<Path>emptyList();
  }
예제 #2
0
 @Override
 Iterator<Relationship> doExpand(Path path, BranchState state) {
   return expander.expand(path.endNode()).iterator();
 }