NetTopologySuite
|
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 | |
sealed override IEnumerator< T > | GetEnumerator () |
Enumerate all the items in this view. More... | |
sealed override void | Clear () |
Removes all the items within this view from the underlying set. More... | |
new bool | Add (T item) |
Adds a new item to the set underlying this View. If the set already contains an item equal to item , that item is replaces with item . If item is outside the range of this view, an InvalidOperationException is thrown. More... | |
sealed override bool | Remove (T item) |
Searches the underlying set for an item equal to item , and if found, removes it from the set. If not found, the set is unchanged. If the item is outside the range of this view, the set is unchanged. More... | |
sealed override bool | Contains (T item) |
Determines if this view of the set contains an item equal to item . The set is not changed. If More... | |
int | IndexOf (T item) |
Get the index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1. More... | |
IList< T > | AsList () |
Get a read-only list view of the items in this view. 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 () |
Creates a new View that has the same items as this view, in the reversed order. More... | |
T | GetFirst () |
Returns the first item in this view: the item that would appear first if the view was enumerated. More... | |
T | GetLast () |
Returns the last item in the view: the item that would appear last if the view was enumerated. More... | |
![]() | |
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 | |
sealed override int | Count [get] |
Number of items in this view. More... | |
T | this[int index] [get] |
Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1. More... | |
![]() | |
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... | |
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.
remarks>
Views are dynamic. If the underlying set changes, the view changes in sync. If a change is made to the view, the underlying set changes accordingly.
p>Typically, this class is used in conjunction with a foreach statement to enumerate the items in a subset of the OrderedSet. For example:
code> foreach(T item in set.Range(from, to)) { // process item } /code> /remarks>
new bool Wintellect.PowerCollections.OrderedSet< T >.View.Add | ( | T | item | ) |
Adds a new item to the set underlying this View. If the set already contains an item equal to item , that item is replaces with item . If item is outside the range of this view, an InvalidOperationException is thrown.
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. |
IList<T> Wintellect.PowerCollections.OrderedSet< T >.View.AsList | ( | ) |
Get a read-only list view of the items in this view. 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 >.View.Clear | ( | ) |
Removes all the items within this view from the underlying set.
The following removes all the items that start with "A" from an OrderedSet. set.Range("A", "B").Clear();
sealed override bool Wintellect.PowerCollections.OrderedSet< T >.View.Contains | ( | T | item | ) |
Determines if this view of the set contains an item equal to item . The set is not changed. If
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. |
sealed override IEnumerator<T> Wintellect.PowerCollections.OrderedSet< T >.View.GetEnumerator | ( | ) |
Enumerate all the items in this view.
T Wintellect.PowerCollections.OrderedSet< T >.View.GetFirst | ( | ) |
Returns the first item in this view: the item that would appear first if the view was enumerated.
GetFirst() takes time O(log N), where N is the number of items in the set.
InvalidOperationException | The view has no items in it. |
T Wintellect.PowerCollections.OrderedSet< T >.View.GetLast | ( | ) |
Returns the last item in the view: the item that would appear last if the view was enumerated.
GetLast() takes time O(log N), where N is the number of items in the set.
InvalidOperationException | The view has no items in it. |
int Wintellect.PowerCollections.OrderedSet< T >.View.IndexOf | ( | T | item | ) |
Get the index of the given item in the view. The smallest item in the view 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. |
sealed override bool Wintellect.PowerCollections.OrderedSet< T >.View.Remove | ( | T | item | ) |
Searches the underlying set for an item equal to item , and if found, removes it from the set. If not found, the set is unchanged. If the item is outside the range of this view, 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. |
View Wintellect.PowerCollections.OrderedSet< T >.View.Reversed | ( | ) |
|
get |
Number of items in this view.
Number of items that lie within the bounds the view.
|
get |
Get the item by its index in the sorted order. The smallest item in the view 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. |