protected internal override WeightedPath FetchNextOrNull() { if (_shortestIterator == null) { _shortestPaths = new List <WeightedPath>(); while (_paths.MoveNext()) { WeightedPath path = new WeightedPathImpl(_costEvaluator, _paths.Current); if (NoneStrictMath.compare(path.Weight(), _foundWeight, _epsilon) < 0) { _foundWeight = path.Weight(); _shortestPaths.Clear(); } if (NoneStrictMath.compare(path.Weight(), _foundWeight, _epsilon) <= 0) { _shortestPaths.Add(path); } } _shortestIterator = _shortestPaths.GetEnumerator(); } //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: return(_shortestIterator.hasNext() ? _shortestIterator.next() : null); }
public override IEnumerable <Relationship> Expand(Path path, BranchState <double> state) { if (NoneStrictMath.compare(state.State, ShortestSoFar.doubleValue(), Epsilon) > 0 && StopAfterLowestCost) { return(Collections.emptyList()); } return(Source.expand(path, state)); }
public override IEnumerable <Relationship> Expand(Path path, BranchState <double> state) { double thisState = state.State; ThisSideShortest.Value = thisState; if (NoneStrictMath.compare(thisState + OtherSideShortest.doubleValue(), ShortestSoFar.doubleValue(), Epsilon) > 0 && StopAfterLowestCost) { return(Iterables.emptyResourceIterable()); } return(Source.expand(path, state)); }
public override bool CanBeRuledOut(int numberOfVisits, double?pathPriority, double?oldPriority) { return(numberOfVisits > 0 || NoneStrictMath.compare(pathPriority.Value, oldPriority.Value, Epsilon) >= 0); }