Ejemplo n.º 1
0
        /// <summary>
        /// Removes the specified item. Tree will go out of sync.
        /// </summary>
        public bool Remove(RangeValuePair <TKey, TValue> item)
        {
            var removed = _items.Remove(item);

            _isInSync = _isInSync && !removed;
            return(removed);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns less than 0 if this range's From is less than the other, greater than 0 if greater.
        /// If both are equal, the comparison of the To values is returned.
        /// 0 if both ranges are equal.
        /// </summary>
        /// <param name="y">The other.</param>
        /// <returns></returns>
        int IComparer <RangeValuePair <TKey, TValue> > .Compare(RangeValuePair <TKey, TValue> x, RangeValuePair <TKey, TValue> y)
        {
            var fromComp = _comparer.Compare(x.From, y.From);

            if (fromComp == 0)
            {
                return(_comparer.Compare(x.To, y.To));
            }
            return(fromComp);
        }
Ejemplo n.º 3
0
 public bool Contains(RangeValuePair <TKey, TValue> item)
 {
     return(_items.Contains(item));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds the specified item. Tree will go out of sync.
 /// </summary>
 public void Add(RangeValuePair <TKey, TValue> item)
 {
     Add(item.From, item.To, item.Value);
 }
Ejemplo n.º 5
0
 public bool Equals(RangeValuePair <TKey, TValue> other)
 {
     return(EqualityComparer <TKey> .Default.Equals(From, other.From) &&
            EqualityComparer <TKey> .Default.Equals(To, other.To) &&
            EqualityComparer <TValue> .Default.Equals(Value, other.Value));
 }