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);
        }
Exemplo n.º 2
0
        protected internal override WeightedPath FetchNextOrNull()
        {
            if (!_interest.stillInteresting(++_foundTotal))
            {
                return(null);
            }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            if (!_paths.hasNext())
            {
                return(null);
            }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            WeightedPath path = new WeightedPathImpl(_costEvaluator, _paths.next());

            if (_interest.stopAfterLowestCost() && _foundWeight != null && NoneStrictMath.compare(path.Weight(), _foundWeight.Value, _epsilon) > 0)
            {
                return(null);
            }
            _foundWeight = path.Weight();
            return(path);
        }