Exemplo n.º 1
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());
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 protected internal override TraversalBranch NewNextBranch(Node node, Relationship relationship)
 {
     return(_initialState != InitialBranchState.NO_STATE ? new TraversalBranchWithState(this, 1, node, relationship, StateForChildren) : new TraversalBranchImpl(this, 1, node, relationship));
 }
Exemplo n.º 4
0
 internal bool Accept(Org.Neo4j.Graphdb.Node start, Org.Neo4j.Graphdb.Relationship rel)
 {
     return(MatchDirection(_direction, start, rel));
 }
Exemplo n.º 5
0
 protected internal override TraversalBranch NewNextBranch(Node node, Relationship relationship)
 {
     return(new TraversalBranchWithState(this, Length() + 1, node, relationship, StateForChildren));
 }
Exemplo n.º 6
0
 public TraversalBranchWithState(TraversalBranch parent, int depth, Node source, Relationship toHere, object inheritedState) : base(parent, depth, source, toHere)
 {
     this.StateForMe = this.StateForChildren = inheritedState;
 }