The Heap allows to maintain a list sorted as long as needed. If no IComparer interface has been provided at construction, then the list expects the Objects to implement IComparer. If the list is not sorted it behaves like an ordinary list. When sorted, the list's "Add" method will put new objects at the right place. As well the "Contains" and "IndexOf" methods will perform a binary search.
Inheritance: IList, ICloneable
Exemple #1
0
 public AStar()
 {
     FOpenList = new Heap();
     FClosedList = new Heap();
     FSuccessors = new ArrayList();
     FSolution = new ArrayList();
 }
 /// <summary>
 ///     ICloneable implementation.
 ///     Idem <see cref="ArrayList">ArrayList</see>
 /// </summary>
 /// <returns>Cloned object.</returns>
 public object Clone()
 {
     Heap newClone = new Heap(FComparer, FList.Capacity)
                      {FList = (ArrayList) FList.Clone(), FAddDuplicates = FAddDuplicates};
     return newClone;
 }