/// <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); }
/// <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); }
public bool Contains(RangeValuePair <TKey, TValue> item) { return(_items.Contains(item)); }
/// <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); }
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)); }