Show / Hide Table of Contents

    Class TreeSet<T>

    An implementation of Red-Black trees as an indexed, sorted collection with set semantics, cf. CLRS. C5.TreeBag`1 for a version with bag semantics. C5.TreeDictionary`2 for a sorted dictionary based on this tree implementation. The comparer (sorting order) may be either natural, because the item type is comparable (generic: C5.IComparable`1 or non-generic: System.IComparable) or it can be external and supplied by the user in the constructor.

    TODO: describe performance here TODO: discuss persistence and its useful usage modes. Warn about the space leak possible with other usage modes.

    Inheritance
    System.Object
    EnumerableBase<T>
    CollectionValueBase<T>
    CollectionBase<T>
    DirectedCollectionBase<T>
    SequencedBase<T>
    TreeSet<T>
    Implements
    IIndexedSorted<T>
    IIndexed<T>
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    System.Collections.IEnumerable
    IPersistentSorted<T>
    ISorted<T>
    ISequenced<T>
    ICollection<T>
    IExtensible<T>
    System.Collections.Generic.ICollection<T>
    IDirectedCollectionValue<T>
    ICollectionValue<T>
    IShowable
    IFormattable
    IDirectedEnumerable<T>
    System.Collections.Generic.IEnumerable<T>
    IDisposable
    System.Collections.Generic.ISet<T>
    Inherited Members
    SequencedBase<T>.ComputeHashCode(ISequenced<T>, System.Collections.Generic.IEqualityComparer<T>)
    SequencedBase<T>.StaticEquals(ISequenced<T>, ISequenced<T>, System.Collections.Generic.IEqualityComparer<T>)
    SequencedBase<T>.GetSequencedHashCode()
    SequencedBase<T>.SequencedEquals(ISequenced<T>)
    SequencedBase<T>.Direction
    SequencedBase<T>.FindIndex(Func<T, Boolean>)
    SequencedBase<T>.FindLastIndex(Func<T, Boolean>)
    DirectedCollectionBase<T>.FindLast(Func<T, Boolean>, T)
    CollectionBase<T>.isReadOnlyBase
    CollectionBase<T>.stamp
    CollectionBase<T>.size
    CollectionBase<T>.itemequalityComparer
    CollectionBase<T>.checkRange(Int32, Int32)
    CollectionBase<T>.ComputeHashCode(ICollectionValue<T>, System.Collections.Generic.IEqualityComparer<T>)
    CollectionBase<T>.StaticEquals(ICollection<T>, ICollection<T>, System.Collections.Generic.IEqualityComparer<T>)
    CollectionBase<T>.GetUnsequencedHashCode()
    CollectionBase<T>.UnsequencedEquals(ICollection<T>)
    CollectionBase<T>.modifycheck(Int32)
    CollectionBase<T>.updatecheck()
    CollectionBase<T>.IsReadOnly
    CollectionBase<T>.Count
    CollectionBase<T>.CountSpeed
    CollectionBase<T>.EqualityComparer
    CollectionBase<T>.IsEmpty
    CollectionValueBase<T>.ActiveEvents
    CollectionValueBase<T>.CollectionChanged
    CollectionValueBase<T>.raiseCollectionChanged()
    CollectionValueBase<T>.CollectionCleared
    CollectionValueBase<T>.raiseCollectionCleared(Boolean, Int32)
    CollectionValueBase<T>.raiseCollectionCleared(Boolean, Int32, Nullable<Int32>)
    CollectionValueBase<T>.ItemsAdded
    CollectionValueBase<T>.raiseItemsAdded(T, Int32)
    CollectionValueBase<T>.ItemsRemoved
    CollectionValueBase<T>.raiseItemsRemoved(T, Int32)
    CollectionValueBase<T>.ItemInserted
    CollectionValueBase<T>.raiseItemInserted(T, Int32)
    CollectionValueBase<T>.ItemRemovedAt
    CollectionValueBase<T>.raiseItemRemovedAt(T, Int32)
    CollectionValueBase<T>.raiseForSetThis(Int32, T, T)
    CollectionValueBase<T>.raiseForInsert(Int32, T)
    CollectionValueBase<T>.raiseForRemove(T)
    CollectionValueBase<T>.raiseForRemove(T, Int32)
    CollectionValueBase<T>.raiseForRemoveAt(Int32, T)
    CollectionValueBase<T>.raiseForUpdate(T, T)
    CollectionValueBase<T>.raiseForUpdate(T, T, Int32)
    CollectionValueBase<T>.raiseForAdd(T)
    CollectionValueBase<T>.raiseForRemoveAll(ICollectionValue<T>)
    CollectionValueBase<T>.CopyTo(T[], Int32)
    CollectionValueBase<T>.ToArray()
    CollectionValueBase<T>.Apply(Action<T>)
    CollectionValueBase<T>.Exists(Func<T, Boolean>)
    CollectionValueBase<T>.Find(Func<T, Boolean>, T)
    CollectionValueBase<T>.All(Func<T, Boolean>)
    CollectionValueBase<T>.Filter(Func<T, Boolean>)
    CollectionValueBase<T>.Show(System.Text.StringBuilder, Int32, IFormatProvider)
    CollectionValueBase<T>.ToString(String, IFormatProvider)
    CollectionValueBase<T>.ToString()
    EnumerableBase<T>.countItems(System.Collections.Generic.IEnumerable<T>)
    Namespace: Lucene.Net.Support
    Assembly: Lucene.Net.dll
    Syntax
    public class TreeSet<T> : SequencedBase<T>, IIndexedSorted<T>, IIndexed<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, System.Collections.IEnumerable, IPersistentSorted<T>, ISorted<T>, ISequenced<T>, ICollection<T>, IExtensible<T>, System.Collections.Generic.ICollection<T>, IDirectedCollectionValue<T>, ICollectionValue<T>, IShowable, IFormattable, IDirectedEnumerable<T>, System.Collections.Generic.IEnumerable<T>, IDisposable, System.Collections.Generic.ISet<T>
    Type Parameters
    Name Description
    T

    Constructors

    | Improve this Doc View Source

    TreeSet(MemoryType)

    Create a red-black tree collection with natural comparer and item equalityComparer. We assume that if

    T
    is comparable, its default equalityComparer will be compatible with the comparer.

    Declaration
    public TreeSet(MemoryType memoryType = MemoryType.Normal)
    Parameters
    Type Name Description
    MemoryType memoryType
    Exceptions
    Type Condition
    NotComparableException

    If

    T
    is not comparable.

    | Improve this Doc View Source

    TreeSet(System.Collections.Generic.IComparer<T>, MemoryType)

    Create a red-black tree collection with an external comparer.

    The itemequalityComparer will be a compatible C5.ComparerZeroHashCodeEqualityComparer`1 since the default equalityComparer for T (C5.EqualityComparer`1.Default) is unlikely to be compatible with the external comparer. This makes the tree inadequate for use as item in a collection of unsequenced or sequenced sets or bags (C5.ICollection`1 and C5.ISequenced`1)

    Declaration
    public TreeSet(System.Collections.Generic.IComparer<T> comparer, MemoryType memoryType = MemoryType.Normal)
    Parameters
    Type Name Description
    System.Collections.Generic.IComparer<T> comparer

    The external comparer

    MemoryType memoryType
    | Improve this Doc View Source

    TreeSet(System.Collections.Generic.IComparer<T>, System.Collections.Generic.IEqualityComparer<T>, MemoryType)

    Create a red-black tree collection with an external comparer and an external item equalityComparer, assumed consistent.

    Declaration
    public TreeSet(System.Collections.Generic.IComparer<T> comparer, System.Collections.Generic.IEqualityComparer<T> equalityComparer, MemoryType memoryType = MemoryType.Normal)
    Parameters
    Type Name Description
    System.Collections.Generic.IComparer<T> comparer

    The external comparer

    System.Collections.Generic.IEqualityComparer<T> equalityComparer

    The external item equalitySCG.Comparer

    MemoryType memoryType

    Properties

    | Improve this Doc View Source

    AllowsDuplicates

    Declaration
    public bool AllowsDuplicates { get; }
    Property Value
    Type Description
    System.Boolean

    False since this tree has set semantics.

    | Improve this Doc View Source

    Comparer

    The comparer object supplied at creation time for this collection

    Declaration
    public System.Collections.Generic.IComparer<T> Comparer { get; }
    Property Value
    Type Description
    System.Collections.Generic.IComparer<T>

    The comparer

    | Improve this Doc View Source

    ContainsSpeed

    The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant).

    Declaration
    public Speed ContainsSpeed { get; }
    Property Value
    Type Description
    Speed

    Speed.Log

    | Improve this Doc View Source

    DuplicatesByCounting

    By convention this is true for any collection with set semantics.

    Declaration
    public virtual bool DuplicatesByCounting { get; }
    Property Value
    Type Description
    System.Boolean

    True if only one representative of a group of equal items is kept in the collection together with the total count.

    | Improve this Doc View Source

    IndexingSpeed

    Declaration
    public virtual Speed IndexingSpeed { get; }
    Property Value
    Type Description
    Speed
    | Improve this Doc View Source

    Item[Int32]

    if i is negative or

    = the size of the collection.

    Declaration
    public T this[int i] { get; }
    Parameters
    Type Name Description
    System.Int32 i

    the index to lookup

    Property Value
    Type Description
    T

    The i'th item of this list.

    | Improve this Doc View Source

    Item[Int32, Int32]

    .

    Declaration
    public IDirectedCollectionValue<T> this[int start, int count] { get; }
    Parameters
    Type Name Description
    System.Int32 start

    The starting index of the interval (inclusive).

    System.Int32 count

    The length of the interval.

    Property Value
    Type Description
    IDirectedCollectionValue<T>

    The directed collection of items in a specific index interval.

    | Improve this Doc View Source

    ListenableEvents

    Declaration
    public override EventTypeEnum ListenableEvents { get; }
    Property Value
    Type Description
    EventTypeEnum
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<T>.ListenableEvents

    Methods

    | Improve this Doc View Source

    Add(T)

    Add an item to this collection if possible. If this collection has set semantics, the item will be added if not already in the collection. If bag semantics, the item will always be added.

    Declaration
    public bool Add(T item)
    Parameters
    Type Name Description
    T item

    The item to add.

    Returns
    Type Description
    System.Boolean

    True if item was added.

    | Improve this Doc View Source

    AddAll(System.Collections.Generic.IEnumerable<T>)

    Add the elements from another collection with a more specialized item type to this collection. If this collection has set semantics, only items not already in the collection will be added.

    Declaration
    public void AddAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to add

    | Improve this Doc View Source

    AddSorted(System.Collections.Generic.IEnumerable<T>)

    Add all the items from another collection with an enumeration order that is increasing in the items.

    The idea is that the implementation may use a faster algorithm to merge the two collections.

    if the enumerated items turns out not to be in increasing order.

    Declaration
    public void AddSorted(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The collection to add.

    | Improve this Doc View Source

    Backwards()

    Create a collection containing the same items as this collection, but whose enumerator will enumerate the items backwards. The new collection will become invalid if the original is modified. Method typically used as in

    foreach (T x in coll.Backwards()) {...}
    Declaration
    public override IDirectedCollectionValue<T> Backwards()
    Returns
    Type Description
    IDirectedCollectionValue<T>

    The backwards collection.

    Overrides
    Lucene.Net.Support.C5.DirectedCollectionBase<T>.Backwards()
    | Improve this Doc View Source

    Check()

    Checks red-black invariant. Dumps tree to console if bad

    Declaration
    public bool Check()
    Returns
    Type Description
    System.Boolean

    false if invariant violation

    | Improve this Doc View Source

    Check(String)

    Checks red-black invariant. Dumps tree to console if bad

    Declaration
    public bool Check(string name)
    Parameters
    Type Name Description
    System.String name

    Title of dump

    Returns
    Type Description
    System.Boolean

    false if invariant violation

    | Improve this Doc View Source

    Choose()

    Declaration
    public override T Choose()
    Returns
    Type Description
    T
    Overrides
    Lucene.Net.Support.C5.CollectionValueBase<T>.Choose()
    Exceptions
    Type Condition
    NoSuchItemException

    If tree is empty

    | Improve this Doc View Source

    Clear()

    Remove all items from this collection.

    Declaration
    public void Clear()
    | Improve this Doc View Source

    Contains(T)

    Check if this collection contains (an item equivalent to according to the itemequalityComparer) a particular value.

    Declaration
    public bool Contains(T item)
    Parameters
    Type Name Description
    T item

    The value to check for.

    Returns
    Type Description
    System.Boolean

    True if the items is in this collection.

    | Improve this Doc View Source

    ContainsAll(System.Collections.Generic.IEnumerable<T>)

    Check if this collection contains all the values in another collection. If this collection has bag semantics (

    AllowsDuplicates==true
    ) the check is made with respect to multiplicities, else multiplicities are not taken into account.

    Declaration
    public bool ContainsAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The

    Returns
    Type Description
    System.Boolean

    True if all values in

    items
    is in this collection.

    | Improve this Doc View Source

    ContainsCount(T)

    Count the number of items of the collection equal to a particular value. Returns 0 if and only if the value is not in the collection.

    Declaration
    public int ContainsCount(T item)
    Parameters
    Type Name Description
    T item

    The value to count.

    Returns
    Type Description
    System.Int32

    The number of copies found.

    | Improve this Doc View Source

    CountFrom(T)

    Determine the number of items at or above a supplied threshold.

    Declaration
    public int CountFrom(T bot)
    Parameters
    Type Name Description
    T bot

    The lower bound (inclusive)

    Returns
    Type Description
    System.Int32

    The number of matching items.

    | Improve this Doc View Source

    CountFromTo(T, T)

    Determine the number of items between two supplied thresholds.

    Declaration
    public int CountFromTo(T bot, T top)
    Parameters
    Type Name Description
    T bot

    The lower bound (inclusive)

    T top

    The upper bound (exclusive)

    Returns
    Type Description
    System.Int32

    The number of matching items.

    | Improve this Doc View Source

    CountTo(T)

    Determine the number of items below a supplied threshold.

    Declaration
    public int CountTo(T top)
    Parameters
    Type Name Description
    T top

    The upper bound (exclusive)

    Returns
    Type Description
    System.Int32

    The number of matching items.

    | Improve this Doc View Source

    Cut(IComparable<T>, out T, out Boolean, out T, out Boolean)

    Perform a search in the sorted collection for the ranges in which a non-increasing (i.e. weakly decreasing) function from the item type to

    int
    is

    negative, zero respectively positive. If the supplied cut function is not non-increasing, the result of this call is undefined.

    Declaration
    public bool Cut(IComparable<T> c, out T low, out bool lowIsValid, out T high, out bool highIsValid)
    Parameters
    Type Name Description
    IComparable<T> c

    The cut function

    T
    to
    int
    , given as an
    IComparable<T>
    object, where the cut function is the
    c.CompareTo(T that)
    method.

    T low

    Returns the largest item in the collection, where the cut function is positive (if any).

    System.Boolean lowIsValid

    True if the cut function is positive somewhere on this collection.

    T high

    Returns the least item in the collection, where the cut function is negative (if any).

    System.Boolean highIsValid

    True if the cut function is negative somewhere on this collection.

    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    DeleteMax()

    Remove the largest item from this priority queue.

    Declaration
    public T DeleteMax()
    Returns
    Type Description
    T

    The removed item.

    | Improve this Doc View Source

    DeleteMin()

    Remove the least item from this priority queue.

    Declaration
    public T DeleteMin()
    Returns
    Type Description
    T

    The removed item.

    | Improve this Doc View Source

    Dispose()

    If this tree is a snapshot, remove registration in base tree

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    dump()

    Print the tree structure to the console stdout.

    Declaration
    public void dump()
    | Improve this Doc View Source

    dump(String)

    Print the tree structure to the console stdout.

    Declaration
    public void dump(string msg)
    Parameters
    Type Name Description
    System.String msg
    | Improve this Doc View Source

    ExceptWith(System.Collections.Generic.IEnumerable<T>)

    Removes all elements in the specified collection from the current TreeSet<T> object.

    Declaration
    public virtual void ExceptWith(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection of items to remove from the set.

    | Improve this Doc View Source

    Find(ref T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found.

    Declaration
    public bool Find(ref T item)
    Parameters
    Type Name Description
    T item

    The value to look for.

    Returns
    Type Description
    System.Boolean

    True if the items is in this collection.

    | Improve this Doc View Source

    FindAll(Func<T, Boolean>)

    Create a new indexed sorted collection consisting of the items of this indexed sorted collection satisfying a certain predicate.

    Declaration
    public IIndexedSorted<T> FindAll(Func<T, bool> filter)
    Parameters
    Type Name Description
    Func<T, System.Boolean> filter

    The filter delegate defining the predicate.

    Returns
    Type Description
    IIndexedSorted<T>

    The new indexed sorted collection.

    | Improve this Doc View Source

    FindMax()

    Find the current largest item of this priority queue.

    Declaration
    public T FindMax()
    Returns
    Type Description
    T

    The largest item.

    | Improve this Doc View Source

    FindMin()

    Find the current least item of this priority queue.

    Declaration
    public T FindMin()
    Returns
    Type Description
    T

    The least item.

    | Improve this Doc View Source

    FindOrAdd(ref T)

    Find or add the item to the tree. If the tree does not contain an item equivalent to this item add it, else return the existing one in the ref argument.

    Declaration
    public bool FindOrAdd(ref T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    System.Boolean

    True if item was found

    | Improve this Doc View Source

    GetEnumerator()

    Create an enumerator for this tree

    Declaration
    public override System.Collections.Generic.IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<T>

    The enumerator

    Overrides
    Lucene.Net.Support.C5.EnumerableBase<T>.GetEnumerator()
    | Improve this Doc View Source

    IndexOf(T)

    Searches for an item in this indexed collection going forwards from the start.

    Declaration
    public int IndexOf(T item)
    Parameters
    Type Name Description
    T item

    Item to search for.

    Returns
    Type Description
    System.Int32

    Index of first occurrence from start of the item if found, else the two-complement (always negative) of the index at which the item would be put if it was added.

    | Improve this Doc View Source

    IntersectWith(System.Collections.Generic.IEnumerable<T>)

    Modifies the current TreeSet<T> object so that it contains only elements that are also in a specified collection.

    Declaration
    public virtual void IntersectWith(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current set.

    | Improve this Doc View Source

    IsProperSubsetOf(System.Collections.Generic.IEnumerable<T>)

    Determines whether a TreeSet<T> object is a proper subset of the specified collection.

    Declaration
    public virtual bool IsProperSubsetOf(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current TreeSet<T> object.

    Returns
    Type Description
    System.Boolean

    true if the TreeSet<T> object is a proper subset of other; otherwise, false.

    | Improve this Doc View Source

    IsProperSupersetOf(System.Collections.Generic.IEnumerable<T>)

    Determines whether a TreeSet<T> object is a proper superset of the specified collection.

    Declaration
    public virtual bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current TreeSet<T> object.

    Returns
    Type Description
    System.Boolean

    true if the TreeSet<T> object is a proper superset of other; otherwise, false.

    | Improve this Doc View Source

    IsSubsetOf(System.Collections.Generic.IEnumerable<T>)

    Determines whether a TreeSet<T> object is a subset of the specified collection.

    Declaration
    public virtual bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current TreeSet<T> object.

    Returns
    Type Description
    System.Boolean

    true if the TreeSet<T> object is a subset of other; otherwise, false.

    | Improve this Doc View Source

    IsSupersetOf(System.Collections.Generic.IEnumerable<T>)

    Determines whether a TreeSet<T> object is a superset of the specified collection.

    Declaration
    public virtual bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current TreeSet<T> object.

    Returns
    Type Description
    System.Boolean

    true if the TreeSet<T> object is a superset of other; otherwise, false.

    | Improve this Doc View Source

    ItemMultiplicities()

    Declaration
    public virtual ICollectionValue<KeyValuePair<T, int>> ItemMultiplicities()
    Returns
    Type Description
    ICollectionValue<KeyValuePair<T, System.Int32>>
    | Improve this Doc View Source

    LastIndexOf(T)

    Searches for an item in the tree going backwards from the end.

    Declaration
    public int LastIndexOf(T item)
    Parameters
    Type Name Description
    T item

    Item to search for.

    Returns
    Type Description
    System.Int32

    Index of last occurrence from the end of item if found, else the two-complement (always negative) of the index at which the item would be put if it was added.

    | Improve this Doc View Source

    Map<V>(Func<T, V>, System.Collections.Generic.IComparer<V>)

    Create a new indexed sorted collection consisting of the results of mapping all items of this list. if the map is not increasing over the items of this collection (with respect to the two given comparison relations).

    Declaration
    public IIndexedSorted<V> Map<V>(Func<T, V> mapper, System.Collections.Generic.IComparer<V> c)
    Parameters
    Type Name Description
    Func<T, V> mapper

    The delegate definging the map.

    System.Collections.Generic.IComparer<V> c

    The comparion relation to use for the result.

    Returns
    Type Description
    IIndexedSorted<V>

    The new sorted collection.

    Type Parameters
    Name Description
    V
    | Improve this Doc View Source

    Overlaps(System.Collections.Generic.IEnumerable<T>)

    Determines whether the current TreeSet<T> object and a specified collection share common elements.

    Declaration
    public virtual bool Overlaps(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current TreeSet<T> object.

    Returns
    Type Description
    System.Boolean

    true if the TreeSet<T> object and other share at least one common element; otherwise, false.

    | Improve this Doc View Source

    Predecessor(T)

    Find the strict predecessor in the sorted collection of a particular value, i.e. the largest item in the collection less than the supplied value.

    Declaration
    public T Predecessor(T item)
    Parameters
    Type Name Description
    T item

    The item to find the predecessor for.

    Returns
    Type Description
    T

    The predecessor.

    Exceptions
    Type Condition
    NoSuchItemException

    if no such element exists (the supplied value is less than or equal to the minimum of this collection.)

    | Improve this Doc View Source

    RangeAll()

    Create a directed collection with the same items as this collection.

    Declaration
    public IDirectedCollectionValue<T> RangeAll()
    Returns
    Type Description
    IDirectedCollectionValue<T>

    The result directed collection.

    | Improve this Doc View Source

    RangeFrom(T)

    Query this sorted collection for items greater than or equal to a supplied value.

    Declaration
    public IDirectedCollectionValue<T> RangeFrom(T bot)
    Parameters
    Type Name Description
    T bot

    The lower bound (inclusive).

    Returns
    Type Description
    IDirectedCollectionValue<T>

    The result directed collection.

    | Improve this Doc View Source

    RangeFromTo(T, T)

    Query this sorted collection for items between two supplied values.

    Declaration
    public IDirectedCollectionValue<T> RangeFromTo(T bot, T top)
    Parameters
    Type Name Description
    T bot

    The lower bound (inclusive).

    T top

    The upper bound (exclusive).

    Returns
    Type Description
    IDirectedCollectionValue<T>

    The result directed collection.

    | Improve this Doc View Source

    RangeTo(T)

    Query this sorted collection for items less than a supplied value.

    Declaration
    public IDirectedCollectionValue<T> RangeTo(T top)
    Parameters
    Type Name Description
    T top

    The upper bound (exclusive).

    Returns
    Type Description
    IDirectedCollectionValue<T>

    The result directed collection.

    | Improve this Doc View Source

    Remove(T)

    Remove a particular item from this collection. If the collection has bag semantics only one copy equivalent to the supplied item is removed.

    Declaration
    public bool Remove(T item)
    Parameters
    Type Name Description
    T item

    The value to remove.

    Returns
    Type Description
    System.Boolean

    True if the item was found (and removed).

    | Improve this Doc View Source

    Remove(T, out T)

    Remove a particular item from this collection if found. If the collection has bag semantics only one copy equivalent to the supplied item is removed, which one is implementation dependent. If an item was removed, report a binary copy of the actual item removed in the argument.

    Declaration
    public bool Remove(T item, out T removeditem)
    Parameters
    Type Name Description
    T item

    The value to remove.

    T removeditem

    The removed value.

    Returns
    Type Description
    System.Boolean

    True if the item was found (and removed).

    | Improve this Doc View Source

    RemoveAll(System.Collections.Generic.IEnumerable<T>)

    Remove all items in another collection from this one. If this collection has bag semantics, take multiplicities into account.

    Declaration
    public void RemoveAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to remove.

    | Improve this Doc View Source

    RemoveAllCopies(T)

    Remove all items equivalent to a given value.

    Declaration
    public void RemoveAllCopies(T item)
    Parameters
    Type Name Description
    T item

    The value to remove.

    | Improve this Doc View Source

    RemoveAt(Int32)

    Remove the item at a specific position of the list. if i is negative or

    = the size of the collection.

    Declaration
    public T RemoveAt(int i)
    Parameters
    Type Name Description
    System.Int32 i

    The index of the item to remove.

    Returns
    Type Description
    T

    The removed item.

    | Improve this Doc View Source

    RemoveInterval(Int32, Int32)

    Remove all items in an index interval. ???.

    Declaration
    public void RemoveInterval(int start, int count)
    Parameters
    Type Name Description
    System.Int32 start

    The index of the first item to remove.

    System.Int32 count

    The number of items to remove.

    | Improve this Doc View Source

    RemoveRangeFrom(T)

    Remove all items of this collection above or at a supplied threshold.

    Declaration
    public void RemoveRangeFrom(T low)
    Parameters
    Type Name Description
    T low

    The lower threshold (inclusive).

    | Improve this Doc View Source

    RemoveRangeFromTo(T, T)

    Remove all items of this collection between two supplied thresholds.

    Declaration
    public void RemoveRangeFromTo(T low, T hi)
    Parameters
    Type Name Description
    T low

    The lower threshold (inclusive).

    T hi

    The upper threshold (exclusive).

    | Improve this Doc View Source

    RemoveRangeTo(T)

    Remove all items of this collection below a supplied threshold.

    Declaration
    public void RemoveRangeTo(T hi)
    Parameters
    Type Name Description
    T hi

    The upper threshold (exclusive).

    | Improve this Doc View Source

    RetainAll(System.Collections.Generic.IEnumerable<T>)

    Remove all items not in some other collection from this one. If this collection has bag semantics, take multiplicities into account.

    Declaration
    public void RetainAll(System.Collections.Generic.IEnumerable<T> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to retain.

    | Improve this Doc View Source

    SetEquals(System.Collections.Generic.IEnumerable<T>)

    Determines whether the current TreeSet<T> and the specified collection contain the same elements.

    Declaration
    public virtual bool SetEquals(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current TreeSet<T>.

    Returns
    Type Description
    System.Boolean

    true if the current TreeSet<T> is equal to other; otherwise, false.

    | Improve this Doc View Source

    Snapshot()

    Make a (read-only) snapshot of this collection.

    Declaration
    public ISorted<T> Snapshot()
    Returns
    Type Description
    ISorted<T>

    The snapshot.

    | Improve this Doc View Source

    Successor(T)

    Find the strict successor in the sorted collection of a particular value, i.e. the least item in the collection greater than the supplied value.

    Declaration
    public T Successor(T item)
    Parameters
    Type Name Description
    T item

    The item to find the successor for.

    Returns
    Type Description
    T

    The successor.

    Exceptions
    Type Condition
    NoSuchItemException

    if no such element exists (the supplied value is greater than or equal to the maximum of this collection.)

    | Improve this Doc View Source

    SymmetricExceptWith(System.Collections.Generic.IEnumerable<T>)

    Modifies the current set so that it contains only elements that are present either in the current TreeSet<T> object or in the specified collection, but not both.

    Declaration
    public virtual void SymmetricExceptWith(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current TreeSet<T> object.

    | Improve this Doc View Source

    TryPredecessor(T, out T)

    Find the strict predecessor of item in the sorted collection, that is, the greatest item in the collection smaller than the item.

    Declaration
    public bool TryPredecessor(T item, out T res)
    Parameters
    Type Name Description
    T item

    The item to find the predecessor for.

    T res

    The predecessor, if any; otherwise the default value for T.

    Returns
    Type Description
    System.Boolean

    True if item has a predecessor; otherwise false.

    | Improve this Doc View Source

    TrySuccessor(T, out T)

    Find the strict successor of item in the sorted collection, that is, the least item in the collection greater than the supplied value.

    Declaration
    public bool TrySuccessor(T item, out T res)
    Parameters
    Type Name Description
    T item

    The item to find the successor for.

    T res

    The successor, if any; otherwise the default value for T.

    Returns
    Type Description
    System.Boolean

    True if item has a successor; otherwise false.

    | Improve this Doc View Source

    TryWeakPredecessor(T, out T)

    Find the weak predecessor of item in the sorted collection, that is, the greatest item in the collection smaller than or equal to the item.

    Declaration
    public bool TryWeakPredecessor(T item, out T res)
    Parameters
    Type Name Description
    T item

    The item to find the weak predecessor for.

    T res

    The weak predecessor, if any; otherwise the default value for T.

    Returns
    Type Description
    System.Boolean

    True if item has a weak predecessor; otherwise false.

    | Improve this Doc View Source

    TryWeakSuccessor(T, out T)

    Find the weak successor of item in the sorted collection, that is, the least item in the collection greater than or equal to the supplied value.

    Declaration
    public bool TryWeakSuccessor(T item, out T res)
    Parameters
    Type Name Description
    T item

    The item to find the weak successor for.

    T res

    The weak successor, if any; otherwise the default value for T.

    Returns
    Type Description
    System.Boolean

    True if item has a weak successor; otherwise false.

    | Improve this Doc View Source

    UnionWith(System.Collections.Generic.IEnumerable<T>)

    Modifies the current TreeSet<T> object to contain all elements that are present in itself, the specified collection, or both.

    Declaration
    public virtual void UnionWith(System.Collections.Generic.IEnumerable<T> other)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> other

    The collection to compare to the current set.

    | Improve this Doc View Source

    UniqueItems()

    Declaration
    public virtual ICollectionValue<T> UniqueItems()
    Returns
    Type Description
    ICollectionValue<T>
    | Improve this Doc View Source

    Update(T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value. If the collection has bag semantics, this updates all equivalent copies in the collection.

    Declaration
    public bool Update(T item)
    Parameters
    Type Name Description
    T item

    Value to update.

    Returns
    Type Description
    System.Boolean

    True if the item was found and hence updated.

    | Improve this Doc View Source

    Update(T, out T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection with a binary copy of the supplied value. If the collection has bag semantics, this updates all equivalent copies in the collection.

    Declaration
    public bool Update(T item, out T olditem)
    Parameters
    Type Name Description
    T item
    T olditem
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    UpdateOrAdd(T)

    Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection with a binary copy of the supplied value; else add the value to the collection.

    NOTE: the bag implementation is currently wrong! ?????

    Declaration
    public bool UpdateOrAdd(T item)
    Parameters
    Type Name Description
    T item

    Value to add or update.

    Returns
    Type Description
    System.Boolean

    True if the item was found and updated (hence not added).

    | Improve this Doc View Source

    UpdateOrAdd(T, out T)

    Declaration
    public bool UpdateOrAdd(T item, out T olditem)
    Parameters
    Type Name Description
    T item
    T olditem
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    WeakPredecessor(T)

    Find the weak predecessor in the sorted collection of a particular value, i.e. the largest item in the collection less than or equal to the supplied value.

    Declaration
    public T WeakPredecessor(T item)
    Parameters
    Type Name Description
    T item

    The item to find the weak predecessor for.

    Returns
    Type Description
    T

    The weak predecessor.

    Exceptions
    Type Condition
    NoSuchItemException

    if no such element exists (the supplied value is less than the minimum of this collection.)

    | Improve this Doc View Source

    WeakSuccessor(T)

    Find the weak successor in the sorted collection of a particular value, i.e. the least item in the collection greater than or equal to the supplied value. NoSuchItemException

    Declaration
    public T WeakSuccessor(T item)
    Parameters
    Type Name Description
    T item

    The item to find the weak successor for.

    Returns
    Type Description
    T

    The weak successor.

    Explicit Interface Implementations

    | Improve this Doc View Source

    IDirectedEnumerable<T>.Backwards()

    Declaration
    IDirectedEnumerable<T> IDirectedEnumerable<T>.Backwards()
    Returns
    Type Description
    IDirectedEnumerable<T>
    | Improve this Doc View Source

    ISorted<T>.RangeFrom(T)

    Declaration
    IDirectedEnumerable<T> ISorted<T>.RangeFrom(T bot)
    Parameters
    Type Name Description
    T bot
    Returns
    Type Description
    IDirectedEnumerable<T>
    | Improve this Doc View Source

    ISorted<T>.RangeFromTo(T, T)

    Declaration
    IDirectedEnumerable<T> ISorted<T>.RangeFromTo(T bot, T top)
    Parameters
    Type Name Description
    T bot
    T top
    Returns
    Type Description
    IDirectedEnumerable<T>
    | Improve this Doc View Source

    ISorted<T>.RangeTo(T)

    Declaration
    IDirectedEnumerable<T> ISorted<T>.RangeTo(T top)
    Parameters
    Type Name Description
    T top
    Returns
    Type Description
    IDirectedEnumerable<T>

    Implements

    IIndexedSorted<T>
    IIndexed<T>
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    System.Collections.IEnumerable
    IPersistentSorted<T>
    ISorted<T>
    ISequenced<T>
    ICollection<T>
    IExtensible<T>
    System.Collections.Generic.ICollection<>
    IDirectedCollectionValue<T>
    ICollectionValue<T>
    IShowable
    IFormattable
    IDirectedEnumerable<T>
    System.Collections.Generic.IEnumerable<>
    IDisposable
    System.Collections.Generic.ISet<>
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)