Enhanced C#
Language of your choice: library documentation
Public fields | Properties | Public Member Functions | List of all members
Loyc.Collections.NegListSlice< T > Struct Template Reference

Adapter: a random-access range for a slice of an INegListSource<T>. More...


Source file:
Inheritance diagram for Loyc.Collections.NegListSlice< T >:
Loyc.Collections.IRange< T > Loyc.Collections.IIsEmpty Loyc.Collections.INegListSource< T >

Remarks

Adapter: a random-access range for a slice of an INegListSource<T>.

Template Parameters
TItem type in the list

Although this slices a neg-list, the slice itself is an ordinary zero-indexed IListSource<T>. It implements INegListSource<T> for completeness, but its Min is 0.

Public fields

INegListSource< T > _list
 
int _start
 
int _count
 

Properties

int Count [get]
 
bool IsEmpty [get]
 
First [get]
 
Last [get]
 
this[int index] [get]
 
T? this[int index, T defaultValue] [get]
 
int INegListSource< T >. Min [get]
 
int INegListSource< T >. Max [get]
 
- Properties inherited from Loyc.Collections.IIsEmpty
bool IsEmpty [get]
 
- Properties inherited from Loyc.Collections.INegListSource< T >
int Min [get]
 Returns the minimum valid index in the collection. More...
 
int Max [get]
 Returns the maximum valid index in the collection. More...
 

Public Member Functions

 NegListSlice (INegListSource< T > list)
 
 NegListSlice (INegListSource< T > list, int start, int count=int.MaxValue)
 Initializes a slice. More...
 
PopFirst (out bool empty)
 
PopLast (out bool empty)
 
IFRange< T > ICloneable< IFRange< T > >. Clone ()
 
IBRange< T > ICloneable< IBRange< T > >. Clone ()
 
IRange< T > ICloneable< IRange< T > >. Clone ()
 
NegListSlice< T > Clone ()
 
IEnumerator< T > IEnumerable< T >. GetEnumerator ()
 
System.Collections.IEnumerator System.Collections.IEnumerable. GetEnumerator ()
 
RangeEnumerator< NegListSlice< T >, T > GetEnumerator ()
 
TryGet (int index, out bool fail)
 
IRange< T > IListSource< T >. Slice (int start, int count)
 
IRange< T > INegListSource< T >. Slice (int start, int count)
 
NegListSlice< T > Slice (int start, int count=int.MaxValue)
 
- Public Member Functions inherited from Loyc.Collections.INegListSource< T >
IRange< T > Slice (int start, int count=int.MaxValue)
 Returns a sub-range of this list. More...
 

Constructor & Destructor Documentation

◆ NegListSlice()

Loyc.Collections.NegListSlice< T >.NegListSlice ( INegListSource< T >  list,
int  start,
int  count = int.MaxValue 
)
inline

Initializes a slice.

Exceptions
ArgumentExceptionThe start index was below zero.

The (start, count) range is allowed to be invalid, as long as 'start' is Min or above and 'count' is zero or above.

  • If 'start' is above the original Count, the Count of the new slice is set to zero.
  • if (start + count) is above the original Count, the Count of the new slice is reduced to list.Count - start.

References Loyc.Collections.INegListSource< out out T >.Min.