Ejemplo n.º 1
0
 public void TestInitializationArrayNull()
 {
     Assert.Throws <NullReferenceException>(delegate
     {
         ArrayServices.InitializeArrayValue <int>(null, 0);
     });
 }
Ejemplo n.º 2
0
        public PathFinderAStar(Graph graph, AHeuristicComparer heuristicComparer = null) : base(graph)
        {
            Distances = new int[Graph.PlanetSize];
            ArrayServices.InitializeArrayValue(Distances, int.MaxValue);

            Path = new GraphNode[Graph.PlanetSize];
            ArrayServices.InitializeArrayValue(Path, null);

            PathDirections = new char[Graph.PlanetSize];
            ArrayServices.InitializeArrayValue(PathDirections, ' ');

            ClosedSet = new bool[Graph.PlanetSize];
            ArrayServices.InitializeArrayValue(ClosedSet, false);

            if (heuristicComparer == null)
            {
                HeuristicComparer = new HeuristicComparerSimple(graph);
            }
            else
            {
                HeuristicComparer = heuristicComparer;
            }

            OpenSet = new PriorityQueue <GraphNodeHeuristic>(300, HeuristicComparer, new GraphNodeEquality());
        }
Ejemplo n.º 3
0
 public void TestInitializationArrayValue()
 {
     int[] values = new int[4];
     ArrayServices.InitializeArrayValue <int>(values, 0);
     Assert.AreEqual(values, new int[] { 0, 0, 0, 0 });
 }