NetTopologySuite
|
OrderedSet<T> is a collection that contains items of type T. The item are maintained in a sorted order, and duplicate items are not allowed. Each item has an index in the set: the smallest item has index 0, the next smallest item has index 1, and so forth. More...
Classes | |
class | View |
The OrderedSet<T>.View class is used to look at a subset of the Items inside an ordered set. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods. More... | |
Public Member Functions | |
OrderedSet () | |
Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set. More... | |
OrderedSet (Comparison< T > comparison) | |
Creates a new OrderedSet. The passed delegate will be used to compare items in this set. More... | |
OrderedSet (IComparer< T > comparer) | |
Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set. More... | |
OrderedSet (IEnumerable< T > collection) | |
Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set. The set is initialized with all the items in the given collection. More... | |
OrderedSet (IEnumerable< T > collection, Comparison< T > comparison) | |
Creates a new OrderedSet. The passed delegate will be used to compare items in this set. The set is initialized with all the items in the given collection. More... | |
OrderedSet (IEnumerable< T > collection, IComparer< T > comparer) | |
Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set. The set is initialized with all the items in the given collection. More... | |
OrderedSet< T > | Clone () |
Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment. More... | |
OrderedSet< T > | CloneContents () |
Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment. More... | |
sealed override IEnumerator< T > | GetEnumerator () |
Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order. More... | |
sealed override bool | Contains (T item) |
Determines if this set contains an item equal to item . The set is not changed. More... | |
bool | TryGetItem (T item, out T foundItem) |
int | IndexOf (T item) |
Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. More... | |
new bool | Add (T item) |
Adds a new item to the set. If the set already contains an item equal to item , that item is replaced with item . More... | |
void | AddMany (IEnumerable< T > collection) |
Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection , that item will be replaced. More... | |
sealed override bool | Remove (T item) |
Searches the set for an item equal to item , and if found, removes it from the set. If not found, the set is unchanged. More... | |
int | RemoveMany (IEnumerable< T > collection) |
Removes all the items in collection from the set. Items not present in the set are ignored. More... | |
sealed override void | Clear () |
Removes all items from the set. More... | |
T | GetFirst () |
Returns the first item in the set: the item that would appear first if the set was enumerated. This is also the smallest item in the set. More... | |
T | GetLast () |
Returns the lastl item in the set: the item that would appear last if the set was enumerated. This is also the largest item in the set. More... | |
T | RemoveFirst () |
Removes the first item in the set. This is also the smallest item in the set. More... | |
T | RemoveLast () |
Removes the last item in the set. This is also the largest item in the set. More... | |
bool | IsSupersetOf (OrderedSet< T > otherSet) |
Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set. More... | |
bool | IsProperSupersetOf (OrderedSet< T > otherSet) |
Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet . More... | |
bool | IsSubsetOf (OrderedSet< T > otherSet) |
Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet . More... | |
bool | IsProperSubsetOf (OrderedSet< T > otherSet) |
Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet . Additionally, this set must have strictly fewer items than otherSet . More... | |
bool | IsEqualTo (OrderedSet< T > otherSet) |
Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items. More... | |
void | UnionWith (OrderedSet< T > otherSet) |
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged. More... | |
bool | IsDisjointFrom (OrderedSet< T > otherSet) |
Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set. More... | |
OrderedSet< T > | Union (OrderedSet< T > otherSet) |
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged. More... | |
void | IntersectionWith (OrderedSet< T > otherSet) |
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged. More... | |
OrderedSet< T > | Intersection (OrderedSet< T > otherSet) |
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged. More... | |
void | DifferenceWith (OrderedSet< T > otherSet) |
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet . This set receives the difference of the two sets; the other set is unchanged. More... | |
OrderedSet< T > | Difference (OrderedSet< T > otherSet) |
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet . A new set is created with the difference of the sets and is returned. This set and the other set are unchanged. More... | |
void | SymmetricDifferenceWith (OrderedSet< T > otherSet) |
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged. More... | |
OrderedSet< T > | SymmetricDifference (OrderedSet< T > otherSet) |
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged. More... | |
IList< T > | AsList () |
Get a read-only list view of the items in this ordered set. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet. More... | |
View | Reversed () |
Returns a View collection that can be used for enumerating the items in the set in reversed order. More... | |
View | Range (T from, bool fromInclusive, T to, bool toInclusive) |
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters. More... | |
View | RangeFrom (T from, bool fromInclusive) |
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter. More... | |
View | RangeTo (T to, bool toInclusive) |
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter. More... | |
![]() | |
override string | ToString () |
Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively. More... | |
Properties | |
IComparer< T > | Comparer [get] |
Returns the IComparer<T> used to compare items in this set. More... | |
sealed override int | Count [get] |
Returns the number of items in the set. More... | |
T | this[int index] [get] |
Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. More... | |
Additional Inherited Members | |
![]() | |
CollectionBase () | |
Creates a new CollectionBase. More... | |
OrderedSet<T> is a collection that contains items of type T. The item are maintained in a sorted order, and duplicate items are not allowed. Each item has an index in the set: the smallest item has index 0, the next smallest item has index 1, and so forth.
The items are compared in one of three ways. If T implements IComparable<TKey> or IComparable, then the CompareTo method of that interface will be used to compare items. Alternatively, a comparison function can be passed in either as a delegate, or as an instance of IComparer<TKey>.
OrderedSet is implemented as a balanced binary tree. Inserting, deleting, and looking up an an element all are done in log(N) type, where N is the number of keys in the tree.
Set<T> is similar, but uses hashing instead of comparison, and does not maintain the items in sorted order.
/remarks> seealso cref="Set<T>"/>
Wintellect.PowerCollections.OrderedSet< T >.OrderedSet | ( | ) |
Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set.
remarks> Items that are null are permitted, and will be sorted before all other items. /remarks>
InvalidOperationException | T does not implement IComparable<TKey>. |
Wintellect.PowerCollections.OrderedSet< T >.OrderedSet | ( | Comparison< T > | comparison | ) |
Creates a new OrderedSet. The passed delegate will be used to compare items in this set.
comparison | A delegate to a method that will be used to compare items. |
Wintellect.PowerCollections.OrderedSet< T >.OrderedSet | ( | IComparer< T > | comparer | ) |
Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set.
The GetHashCode and Equals methods of the provided IComparer<T> will never be called, and need not be implemented.
comparer | An instance of IComparer<T> that will be used to compare items. |
Wintellect.PowerCollections.OrderedSet< T >.OrderedSet | ( | IEnumerable< T > | collection | ) |
Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set. The set is initialized with all the items in the given collection.
remarks> Items that are null are permitted, and will be sorted before all other items. /remarks>
collection | A collection with items to be placed into the OrderedSet. |
InvalidOperationException | T does not implement IComparable<TKey>. |
Wintellect.PowerCollections.OrderedSet< T >.OrderedSet | ( | IEnumerable< T > | collection, |
Comparison< T > | comparison | ||
) |
Creates a new OrderedSet. The passed delegate will be used to compare items in this set. The set is initialized with all the items in the given collection.
collection | A collection with items to be placed into the OrderedSet. |
comparison | A delegate to a method that will be used to compare items. |
Wintellect.PowerCollections.OrderedSet< T >.OrderedSet | ( | IEnumerable< T > | collection, |
IComparer< T > | comparer | ||
) |
Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set. The set is initialized with all the items in the given collection.
The GetHashCode and Equals methods of the provided IComparer<T> will never be called, and need not be implemented.
collection | A collection with items to be placed into the OrderedSet. |
comparer | An instance of IComparer<T> that will be used to compare items. |
new bool Wintellect.PowerCollections.OrderedSet< T >.Add | ( | T | item | ) |
Adds a new item to the set. If the set already contains an item equal to item , that item is replaced with item .
Equality between items is determined by the comparison instance or delegate used to create the set.
Adding an item takes time O(log N), where N is the number of items in the set.
item | The item to add to the set. |
void Wintellect.PowerCollections.OrderedSet< T >.AddMany | ( | IEnumerable< T > | collection | ) |
Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection , that item will be replaced.
Equality between items is determined by the comparison instance or delegate used to create the set.
Adding the collection takes time O(M log N), where N is the number of items in the set, and M is the number of items in collection .
collection | A collection of items to add to the set. |
IList<T> Wintellect.PowerCollections.OrderedSet< T >.AsList | ( | ) |
Get a read-only list view of the items in this ordered set. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
sealed override void Wintellect.PowerCollections.OrderedSet< T >.Clear | ( | ) |
Removes all items from the set.
Clearing the sets takes a constant amount of time, regardless of the number of items in it.
OrderedSet<T> Wintellect.PowerCollections.OrderedSet< T >.Clone | ( | ) |
Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Cloning the set takes time O(N), where N is the number of items in the set.
OrderedSet<T> Wintellect.PowerCollections.OrderedSet< T >.CloneContents | ( | ) |
Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
If T is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.
Cloning the set takes time O(N log N), where N is the number of items in the set.
InvalidOperationException | T is a reference type that does not implement ICloneable. |
sealed override bool Wintellect.PowerCollections.OrderedSet< T >.Contains | ( | T | item | ) |
Determines if this set contains an item equal to item . The set is not changed.
Searching the set for an item takes time O(log N), where N is the number of items in the set.
item | The item to search for. |
OrderedSet<T> Wintellect.PowerCollections.OrderedSet< T >.Difference | ( | OrderedSet< T > | otherSet | ) |
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet . A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.
The difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to difference with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
void Wintellect.PowerCollections.OrderedSet< T >.DifferenceWith | ( | OrderedSet< T > | otherSet | ) |
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet . This set receives the difference of the two sets; the other set is unchanged.
The difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to difference with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
sealed override IEnumerator<T> Wintellect.PowerCollections.OrderedSet< T >.GetEnumerator | ( | ) |
Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.
Typically, this method is not called directly. Instead the "foreach" statement is used to enumerate the items, which uses this method implicitly.
If an item is added to or deleted from the set while it is being enumerated, then the enumeration will end with an InvalidOperationException.
Enumeration all the items in the set takes time O(N log N), where N is the number of items in the set.
T Wintellect.PowerCollections.OrderedSet< T >.GetFirst | ( | ) |
Returns the first item in the set: the item that would appear first if the set was enumerated. This is also the smallest item in the set.
GetFirst() takes time O(log N), where N is the number of items in the set.
InvalidOperationException | The set is empty. |
T Wintellect.PowerCollections.OrderedSet< T >.GetLast | ( | ) |
Returns the lastl item in the set: the item that would appear last if the set was enumerated. This is also the largest item in the set.
GetLast() takes time O(log N), where N is the number of items in the set.
InvalidOperationException | The set is empty. |
int Wintellect.PowerCollections.OrderedSet< T >.IndexOf | ( | T | item | ) |
Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Finding the index takes time O(log N), which N is the number of items in the set.
item | The item to get the index of. |
OrderedSet<T> Wintellect.PowerCollections.OrderedSet< T >.Intersection | ( | OrderedSet< T > | otherSet | ) |
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.
When equal items appear in both sets, the intersection will include an arbitrary choice of one of the two equal items.
The intersection of two sets is computed in time O(N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to intersection with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
void Wintellect.PowerCollections.OrderedSet< T >.IntersectionWith | ( | OrderedSet< T > | otherSet | ) |
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.
When equal items appear in both sets, the intersection will include an arbitrary choice of one of the two equal items.
The intersection of two sets is computed in time O(N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to intersection with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
bool Wintellect.PowerCollections.OrderedSet< T >.IsDisjointFrom | ( | OrderedSet< T > | otherSet | ) |
Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.
The answer is computed in time O(N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to check disjointness with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
bool Wintellect.PowerCollections.OrderedSet< T >.IsEqualTo | ( | OrderedSet< T > | otherSet | ) |
Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.
IsEqualTo is computed in time O(N), where N is the number of items in this set.
otherSet | Set to compare to |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
bool Wintellect.PowerCollections.OrderedSet< T >.IsProperSubsetOf | ( | OrderedSet< T > | otherSet | ) |
Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet . Additionally, this set must have strictly fewer items than otherSet .
IsSubsetOf is computed in time O(N log M), where M is the size of the otherSet , and N is the size of the this set.
otherSet | Set to compare to. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
bool Wintellect.PowerCollections.OrderedSet< T >.IsProperSupersetOf | ( | OrderedSet< T > | otherSet | ) |
Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet .
IsProperSupersetOf is computed in time O(M log N), where M is the number of unique items in otherSet .
otherSet | OrderedSet to compare to. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
bool Wintellect.PowerCollections.OrderedSet< T >.IsSubsetOf | ( | OrderedSet< T > | otherSet | ) |
Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet .
IsSubsetOf is computed in time O(N log M), where M is the size of the otherSet , and N is the size of the this set.
otherSet | Set to compare to. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
bool Wintellect.PowerCollections.OrderedSet< T >.IsSupersetOf | ( | OrderedSet< T > | otherSet | ) |
Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.
IsSupersetOf is computed in time O(M log N), where M is the size of the otherSet , and N is the size of the this set.
otherSet | OrderedSet to compare to. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
View Wintellect.PowerCollections.OrderedSet< T >.Range | ( | T | from, |
bool | fromInclusive, | ||
T | to, | ||
bool | toInclusive | ||
) |
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
remarks> p>If from is greater than to , the returned collection is empty.
p>Typically, this method is used in conjunction with a foreach statement. For example: code> foreach(T item in set.Range(from, true, to, false)) { // process item } /code>
If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.
p>Calling Range does not copy the data in the tree, and the operation takes constant time.
/remarks>
from | The lower bound of the range. |
fromInclusive | If true, the lower bound is inclusive–items equal to the lower bound will be included in the range. If false, the lower bound is exclusive–items equal to the lower bound will not be included in the range. |
to | The upper bound of the range. |
toInclusive | If true, the upper bound is inclusive–items equal to the upper bound will be included in the range. If false, the upper bound is exclusive–items equal to the upper bound will not be included in the range. |
View Wintellect.PowerCollections.OrderedSet< T >.RangeFrom | ( | T | from, |
bool | fromInclusive | ||
) |
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.
remarks> p>Typically, this method is used in conjunction with a foreach statement. For example: code> foreach(T item in set.RangeFrom(from, true)) { // process item } /code>
If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.
p>Calling RangeFrom does not copy the data in the tree, and the operation takes constant time.
/remarks>
from | The lower bound of the range. |
fromInclusive | If true, the lower bound is inclusive–items equal to the lower bound will be included in the range. If false, the lower bound is exclusive–items equal to the lower bound will not be included in the range. |
View Wintellect.PowerCollections.OrderedSet< T >.RangeTo | ( | T | to, |
bool | toInclusive | ||
) |
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
remarks> p>Typically, this method is used in conjunction with a foreach statement. For example: code> foreach(T item in set.RangeTo(to, false)) { // process item } /code>
If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.
p>Calling RangeTo does not copy the data in the tree, and the operation takes constant time.
/remarks>
to | The upper bound of the range. |
toInclusive | If true, the upper bound is inclusive–items equal to the upper bound will be included in the range. If false, the upper bound is exclusive–items equal to the upper bound will not be included in the range. |
sealed override bool Wintellect.PowerCollections.OrderedSet< T >.Remove | ( | T | item | ) |
Searches the set for an item equal to item , and if found, removes it from the set. If not found, the set is unchanged.
Equality between items is determined by the comparison instance or delegate used to create the set.
Removing an item from the set takes time O(log N), where N is the number of items in the set.
item | The item to remove. |
T Wintellect.PowerCollections.OrderedSet< T >.RemoveFirst | ( | ) |
Removes the first item in the set. This is also the smallest item in the set.
RemoveFirst() takes time O(log N), where N is the number of items in the set.
InvalidOperationException | The set is empty. |
T Wintellect.PowerCollections.OrderedSet< T >.RemoveLast | ( | ) |
Removes the last item in the set. This is also the largest item in the set.
RemoveLast() takes time O(log N), where N is the number of items in the set.
InvalidOperationException | The set is empty. |
int Wintellect.PowerCollections.OrderedSet< T >.RemoveMany | ( | IEnumerable< T > | collection | ) |
Removes all the items in collection from the set. Items not present in the set are ignored.
Equality between items is determined by the comparison instance or delegate used to create the set.
Removing the collection takes time O(M log N), where N is the number of items in the set, and M is the number of items in collection .
collection | A collection of items to remove from the set. |
ArgumentNullException | collection is null. |
View Wintellect.PowerCollections.OrderedSet< T >.Reversed | ( | ) |
Returns a View collection that can be used for enumerating the items in the set in reversed order.
remarks> p>Typically, this method is used in conjunction with a foreach statement. For example: code> foreach(T item in set.Reversed()) { // process item } /code>
If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.
p>Calling Reverse does not copy the data in the tree, and the operation takes constant time.
/remarks>
OrderedSet<T> Wintellect.PowerCollections.OrderedSet< T >.SymmetricDifference | ( | OrderedSet< T > | otherSet | ) |
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.
The symmetric difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to symmetric difference with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
void Wintellect.PowerCollections.OrderedSet< T >.SymmetricDifferenceWith | ( | OrderedSet< T > | otherSet | ) |
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.
The symmetric difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to symmetric difference with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
bool Wintellect.PowerCollections.OrderedSet< T >.TryGetItem | ( | T | item, |
out T | foundItem | ||
) |
Determines if this set contains an item equal to item , according to the comparison mechanism that was used when the set was created. The set is not changed.
If the set does contain an item equal to item , then the item from the set is returned.
Searching the set for an item takes time O(log N), where N is the number of items in the set.
In the following example, the set contains strings which are compared in a case-insensitive manner.
item | The item to search for. |
foundItem | Returns the item from the set that was equal to item . |
OrderedSet<T> Wintellect.PowerCollections.OrderedSet< T >.Union | ( | OrderedSet< T > | otherSet | ) |
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.
If equal items appear in both sets, the union will include an arbitrary choice of one of the two equal items.
The union of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to union with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
void Wintellect.PowerCollections.OrderedSet< T >.UnionWith | ( | OrderedSet< T > | otherSet | ) |
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.
If equal items appear in both sets, the union will include an arbitrary choice of one of the two equal items.
The union of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.
otherSet | Set to union with. |
InvalidOperationException | This set and otherSet don't use the same method for comparing items. |
|
get |
Returns the IComparer<T> used to compare items in this set.
If the set was created using a comparer, that comparer is returned. If the set was created using a comparison delegate, then a comparer equivalent to that delegate is returned. Otherwise the default comparer for T (Comparer<T>.Default) is returned.
|
get |
Returns the number of items in the set.
The size of the set is returned in constant time.
The number of items in the set.
|
get |
Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.
The indexer takes time O(log N), which N is the number of items in the set.
index | The index to get the item by. |
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count. |