Ejemplo n.º 1
0
    /// <summary>
    /// remove an edge from the list
    /// </summary>
    public void Remove(Edge e)
    {
        int index = EdgeList.BinarySearch(e);

        if (index >= 0)
        {
            EdgeList.RemoveAt(index);
        }
    }
Ejemplo n.º 2
0
 /// <summary>
 /// insert new edge to the list
 /// </summary>
 public void Insert(Edge e)
 {
     if (EdgeList.Count == 0)
     {
         EdgeList.Add(e);
     }
     else if (EdgeList [EdgeList.Count - 1].CompareTo(e) <= 0)
     {
         EdgeList.Add(e);
     }
     else if (EdgeList [0].CompareTo(e) >= 0)
     {
         EdgeList.Insert(0, e);
     }
     else
     {
         int index = EdgeList.BinarySearch(e);
         if (index < 0)
         {
             index = ~index;
         }
         EdgeList.Insert(index, e);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the index of this edge
 /// </summary>
 public int GetIndexOf(Edge e)
 {
     return(EdgeList.BinarySearch(e));
 }