Example #1
0
 /// <summary>
 /// This method adds the node to the list based on totalcost of the node
 /// </summary>
 /// <param name="node"></param>
 public void Enqueue(AStarNode node)
 {
     bool found = false;
     for (int i = 0; i < nodes.Count; i++)
     {
         AStarNode holder = nodes[i];
         if (holder.TotalCost >= node.TotalCost)
         {
             nodes.Insert(i, node);
             found = true;
             break;
         }
     }
     if (!found)
     {
         nodes.Add(node);
     }
 }
Example #2
0
 /// <summary>
 /// This function removes the element from the Priority queue
 /// </summary>
 /// <param name="node"></param>
 public void Remove(AStarNode node)
 {
     nodes.Remove(node);
 }
Example #3
0
 /// <summary>
 /// This method checks whether the Priority queue contains the node or not
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public bool Contains(AStarNode node)
 {
     return nodes.Contains(node);
 }