コード例 #1
0
        /// <summary>
        ///   Determines whether this instance contains the specified item.
        /// </summary>
        ///
        /// <param name="item">The object to locate in the collection.
        ///   The value can be null for reference types.</param>
        ///
        /// <returns>
        ///   <c>true</c> if the item is found in the collection; otherwise, <c>false</c>.
        /// </returns>
        ///
        public bool Contains(NodeDistance <ColorTreeNode <T> > item)
        {
            int i = Array.IndexOf(positions, item.Node);

            if (i == -1)
            {
                return(false);
            }

            return(distances[i] == item.Distance);
        }
コード例 #2
0
 /// <summary>
 ///   Not supported.
 /// </summary>
 ///
 public bool Remove(NodeDistance <ColorTreeNode <T> > item)
 {
     throw new NotSupportedException();
 }
コード例 #3
0
 /// <summary>
 ///   Adds the specified item to this collection.
 /// </summary>
 ///
 /// <param name="item">The item.</param>
 ///
 public void Add(NodeDistance <ColorTreeNode <T> > item)
 {
     Add(item.Node, item.Distance);
 }
コード例 #4
0
 /// <summary>
 ///   Compares this instance to another node, returning an integer
 ///   indicating whether this instance has a distance that is less
 ///   than, equal to, or greater than the other node's distance.
 /// </summary>
 ///
 public int CompareTo(NodeDistance <TNode> other)
 {
     return(distance.CompareTo(other.distance));
 }
コード例 #5
0
 /// <summary>
 ///   Determines whether the specified <see cref="NodeDistance{T}"/>
 ///   is equal to this instance.
 /// </summary>
 ///
 /// <param name="other">The <see cref="NodeDistance{T}"/> to compare
 ///   with this instance.</param>
 ///
 /// <returns>
 ///   <c>true</c> if the specified <see cref="NodeDistance{T}"/> is
 ///   equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 ///
 public bool Equals(NodeDistance <TNode> other)
 {
     return(distance == other.distance && node.Equals(other.node));
 }