NetTopologySuite
|
ListBase is an abstract class that can be used as a base class for a read-write collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the following methods: Count, Clear, Insert, RemoveAt, and the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase. More...
Public Member Functions | |
abstract override void | Clear () |
This method must be overridden by the derived class to empty the list of all items. More... | |
abstract void | Insert (int index, T item) |
This method must be overridden by the derived class to insert a new item at the given index. More... | |
abstract void | RemoveAt (int index) |
This method must be overridden by the derived class to remove the item at the given index. More... | |
override IEnumerator< T > | GetEnumerator () |
Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. More... | |
override bool | Contains (T item) |
Determines if the list contains any item that compares equal to item . The implementation simply checks whether IndexOf(item) returns a non-negative value. More... | |
override void | Add (T item) |
Adds an item to the end of the list. This method is equivalent to calling: More... | |
override bool | Remove (T item) |
Searches the list for the first item that compares equal to item . If one is found, it is removed. Otherwise, the list is unchanged. More... | |
virtual void | CopyTo (T[] array) |
Copies all the items in the list, in order, to array , starting at index 0. More... | |
override void | CopyTo (T[] array, int arrayIndex) |
Copies all the items in the list, in order, to array , starting at arrayIndex . More... | |
virtual void | CopyTo (int index, T[] array, int arrayIndex, int count) |
Copies a range of elements from the list to array , starting at arrayIndex . More... | |
virtual new IList< T > | AsReadOnly () |
Provides a read-only view of this list. The returned IList<T> provides a view of the list that prevents modifications to the list. Use the method to provide access to the list without allowing changes. Since the returned object is just a view, changes to the list will be reflected in the view. More... | |
virtual T | Find (Predicate< T > predicate) |
Finds the first item in the list that satisfies the condition defined by predicate . If no item matches the condition, than the default value for T (null or all-zero) is returned. More... | |
virtual bool | TryFind (Predicate< T > predicate, out T foundItem) |
Finds the first item in the list that satisfies the condition defined by predicate . More... | |
virtual T | FindLast (Predicate< T > predicate) |
Finds the last item in the list that satisfies the condition defined by predicate . If no item matches the condition, than the default value for T (null or all-zero) is returned. More... | |
virtual bool | TryFindLast (Predicate< T > predicate, out T foundItem) |
Finds the last item in the list that satisfies the condition defined by predicate . More... | |
virtual int | FindIndex (Predicate< T > predicate) |
Finds the index of the first item in the list that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned. More... | |
virtual int | FindIndex (int index, Predicate< T > predicate) |
Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned. More... | |
virtual int | FindIndex (int index, int count, Predicate< T > predicate) |
Finds the index of the first item, in the range of count items starting from index , that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned. More... | |
virtual int | FindLastIndex (Predicate< T > predicate) |
Finds the index of the last item in the list that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned. More... | |
virtual int | FindLastIndex (int index, Predicate< T > predicate) |
Finds the index of the last item, in the range of items extending from the beginning of the list to index , that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned. More... | |
virtual int | FindLastIndex (int index, int count, Predicate< T > predicate) |
Finds the index of the last item, in the range of count items ending at index , that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned. More... | |
virtual int | IndexOf (T item) |
Finds the index of the first item in the list that is equal to item . More... | |
virtual int | IndexOf (T item, int index) |
Finds the index of the first item, in the range of items extending from index to the end, that is equal to item . More... | |
virtual int | IndexOf (T item, int index, int count) |
Finds the index of the first item, in the range of count items starting from index , that is equal to item . More... | |
virtual int | LastIndexOf (T item) |
Finds the index of the last item in the list that is equal to item . More... | |
virtual int | LastIndexOf (T item, int index) |
Finds the index of the last item, in the range of items extending from the beginning of the list to index , that is equal to item . More... | |
virtual int | LastIndexOf (T item, int index, int count) |
Finds the index of the last item, in the range of count items ending at index , that is equal to item . More... | |
virtual IList< T > | Range (int start, int count) |
Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not. 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... | |
Protected Member Functions | |
ListBase () | |
Creates a new ListBase. More... | |
![]() | |
CollectionBase () | |
Creates a new CollectionBase. More... | |
Properties | |
abstract override int | Count [get] |
The property must be overridden by the derived class to return the number of items in the list. More... | |
abstract T | this[int index] [get, set] |
The indexer must be overridden by the derived class to get and set values of the list at a particular index. More... | |
ListBase is an abstract class that can be used as a base class for a read-write collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the following methods: Count, Clear, Insert, RemoveAt, and the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase.
T |
|
protected |
Creates a new ListBase.
override void Wintellect.PowerCollections.ListBase< T >.Add | ( | T | item | ) |
Adds an item to the end of the list. This method is equivalent to calling:
Insert(Count, item)
item | The item to add to the list. |
|
virtual |
Provides a read-only view of this list. The returned IList<T> provides a view of the list that prevents modifications to the list. Use the method to provide access to the list without allowing changes. Since the returned object is just a view, changes to the list will be reflected in the view.
|
pure virtual |
This method must be overridden by the derived class to empty the list of all items.
Implemented in Wintellect.PowerCollections.BigList< T >, and Wintellect.PowerCollections.Deque< T >.
override bool Wintellect.PowerCollections.ListBase< T >.Contains | ( | T | item | ) |
Determines if the list contains any item that compares equal to item . The implementation simply checks whether IndexOf(item) returns a non-negative value.
Equality in the list is determined by the default sense of equality for T. If T implements IComparable<T>, the Equals method of that interface is used to determine equality. Otherwise, Object.Equals is used to determine equality.
item | The item to search for. |
|
virtual |
Copies all the items in the list, in order, to array , starting at index 0.
array | The array to copy to. This array must have a size that is greater than or equal to Count. |
override void Wintellect.PowerCollections.ListBase< T >.CopyTo | ( | T[] | array, |
int | arrayIndex | ||
) |
Copies all the items in the list, in order, to array , starting at arrayIndex .
array | The array to copy to. This array must have a size that is greater than or equal to Count + arrayIndex. |
arrayIndex | The starting index in array to copy to. |
|
virtual |
Copies a range of elements from the list to array , starting at arrayIndex .
index | The starting index in the source list of the range to copy. |
array | The array to copy to. This array must have a size that is greater than or equal to Count + arrayIndex. |
arrayIndex | The starting index in array to copy to. |
count | The number of items to copy. |
|
virtual |
Finds the first item in the list that satisfies the condition defined by predicate . If no item matches the condition, than the default value for T (null or all-zero) is returned.
If the default value for T (null or all-zero) matches the condition defined by predicate , and the list might contain the default value, then it is impossible to distinguish the different between finding the default value and not finding any item. To distinguish these cases, use TryFind.
predicate | A delegate that defined the condition to check for. |
|
virtual |
Finds the index of the first item in the list that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned.
predicate | A delegate that defined the condition to check for. |
|
virtual |
Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned.
predicate | A delegate that defined the condition to check for. |
index | The starting index of the range to check. |
|
virtual |
Finds the index of the first item, in the range of count items starting from index , that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned.
predicate | A delegate that defined the condition to check for. |
index | The starting index of the range to check. |
count | The number of items in range to check. |
|
virtual |
Finds the last item in the list that satisfies the condition defined by predicate . If no item matches the condition, than the default value for T (null or all-zero) is returned.
If the default value for T (null or all-zero) matches the condition defined by predicate , and the list might contain the default value, then it is impossible to distinguish the different between finding the default value and not finding any item. To distinguish these cases, use TryFindLast.
predicate | A delegate that defined the condition to check for. |
|
virtual |
Finds the index of the last item in the list that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned.
predicate | A delegate that defined the condition to check for. |
|
virtual |
Finds the index of the last item, in the range of items extending from the beginning of the list to index , that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned.
predicate | A delegate that defined the condition to check for. |
index | The ending index of the range to check. |
|
virtual |
Finds the index of the last item, in the range of count items ending at index , that satisfies the condition defined by predicate . If no item matches the condition, -1 is returned.
predicate | A delegate that defined the condition to check for. |
index | The ending index of the range to check. |
count | The number of items in range to check. |
override IEnumerator<T> Wintellect.PowerCollections.ListBase< T >.GetEnumerator | ( | ) |
Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on.
The enumerator does not check for changes made to the structure of the list. Thus, changes to the list during enumeration may cause incorrect enumeration or out of range exceptions. Consider overriding this method and adding checks for structural changes.
|
virtual |
Finds the index of the first item in the list that is equal to item .
The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.
item | The item to search fror. |
|
virtual |
Finds the index of the first item, in the range of items extending from index to the end, that is equal to item .
The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.
item | The item to search fror. |
index | The starting index of the range to check. |
|
virtual |
Finds the index of the first item, in the range of count items starting from index , that is equal to item .
The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.
item | The item to search fror. |
index | The starting index of the range to check. |
count | The number of items in range to check. |
|
pure virtual |
This method must be overridden by the derived class to insert a new item at the given index.
index | The index in the list to insert the item at. After the insertion, the inserted item is located at this index. The first item in the list has index 0. |
item | The item to insert at the given index. |
ArgumentOutOfRangeException | index is less than zero or greater than Count. |
Implemented in Wintellect.PowerCollections.Deque< T >, and Wintellect.PowerCollections.BigList< T >.
|
virtual |
Finds the index of the last item in the list that is equal to item .
The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.
item | The item to search fror. |
|
virtual |
Finds the index of the last item, in the range of items extending from the beginning of the list to index , that is equal to item .
The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.
item | The item to search fror. |
index | The ending index of the range to check. |
|
virtual |
Finds the index of the last item, in the range of count items ending at index , that is equal to item .
The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.
item | The item to search for. |
index | The ending index of the range to check. |
count | The number of items in range to check. |
|
virtual |
Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
This method can be used to apply an algorithm to a portion of a list. For example:
will reverse the 6 items beginning at index 3.
start | The starting index of the view. |
count | The number of items in the view. |
ArgumentOutOfRangeException | start or count is negative. |
ArgumentOutOfRangeException | start + count is greater than the size of the list. |
Reimplemented in Wintellect.PowerCollections.BigList< T >.
override bool Wintellect.PowerCollections.ListBase< T >.Remove | ( | T | item | ) |
Searches the list for the first item that compares equal to item . If one is found, it is removed. Otherwise, the list is unchanged.
Equality in the list is determined by the default sense of equality for T. If T implements IComparable<T>, the Equals method of that interface is used to determine equality. Otherwise, Object.Equals is used to determine equality.
item | The item to remove from the list. |
|
pure virtual |
This method must be overridden by the derived class to remove the item at the given index.
index | The index in the list to remove the item at. The first item in the list has index 0. |
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count. |
Implemented in Wintellect.PowerCollections.Deque< T >, and Wintellect.PowerCollections.BigList< T >.
|
virtual |
Finds the first item in the list that satisfies the condition defined by predicate .
predicate | A delegate that defines the condition to check for. |
foundItem | If true is returned, this parameter receives the first item in the list that satifies the condition defined by predicate . |
|
virtual |
Finds the last item in the list that satisfies the condition defined by predicate .
predicate | A delegate that defines the condition to check for. |
foundItem | If true is returned, this parameter receives the last item in the list that satifies the condition defined by predicate . |
|
get |
The property must be overridden by the derived class to return the number of items in the list.
The number of items in the list.
|
getset |
The indexer must be overridden by the derived class to get and set values of the list at a particular index.
index | The index in the list to get or set an item at. The first item in the list has index 0, and the last has index Count-1. |
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count. |