Ejemplo n.º 1
0
        private IEnumerable <Path> InternalPaths(Node start, Node end, bool stopAsap)
        {
            _lastMetadata = new Metadata();
            if (start.Equals(end))
            {
                return(FilterPaths(Collections.singletonList(PathImpl.singular(start))));
            }
            Hits hits = new Hits();
            ICollection <long> sharedVisitedRels  = new HashSet <long>();
            MutableInt         sharedFrozenDepth  = new MutableInt(Null);        // ShortestPathLengthSoFar
            MutableBoolean     sharedStop         = new MutableBoolean();
            MutableInt         sharedCurrentDepth = new MutableInt(0);

            using (DirectionData startData = new DirectionData(this, start, sharedVisitedRels, sharedFrozenDepth, sharedStop, sharedCurrentDepth, _expander), DirectionData endData = new DirectionData(this, end, sharedVisitedRels, sharedFrozenDepth, sharedStop, sharedCurrentDepth, _expander.reverse()))
            {
                while (startData.MoveNext() || endData.MoveNext())
                {
                    GoOneStep(startData, endData, hits, startData, stopAsap);
                    GoOneStep(endData, startData, hits, startData, stopAsap);
                }
                ICollection <Hit> least = hits.Least();
                return(least != null?FilterPaths(HitsToPaths( least, start, end, stopAsap, _maxResultCount )) : Collections.emptyList());
            }
        }