Ejemplo n.º 1
0
        public override TraversalBranch Next(TraversalContext metadata)
        {
            TraversalBranch result = null;

            while (result == null)
            {
                if (_current == null)
                {
                    _current = _superNodes.RemoveFirst();
                    if (_current == null)
                    {
                        return(null);
                    }
                }
                else if (_current.expanded() > 0 && _current.expanded() % _threshold == 0)
                {
                    _superNodes.AddLast(_current);
                    _current = _current.parent();
                    continue;
                }

                TraversalBranch next = _current.next(_expander, metadata);
                if (next == null)
                {
                    _current = _current.parent();
                    continue;
                }
                _current = next;
                result   = _current;
            }
            return(result);
        }
        public override IEnumerator <PropertyContainer> Iterator()
        {
            // TODO Don't loop through them all up front
            LinkedList <PropertyContainer> entities = new LinkedList <PropertyContainer>();
            TraversalBranch branch = _start;

            while (branch.Length() > 0)
            {
                entities.AddFirst(branch.EndNode());
                entities.AddFirst(branch.LastRelationship());
                branch = branch.Parent();
            }
            entities.AddFirst(branch.EndNode());
            if (_cachedStartNode == null)
            {
                _cachedStartNode = branch.EndNode();
            }
            if (_end.length() > 0)
            {
                entities.AddLast(_end.lastRelationship());
                branch = _end.parent();
                while (branch.Length() > 0)
                {
                    entities.AddLast(branch.EndNode());
                    entities.AddLast(branch.LastRelationship());
                    branch = branch.Parent();
                }
                entities.AddLast(branch.EndNode());
            }
            return(entities.GetEnumerator());
        }
Ejemplo n.º 3
0
 protected internal override Node fetchNextOrNull()
 {
     try
     {
         return(branch.length() >= 0 ? branch.endNode() : null);
     }
     finally
     {
         branch = branch.parent();
     }
 }
Ejemplo n.º 4
0
 protected internal override Relationship fetchNextOrNull()
 {
     try
     {
         return(branch != null?branch.lastRelationship() : null);
     }
     finally
     {
         branch = branch != null?branch.parent() : null;
     }
 }
Ejemplo n.º 5
0
        public override TraversalBranch Next(TraversalContext metadata)
        {
            TraversalBranch result = null;

            while (result == null)
            {
                if (_current == null)
                {
                    return(null);
                }
                TraversalBranch next = _current.next(_expander, metadata);
                if (next == null)
                {
                    _current = _current.parent();
                    continue;
                }
                _current = next;
                result   = _current;
            }
            return(result);
        }