Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void canUseBranchState()
        public virtual void CanUseBranchState()
        {
            // This test doesn't use the predefined finder, which only means an unnecessary instantiation
            // if such an object. And this test will be run twice (once for each finder type in data()).
            /// <summary>
            /// <pre>
            ///   012345    A - B:  2
            ///  +------>y  A - B:  2
            /// 0|A         B - C:  3
            /// 1|          A - C:  10
            /// 2| B
            /// 3|
            /// 4|
            /// 5|
            /// 6|
            /// 7|C
            ///  V
            ///  x
            ///
            /// </pre>
            /// </summary>
            Node nodeA = Graph.makeNode("A", "x", 0d, "y", 0d);
            Node nodeB = Graph.makeNode("B", "x", 2d, "y", 1d);
            Node nodeC = Graph.makeNode("C", "x", 7d, "y", 0d);

            Graph.makeEdge("A", "B", "length", 2d);
            Graph.makeEdge("A", "B", "length", 2d);
            Graph.makeEdge("B", "C", "length", 3d);
            Graph.makeEdge("A", "C", "length", 10d);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<org.neo4j.graphdb.Node, double> seenBranchStates = new java.util.HashMap<>();
            IDictionary <Node, double> seenBranchStates = new Dictionary <Node, double>();
            PathExpander <double>      expander         = new PathExpanderAnonymousInnerClass(this, seenBranchStates);

            double initialStateValue = 0D;
            PathFinder <WeightedPath> traversalFinder = new TraversalAStar(expander, new Org.Neo4j.Graphdb.traversal.InitialBranchState_State(initialStateValue, initialStateValue), doubleCostEvaluator("length"), EstimateEvaluator);
            WeightedPath path = traversalFinder.FindSinglePath(nodeA, nodeC);

            assertEquals(( double? )5.0D, ( double? )path.Weight());
            AssertPathDef(path, "A", "B", "C");
            assertEquals(MapUtil.genericMap <Node, double>(nodeA, 0D, nodeB, 2D), seenBranchStates);
        }
Exemple #2
0
 internal SelectorFactory(TraversalAStar outerInstance, Node end, PathInterest interest) : base(interest)
 {
     this._outerInstance = outerInstance;
     this.End            = end;
 }