Пример #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);
        }
Пример #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);
        }
Пример #3
0
 public bool Contains(RangeValuePair <TKey, TValue> item)
 {
     return(_items.Contains(item));
 }
Пример #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);
 }