|
Enhanced C#
Loyc library documentation
|
Public fields | |
| TList | _list |
| int | _start |
| int | _count |
| int | Count => _count |
| bool | IsEmpty => _count == 0 |
| T | First => this[0] |
Properties | |
| T | this[int index] [get] |
| T | this[int index, T defaultValue] [get] |
Properties inherited from Loyc.Collections.ISource< out T > | |
| new int | Count [get] |
| Gets the number of items in the collection. More... | |
Properties inherited from Loyc.Collections.ICount | |
| int | Count [get] |
| Gets the number of items in the collection. More... | |
Properties inherited from Loyc.Collections.IIsEmpty | |
| bool | IsEmpty [get] |
Properties inherited from Loyc.Collections.IIndexed< in K, out V > | |
| V | this[K key] [get] |
| Gets the value associated with the specified key. More... | |
Properties inherited from Loyc.Collections.IHasFirst< out T > | |
| T | First [get] |
| Gets the first item in the deque. More... | |
Public Member Functions | |||||||
| SparseListSourceSlice (TList list, int start, int count=int.MaxValue) | |||||||
| Initializes a slice. More... | |||||||
| T | PopFirst (out bool empty) | ||||||
| Removes the first item from the range and returns it. More... | |||||||
|
SparseListSourceSlice< T, TList > ICloneable < SparseListSourceSlice< T, TList > >. | Clone () | ||||||
|
IFRange< T > ICloneable < IFRange< T > >. | Clone () | ||||||
| IEnumerator< T > IEnumerable< T >. | GetEnumerator () | ||||||
|
System.Collections.IEnumerator System.Collections.IEnumerable. | GetEnumerator () | ||||||
|
RangeEnumerator < SparseListSourceSlice< T, TList >, T > | GetEnumerator () | ||||||
| T | TryGet (int index, out bool fail) | ||||||
| IListSource< T > IListSource< T >. | Slice (int start, int count) | ||||||
Returns a sub-range of this list.
Most collections should use the following implementation: IListSource<T> IListSource<T>.Slice(int start, int count) { return Slice(start, count); } public Slice_<T> Slice(int start, int count) { return new Slice_<T>(this, start, count); } | |||||||
|
ISparseListSource< T > ISparseListSource< T >. | Slice (int start, int count) | ||||||
Returns a sub-range of this list.
Most collections should use the following implementation: IListSource<T> IListSource<T>.Slice(int start, int count) { return Slice(start, count); } public Slice_<T> Slice(int start, int count) { return new Slice_<T>(this, start, count); } | |||||||
| SparseListSourceSlice< T, TList > | Slice (int start, int count=int.MaxValue) | ||||||
Returns a sub-range of this list.
Most collections should use the following implementation: IListSource<T> IListSource<T>.Slice(int start, int count) { return Slice(start, count); } public Slice_<T> Slice(int start, int count) { return new Slice_<T>(this, start, count); } | |||||||
| T | NextHigherItem (ref int?index) | ||||||
Increases index by at least one to reach the next index that is not classified as empty space, and returns the item at that index. More... | |||||||
| T | NextLowerItem (ref int?index) | ||||||
Decreases index by at least one to reach the next index that is not classified as empty space, and returns the item at that index. More... | |||||||
| bool | IsSet (int index) | ||||||
| Determines whether a value exists at the specified index. More... | |||||||
|
IEnumerator< KeyValuePair< int, T > > | GetItemEnumerator () | ||||||
Public Member Functions inherited from Loyc.Collections.ITryGet< in K, out V > | |||||||
| V | TryGet (K key, out bool fail) | ||||||
| Gets the item for the specified key or index, and does not throw an exception on failure. More... | |||||||
|
inline |
Initializes a slice.
| ArgumentException | The start index was below zero. |
The (start, count) range is allowed to be invalid, as long as 'start' and 'count' are zero or above.
list.Count - start. | bool Loyc.Collections.SparseListSourceSlice< T, TList >.IsSet | ( | int | index | ) |
Determines whether a value exists at the specified index.
| index |
Implements Loyc.Collections.ISparseListSource< T >.
|
inline |
Increases index by at least one to reach the next index that is not classified as empty space, and returns the item at that index.
| index | This parameter is increased by at least one, and perhaps more than one so that it refers to an index where there is a value. If index is null upon entering this method, the first non-empty space in the list is found. If there are no values at higher indexes, if the list is empty or if index + 1 >= Count, index is null when the method returns. |
This method must skip over all indexes i for which IsSet(i) returns false, and return the next index for which IsSet(i) returns true. This method must accept any integer as input, including invalid indexes.
Implements Loyc.Collections.ISparseListSource< T >.
|
inline |
Decreases index by at least one to reach the next index that is not classified as empty space, and returns the item at that index.
| index | This parameter is increased by at least one, and perhaps more than one so that it refers to an index where there is a value. If index is null upon entering this method, the last non-empty space in the list is found. If there are no values at lower indexes, if the list is empty or if index is 0 or less, index is null when the method returns. |
This method must skip over all indexes i for which IsSet(i) returns false, and return the next index for which IsSet(i) returns true. This method must accept any integer as input, including invalid indexes.
Implements Loyc.Collections.ISparseListSource< T >.
|
inline |
Removes the first item from the range and returns it.
| fail | Receives the current value of IIsEmpty.IsEmpty. |
This method is a little unweildy in plain C#, but in EC# it will be a bit more convenient to use via extension methods like T PopFirst(ref this Range range, T defaultValue) and T? PopFirst(ref this Range range), which are illegal in plain C#.
I wanted to give this method the signature "bool PopFirst(out T first)" but the generic parameter "T" is covariant, i.e. it is marked "out T" which, ironically, is not compatible with "out T" parameters, only with return values.
Implements Loyc.Collections.IFRange< out T >.
1.8.7