示例#1
0
 protected internal override Relationship fetchNextOrNull()
 {
     while (_pathIterator.MoveNext())
     {
         Path path = _pathIterator.Current;
         if (path.Length() > 0)
         {
             return(path.LastRelationship());
         }
     }
     return(null);
 }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void ensureCorrectPathEntitiesInShortPath()
        public virtual void EnsureCorrectPathEntitiesInShortPath()
        {
            /*
             * (a)-->(b)
             */
            CreateGraph("a TO b");

            Node         a    = GetNodeWithName("a");
            Node         b    = GetNodeWithName("b");
            Relationship r    = a.GetSingleRelationship(To, OUTGOING);
            Path         path = Iterables.single(GraphDb.bidirectionalTraversalDescription().mirroredSides(GraphDb.traversalDescription().relationships(To, OUTGOING).uniqueness(NODE_PATH)).collisionEvaluator(Evaluators.atDepth(1)).sideSelector(SideSelectorPolicies.LEVEL, 1).traverse(a, b));

            AssertContainsInOrder(path.Nodes(), a, b);
            AssertContainsInOrder(path.ReverseNodes(), b, a);
            AssertContainsInOrder(path.Relationships(), r);
            AssertContainsInOrder(path.ReverseRelationships(), r);
            AssertContainsInOrder(path, a, r, b);
            assertEquals(a, path.StartNode());
            assertEquals(b, path.EndNode());
            assertEquals(r, path.LastRelationship());
        }
示例#3
0
        private void AssertPathIsCorrect(Path path)
        {
            Node         a   = Node("A");
            Relationship to1 = GetFistRelationship(a);
            Node         b   = to1.EndNode;
            Relationship to2 = GetFistRelationship(b);
            Node         c   = to2.EndNode;
            Relationship to3 = GetFistRelationship(c);
            Node         d   = to3.EndNode;
            Relationship to4 = GetFistRelationship(d);
            Node         e   = to4.EndNode;

            assertEquals(( int? )4, ( int? )path.Length());
            assertEquals(a, path.StartNode());
            assertEquals(e, path.EndNode());
            assertEquals(to4, path.LastRelationship());

            AssertContainsInOrder(path, a, to1, b, to2, c, to3, d, to4, e);
            AssertContainsInOrder(path.Nodes(), a, b, c, d, e);
            AssertContainsInOrder(path.Relationships(), to1, to2, to3, to4);
            AssertContainsInOrder(path.ReverseNodes(), e, d, c, b, a);
            AssertContainsInOrder(path.ReverseRelationships(), to4, to3, to2, to1);
        }
示例#4
0
 protected internal override Relationship convert(Path path)
 {
     return(path.LastRelationship());
 }