/// <summary> /// remove an edge from the list /// </summary> public void Remove(Edge e) { int index = EdgeList.BinarySearch(e); if (index >= 0) { EdgeList.RemoveAt(index); } }
/// <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); } }
/// <summary> /// Gets the index of this edge /// </summary> public int GetIndexOf(Edge e) { return(EdgeList.BinarySearch(e)); }