C5  2.4
The C5 Generic Collection Library for C# and CLI is a comprehensive collection library supporting lists, sets, bags, dictionaries, priority queues, (FIFO) queues, and (LIFO) stacks. C5 runs on .NET 3.5+, Silverlight 5, Windows Phone 8, Xamarin.iOS, Xamarin.Android, and Mono.
C5.IIndexed< T > Interface Template Reference

A sequenced collection, where indices of items in the order are maintained More...

Inheritance diagram for C5.IIndexed< T >:
C5.ISequenced< T > C5.ICollection< T > C5.IDirectedCollectionValue< T > C5.IExtensible< T > C5.ICollectionValue< T > C5.IDirectedEnumerable< T > C5.ICollectionValue< T > C5.IShowable C5.IShowable C5.IIndexedSorted< T > C5.IList< T > C5.GuardedIndexedSorted< T > C5.SortedArray< T > C5.TreeBag< T > C5.TreeSet< T > C5.ArrayList< T > C5.GuardedList< T > C5.HashedArrayList< T > C5.HashedLinkedList< T > C5.LinkedList< T > C5.WrappedArray< T >

Public Member Functions

int IndexOf (T item)
 Searches for an item in the list going forwards from the start. More...
 
int LastIndexOf (T item)
 Searches for an item in the list going backwards from the end. More...
 
int FindIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the first one. More...
 
int FindLastIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the last one. More...
 
RemoveAt (int index)
 Remove the item at a specific position of the list. More...
 
void RemoveInterval (int start, int count)
 Remove all items in an index interval. More...
 
- Public Member Functions inherited from C5.ISequenced< T >
int GetSequencedHashCode ()
 The hashcode is defined as More...
 
bool SequencedEquals (ISequenced< T > otherCollection)
 Compare this sequenced collection to another one in sequence order. More...
 
- Public Member Functions inherited from C5.ICollection< T >
new bool Add (T item)
 Add an item to this collection if possible. If this collection has set semantics, the item will be added if not already in the collection. If bag semantics, the item will always be added. More...
 
new void CopyTo (T[] array, int index)
 Copy the items of this collection to a contiguous part of an array. More...
 
int GetUnsequencedHashCode ()
 The unordered collection hashcode is defined as the sum of More...
 
bool UnsequencedEquals (ICollection< T > otherCollection)
 Compare the contents of this collection to another one without regards to the sequence order. The comparison will use this collection's itemequalityComparer to compare individual items. More...
 
new bool Contains (T item)
 Check if this collection contains (an item equivalent to according to the itemequalityComparer) a particular value. More...
 
int ContainsCount (T item)
 Count the number of items of the collection equal to a particular value. Returns 0 if and only if the value is not in the collection. More...
 
ICollectionValue< T > UniqueItems ()
 
ICollectionValue< KeyValuePair< T, int > > ItemMultiplicities ()
 
