Пример #1
0
        // Attempt at recreating this issue without cypher
        // https://github.com/neo4j/neo4j/issues/4160
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAbortAsSoonAsPossible()
        public virtual void ShouldAbortAsSoonAsPossible()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Label A = org.neo4j.graphdb.Label.label("A");
            Label a = Label.label("A");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Label B = org.neo4j.graphdb.Label.label("B");
            Label b = Label.label("B");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Label C = org.neo4j.graphdb.Label.label("C");
            Label c = Label.label("C");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Label D = org.neo4j.graphdb.Label.label("D");
            Label d = Label.label("D");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Label E = org.neo4j.graphdb.Label.label("E");
            Label e = Label.label("E");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Label F = org.neo4j.graphdb.Label.label("F");
            Label f = Label.label("F");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.RelationshipType relType = org.neo4j.graphdb.RelationshipType.withName("TO");
            RelationshipType relType = RelationshipType.withName("TO");

            RecursiveSnowFlake(null, 0, 4, 5, new Label[] { a, b, c, d, e }, relType);
            Node a = GetNodeByLabel(a);

            using (ResourceIterator <Node> allE = GraphDb.findNodes(e))
            {
                while (allE.MoveNext())
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Node e = allE.Current;
                    Node e = allE.Current;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Node f = graphDb.createNode(F);
                    Node f = GraphDb.createNode(f);
                    f.CreateRelationshipTo(e, relType);
                }
            }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final CountingPathExpander countingPathExpander = new CountingPathExpander(org.neo4j.graphdb.PathExpanders.forTypeAndDirection(relType, org.neo4j.graphdb.Direction.OUTGOING));
            CountingPathExpander countingPathExpander = new CountingPathExpander(this, PathExpanders.forTypeAndDirection(relType, Direction.OUTGOING));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ShortestPath shortestPath = new ShortestPath(Integer.MAX_VALUE, countingPathExpander, Integer.MAX_VALUE);
            ShortestPath shortestPath = new ShortestPath(int.MaxValue, countingPathExpander, int.MaxValue);

            using (ResourceIterator <Node> allF = GraphDb.findNodes(f))
            {
                while (allF.MoveNext())
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Node f = allF.Current;
                    Node f = allF.Current;
                    shortestPath.FindAllPaths(a, f);
                }
            }
            assertEquals("There are 625 different end nodes. The algorithm should start one traversal for each such node. " + "That is 625*2 visited nodes if traversal is interrupted correctly.", 1250, countingPathExpander.NodesVisited.intValue());
        }
Пример #2
0
 internal DirectionData(ShortestPath outerInstance, Node startNode, ICollection <long> sharedVisitedRels, MutableInt sharedFrozenDepth, MutableBoolean sharedStop, MutableInt sharedCurrentDepth, PathExpander expander)
 {
     this._outerInstance          = outerInstance;
     this.StartNode               = startNode;
     this.VisitedNodes[startNode] = new LevelData(null, 0);
     this.NextNodes.Add(startNode);
     this.SharedFrozenDepth  = sharedFrozenDepth;
     this.SharedStop         = sharedStop;
     this.SharedCurrentDepth = sharedCurrentDepth;
     this.Expander           = expander;
     this.SharedVisitedRels  = sharedVisitedRels;
     this.LastPath           = new DirectionDataPath(startNode);
     if (sharedCurrentDepth.intValue() < outerInstance.maxDepth)
     {
         PrepareNextLevel();
     }
     else
     {
         this.NextRelationships = Iterators.emptyResourceIterator();
     }
 }