bool ContainsAll (SCG.IEnumerable< T > items)
 Check whether this collection contains all the values in another collection. If this collection has bag semantics ( More...
 
bool Find (ref T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found. More...
 
bool FindOrAdd (ref T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, return in the ref argument (a binary copy of) the actual value found. Else, add the item to the collection. More...
 
bool Update (T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection with a (binary copy of) the supplied value. If the collection has bag semantics, it depends on the value of DuplicatesByCounting if this updates all equivalent copies in the collection or just one. More...
 
bool Update (T item, out T olditem)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection with a (binary copy of) the supplied value. If the collection has bag semantics, it depends on the value of DuplicatesByCounting if this updates all equivalent copies in the collection or just one. More...
 
bool UpdateOrAdd (T item)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value; else add the value to the collection. More...
 
bool UpdateOrAdd (T item, out T olditem)
 Check if this collection contains an item equivalent according to the itemequalityComparer to a particular value. If so, update the item in the collection to with a binary copy of the supplied value; else add the value to the collection. More...
 
new bool Remove (T item)
 Remove a particular item from this collection. If the collection has bag semantics only one copy equivalent to the supplied item is removed. More...
 
bool Remove (T item, out T removeditem)
 Remove a particular item from this collection if found. If the collection has bag semantics only one copy equivalent to the supplied item is removed, which one is implementation dependent. If an item was removed, report a binary copy of the actual item removed in the argument. More...
 
void RemoveAllCopies (T item)
 Remove all items equivalent to a given value. More...
 
void RemoveAll (SCG.IEnumerable< T > items)
 Remove all items in another collection from this one. If this collection has bag semantics, take multiplicities into account. More...
 
new void Clear ()
 Remove all items from this collection. More...
 
void RetainAll (SCG.IEnumerable< T > items)
 Remove all items not in some other collection from this one. If this collection has bag semantics, take multiplicities into account. More...
 
- Public Member Functions inherited from C5.IExtensible< T >
void AddAll (SCG.IEnumerable< T > items)
 Add the elements from another collection with a more specialized item type to this collection. If this collection has set semantics, only items not already in the collection will be added. More...
 
bool Check ()
 Check the integrity of the internal data structures of this collection. This is only relevant for developers of the library More...
 
- Public Member Functions inherited from C5.ICollectionValue< T >
T[] ToArray ()
 Create an array with the items of this collection (in the same order as an enumerator would output them). More...
 
void Apply (Action< T > action)
 Apply a delegate to all items of this collection. More...
 
bool Exists (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection. More...
 
bool Find (Func< T, bool > predicate, out T item)
 Check if there exists an item that satisfies a specific predicate in this collection and return the first one in enumeration order. More...
 
bool All (Func< T, bool > predicate)
 Check if all items in this collection satisfies a specific predicate. More...
 
Choose ()
 Choose some item of this collection. More...
 
SCG.IEnumerable< T > Filter (Func< T, bool > filter)
 Create an enumerable, enumerating the items of this collection that satisfies a certain condition. More...
 
- Public Member Functions inherited from C5.IShowable
bool Show (StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 Format More...
 
- Public Member Functions inherited from C5.IDirectedCollectionValue< T >
new IDirectedCollectionValue< T > Backwards ()
 Create a collection containing the same items as this collection, but whose enumerator will enumerate the items backwards. The new collection will become invalid if the original is modified. Method typically used as in More...
 
bool FindLast (Func< T, bool > predicate, out T item)
 Check if there exists an item that satisfies a specific predicate in this collection and return the first one in enumeration order. More...
 

Properties

Speed IndexingSpeed [get]
 
IDirectedCollectionValue< T > this[int start, int count] [get]
 
- Properties inherited from C5.ICollection< T >
Speed ContainsSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
new int Count [get]
 
new bool IsReadOnly [get]
 If true any call of an updating operation will throw an More...
 
- Properties inherited from C5.IExtensible< T >
bool IsReadOnly [get]
 If true any call of an updating operation will throw an More...
 
bool AllowsDuplicates [get]
 
SCG.IEqualityComparer< T > EqualityComparer [get]
 (Here should be a discussion of the role of equalityComparers. Any ). More...
 
bool DuplicatesByCounting [get]
 By convention this is true for any collection with set semantics. More...
 
- Properties inherited from C5.ICollectionValue< T >
EventTypeEnum ListenableEvents [get]
 A flag bitmap of the events subscribable to by this collection. More...
 
EventTypeEnum ActiveEvents [get]
 A flag bitmap of the events currently subscribed to by this collection. More...
 
bool IsEmpty [get]
 
int Count [get]
 
Speed CountSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
- Properties inherited from C5.IDirectedEnumerable< T >
EnumerationDirection Direction [get]
 

Additional Inherited Members

- Events inherited from C5.ICollectionValue< T >
CollectionChangedHandler< T > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
CollectionClearedHandler< T > CollectionCleared
 The change event. Will be raised for every clear operation on the collection. More...
 
ItemsAddedHandler< T > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
ItemInsertedHandler< T > ItemInserted
 The item inserted event. Will be raised for every individual insertion to the collection. More...
 
ItemsRemovedHandler< T > ItemsRemoved
 The item removed event. Will be raised for every individual removal from the collection. More...
 
ItemRemovedAtHandler< T > ItemRemovedAt
 The item removed at event. Will be raised for every individual removal at from the collection. More...
 

Detailed Description

A sequenced collection, where indices of items in the order are maintained

Member Function Documentation

int C5.IIndexed< T >.FindIndex ( Func< T, bool >  predicate)

Check if there exists an item that satisfies a specific predicate in this collection and return the index of the first one.

Parameters
predicateA delegate (T:Func`2 with
R == bool
) defining the predicate
Returns
the index, if found, a negative value else

Implemented in C5.WrappedArray< T >.

int C5.IIndexed< T >.FindLastIndex ( Func< T, bool >  predicate)

Check if there exists an item that satisfies a specific predicate in this collection and return the index of the last one.

Parameters
predicateA delegate (T:Func`2 with
R == bool
) defining the predicate
Returns
the index, if found, a negative value else

Implemented in C5.WrappedArray< T >.

int C5.IIndexed< T >.IndexOf ( item)

Searches for an item in the list going forwards from the start.

Parameters
itemItem to search for.
Returns
Index of item from start. A negative number if item not found, namely the one's complement of the index at which the Add operation would put the item.

Implemented in C5.TreeBag< T >, C5.TreeSet< T >, C5.HashedLinkedList< T >, C5.GuardedList< T >, C5.LinkedList< T >, C5.SortedArray< T >, C5.HashedArrayList< T >, C5.ArrayList< T >, C5.GuardedIndexedSorted< T >, C5.IList< T >, and C5.WrappedArray< T >.

int C5.IIndexed< T >.LastIndexOf ( item)

Searches for an item in the list going backwards from the end.

Parameters
itemItem to search for.
Returns
Index of of item from the end. A negative number if item not found, namely the two-complement of the index at which the Add operation would put the item.

Implemented in C5.TreeBag< T >, C5.TreeSet< T >, C5.HashedLinkedList< T >, C5.GuardedList< T >, C5.LinkedList< T >, C5.SortedArray< T >, C5.HashedArrayList< T >, C5.ArrayList< T >, C5.GuardedIndexedSorted< T >, and C5.WrappedArray< T >.

T C5.IIndexed< T >.RemoveAt ( int  index)

Remove the item at a specific position of the list.

Exceptions
IndexOutOfRangeExceptionif
index
is negative or >= the size of the collection.
Parameters
indexThe index of the item to remove.
Returns
The removed item.

Implemented in C5.TreeBag< T >, C5.TreeSet< T >, C5.HashedLinkedList< T >, C5.GuardedList< T >, C5.LinkedList< T >, C5.SortedArray< T >, C5.HashedArrayList< T >, C5.ArrayList< T >, C5.GuardedIndexedSorted< T >, C5.IList< T >, and C5.WrappedArray< T >.

void C5.IIndexed< T >.RemoveInterval ( int  start,
int  count 
)

Remove all items in an index interval.

Exceptions
ArgumentOutOfRangeExceptionif start or count is negative or start+count > the size of the collection.
Parameters
startThe index of the first item to remove.
countThe number of items to remove.

Implemented in C5.TreeBag< T >, C5.TreeSet< T >, C5.HashedLinkedList< T >, C5.GuardedList< T >, C5.LinkedList< T >, C5.SortedArray< T >, C5.HashedArrayList< T >, C5.ArrayList< T >, C5.GuardedIndexedSorted< T >, and C5.WrappedArray< T >.

Property Documentation

Speed C5.IIndexed< T >.IndexingSpeed
get

IDirectedCollectionValue<T> C5.IIndexed< T >.this[int start, int count]
get

Exceptions
ArgumentOutOfRangeException

The directed collection of items in a specific index interval.

Parameters
startThe low index of the interval (inclusive).
countThe size of the range.

The documentation for this interface was generated from the following file: