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.HashedArrayList< T > Class Template Reference

A list collection based on a plain dynamic array data structure. Expansion of the internal array is performed by doubling on demand. The internal array is only shrinked by the Clear method. More...

Inheritance diagram for C5.HashedArrayList< T >:
C5.ArrayBase< T > C5.IList< T > C5.SequencedBase< T > C5.IIndexed< T > C5.DirectedCollectionBase< T > C5.IDirectedCollectionValue< T > C5.ISequenced< T > C5.CollectionBase< T > C5.IDirectedCollectionValue< T > C5.ICollectionValue< T > C5.IDirectedEnumerable< T > C5.ICollection< T > C5.IDirectedCollectionValue< T > C5.IDirectedEnumerable< T > C5.ICollectionValue< T > C5.IExtensible< T > C5.IShowable C5.IDirectedEnumerable< T > C5.ICollectionValue< T > C5.CollectionValueBase< T >

Public Member Functions

 HashedArrayList ()
 Create an array list with default item equalityComparer and initial capacity 8 items. More...
 
 HashedArrayList (SCG.IEqualityComparer< T > itemequalityComparer)
 Create an array list with external item equalityComparer and initial capacity 8 items. More...
 
 HashedArrayList (int capacity)
 Create an array list with default item equalityComparer and prescribed initial capacity. More...
 
 HashedArrayList (int capacity, SCG.IEqualityComparer< T > itemequalityComparer)
 Create an array list with external item equalityComparer and prescribed initial capacity. More...
 
virtual void Insert (int index, T item)
 Insert an item at a specific index location in this list. /summary>

Exceptions
IndexOutOfRangeExceptionif index is negative or > the size of the collection.
DuplicateNotAllowedExceptionIf the item is already present in the list.
Parameters
indexThe index at which to insert.
itemThe item to insert.
More...
 
void Insert (IList< T > pointer, T item)
 Insert an item at the end of a compatible view, used as a pointer. More...
 
virtual void InsertAll (int index, SCG.IEnumerable< T > items)
 Insert into this list all items from an enumerable collection starting at a particular index. More...
 
virtual void InsertFirst (T item)
 Insert an item at the front of this list; More...
 
virtual void InsertLast (T item)
 Insert an item at the back of this list. More...
 
virtual IList< T > FindAll (Func< T, bool > filter)
 Create a new list consisting of the items of this list satisfying a certain predicate. More...
 
virtual IList< V > Map< V > (Func< T, V > mapper)
 Create a new list consisting of the results of mapping all items of this list. The new list will use the default item equalityComparer for the item type V. More...
 
virtual IList< V > Map< V > (Func< T, V > mapper, SCG.IEqualityComparer< V > itemequalityComparer)
 Create a new list consisting of the results of mapping all items of this list. The new list will use a specified item equalityComparer for the item type. More...
 
virtual T Remove ()
 Remove one item from the list: from the front if More...
 
virtual T RemoveFirst ()
 Remove one item from the front of the list. More...
 
virtual T RemoveLast ()
 Remove one item from the back of the list. More...
 
virtual IList< T > View (int start, int count)
 Create a list view on this list. More...
 
virtual IList< T > ViewOf (T item)
 Create a list view on this list containing the (first) occurrence of a particular item. More...
 
virtual IList< T > LastViewOf (T item)
 Create a list view on this list containing the last occurrence of a particular item. More...
 
virtual IList< T > Slide (int offset)
 Slide this list view along the underlying list. More...
 
virtual IList< T > Slide (int offset, int size)
 Slide this list view along the underlying list, changing its size. More...
 
virtual bool TrySlide (int offset)
 
virtual bool TrySlide (int offset, int size)
 
virtual IList< T > Span (IList< T > otherView)
 
virtual void Reverse ()
 Reverse the list so the items are in the opposite sequence order. More...
 
bool IsSorted ()
 Check if this list is sorted according to the default sorting order for the item type T, as defined by the T:C5.Comparer`1 class More...
 
virtual bool IsSorted (SCG.IComparer< T > c)
 Check if this list is sorted according to a specific sorting order. More...
 
virtual void Sort ()
 Sort the items of the list according to the default sorting order for the item type T, as defined by the Comparer[T] class (T:C5.Comparer`1). More...
 
virtual void Sort (SCG.IComparer< T > comparer)
 Sort the items of the list according to a specific sorting order. More...
 
virtual void Shuffle ()
 Randomly shuffle the items of this list. More...
 
virtual void Shuffle (Random rnd)
 Shuffle the items of this list according to a specific random source. More...
 
virtual int IndexOf (T item)
 Search for an item in the list going forwards from the start. More...
 
virtual int LastIndexOf (T item)
 Search for an item in the list going backwards from the end. More...
 
virtual T RemoveAt (int index)
 Remove the item at a specific position of the list. More...
 
virtual void RemoveInterval (int start, int count)
 Remove all items in an index interval. More...
 
override int GetUnsequencedHashCode ()
 
override bool UnsequencedEquals (ICollection< T > that)
 
virtual bool Contains (T item)
 Check if this collection contains (an item equivalent to according to the itemequalityComparer) a particular value. More...
 
virtual 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...
 
virtual 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 to with a binary copy of the supplied value. This will only update the first mathching item. More...
 
virtual bool Update (T item, out T olditem)
 
virtual 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...
 
virtual 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. This will only update the first matching item. More...
 
virtual bool UpdateOrAdd (T item, out T olditem)
 
virtual bool Remove (T item)
 Remove a particular item from this list. The item will be searched for from the end of the list if More...
 
virtual bool Remove (T item, out T removeditem)
 Remove the first copy of a particular item from this collection if found. If an item was removed, report a binary copy of the actual item removed in the argument. The item will be searched for from the end of the list if More...
 
virtual void RemoveAll (SCG.IEnumerable< T > items)
 Remove all items in another collection from this one, taking multiplicities into account. Matching items will be removed from the front. Current implementation is not optimal. More...
 
override void Clear ()
 Remove all items from this collection, resetting internal array size. More...
 
virtual void RetainAll (SCG.IEnumerable< T > items)
 Remove all items not in some other collection from this one, taking multiplicities into account. Items are retained front first. More...
 
virtual bool ContainsAll (SCG.IEnumerable< T > items)
 Check if this collection contains all the values in another collection, taking multiplicities into account. Current implementation is not optimal. More...
 
virtual 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...
 
virtual ICollectionValue< T > UniqueItems ()
 
virtual ICollectionValue< KeyValuePair< T, int > > ItemMultiplicities ()
 
virtual void RemoveAllCopies (T item)
 Remove all items equal to a given one. More...
 
override bool Check ()
 Check the integrity of the internal data structures of this array list. More...
 
virtual bool Add (T item)
 Add an item to end of this list. More...
 
virtual void AddAll (SCG.IEnumerable< T > items)
 Add the elements from another collection to this collection. More...
 
override SCG.IEnumerator< T > GetEnumerator ()
 Create an enumerator for the collection More...
 
virtual void Dispose ()
 Invalidate this list. If a view, just invalidate the view. If not a view, invalidate the list and all views on it. More...
 
- Public Member Functions inherited from C5.ArrayBase< T >
override T[] ToArray ()
 Create an array containing (copies) of the items of this collection in enumeration order. More...
 
override IDirectedCollectionValue< T > Backwards ()
 Create a directed collection with the same contents as this one, but opposite enumeration sequence. More...
 
override T Choose ()
 Choose some item of this collection. The result is the last item in the internal array, making it efficient to remove. More...
 
override SCG.IEnumerator< T > GetEnumerator ()
 Create an enumerator for this array based collection. More...
 
- Public Member Functions inherited from C5.SequencedBase< T >
virtual int GetSequencedHashCode ()
 Get the sequenced collection hash code of this collection: from the cached value if present and up to date, else (re)compute. More...
 
virtual bool SequencedEquals (ISequenced< T > otherCollection)
 Check if the contents of that is equal to the contents of this in the sequenced sense. Using the item equalityComparer of this collection. 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...
 
- Public Member Functions inherited from C5.DirectedCollectionBase< T >
virtual 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...
 
- Public Member Functions inherited from C5.CollectionValueBase< T >
virtual void CopyTo (T[] array, int index)
 Copy the items of this collection to part of an array. More...
 
virtual void Apply (Action< T > action)
 Apply an single argument action, T:Action`1 to this enumerable More...
 
virtual bool Exists (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection. More...
 
virtual 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...
 
virtual bool All (Func< T, bool > predicate)
 Check if all items in this collection satisfies a specific predicate. More...
 
virtual SCG.IEnumerable< T > Filter (Func< T, bool > predicate)
 Create an enumerable, enumerating the items of this collection that satisfies a certain condition. More...
 
virtual bool Show (System.Text.StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 
virtual string ToString (string format, IFormatProvider formatProvider)
 
override string ToString ()
 
- Public Member Functions inherited from C5.IShowable
bool Show (StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 Format More...
 
- Public Member Functions inherited from C5.IList< T >
new void CopyTo (T[] array, int index)
 
- Public Member Functions inherited from C5.IIndexed< T >
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...
 
- 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...
 

Protected Member Functions

override void expand ()
 Double the size of the internal array. More...
 
override void expand (int newcapacity, int newsize)
 Expand the internal array, resetting the index of the first unused element. More...
 
override void updatecheck ()
 Check if it is valid to perform updates and increment stamp if so. More...
 
override void modifycheck (int stamp)
 Check that the list has not been updated since a particular time. More...
 
override void InsertProtected (int i, T item)
 Internal version of Insert with no modification checks. More...
 
- Protected Member Functions inherited from C5.ArrayBase< T >
 ArrayBase (int capacity, SCG.IEqualityComparer< T > itemequalityComparer)
 Create an empty ArrayBase object. More...
 
- Protected Member Functions inherited from C5.SequencedBase< T >
 SequencedBase (SCG.IEqualityComparer< T > itemequalityComparer)
 
- Protected Member Functions inherited from C5.DirectedCollectionBase< T >
 DirectedCollectionBase (SCG.IEqualityComparer< T > itemequalityComparer)
 
- Protected Member Functions inherited from C5.CollectionBase< T >
 CollectionBase (SCG.IEqualityComparer< T > itemequalityComparer)
 
void checkRange (int start, int count)
 Utility method for range checking. More...
 
- Protected Member Functions inherited from C5.CollectionValueBase< T >
virtual void raiseCollectionChanged ()
 Fire the CollectionChanged event More...
 
virtual void raiseCollectionCleared (bool full, int count)
 Fire the CollectionCleared event More...
 
virtual void raiseCollectionCleared (bool full, int count, int?offset)
 Fire the CollectionCleared event More...
 
virtual void raiseItemsAdded (T item, int count)
 Fire the ItemsAdded event More...
 
virtual void raiseItemsRemoved (T item, int count)
 Fire the ItemsRemoved event More...
 
virtual void raiseItemInserted (T item, int index)
 Fire the ItemInserted event More...
 
virtual void raiseItemRemovedAt (T item, int index)
 Fire the ItemRemovedAt event More...
 
virtual void raiseForSetThis (int index, T value, T item)
 
virtual void raiseForInsert (int i, T item)
 
void raiseForRemove (T item)
 
void raiseForRemove (T item, int count)
 
void raiseForRemoveAt (int index, T item)
 
virtual void raiseForUpdate (T newitem, T olditem)
 
virtual void raiseForUpdate (T newitem, T olditem, int count)
 
virtual void raiseForAdd (T item)
 
virtual void raiseForRemoveAll (ICollectionValue< T > wasRemoved)
 

Properties

override EventTypeEnum ListenableEvents [get]
 
virtual T First [get]
 
virtual T Last [get]
 
virtual bool FIFO [get, set]
 Since More...
 
virtual bool IsFixedSize [get]
 
virtual T this[int index] [get, set]
 On this list, this indexer is read/write. More...
 
virtual Speed IndexingSpeed [get]
 
virtual IList< T > Underlying [get]
 Null if this list is not a view. More...
 
virtual int Offset [get]
 
virtual bool IsValid [get]
 
virtual 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...
 
virtual bool AllowsDuplicates [get]
 
virtual bool DuplicatesByCounting [get]
 By convention this is true for any collection with set semantics. More...
 
override int Count [get]
 
- Properties inherited from C5.ArrayBase< T >
virtual IDirectedCollectionValue< T > this[int start, int count] [get]
 
- Properties inherited from C5.SequencedBase< T >
override EnumerationDirection Direction [get]
 
- Properties inherited from C5.DirectedCollectionBase< T >
virtual EnumerationDirection Direction [get]
 
- Properties inherited from C5.CollectionBase< T >
virtual bool IsReadOnly [get]
 
override int Count [get]
 
override 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...
 
virtual SCG.IEqualityComparer< T > EqualityComparer [get]
 
override bool IsEmpty [get]
 
- Properties inherited from C5.CollectionValueBase< T >
virtual EventTypeEnum ListenableEvents [get]
 
virtual EventTypeEnum ActiveEvents [get]
 A flag bitmap of the events currently subscribed to by this collection. More...
 
virtual CollectionChangedHandler< T > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
virtual CollectionClearedHandler< T > CollectionCleared
 The clear event. Will be raised for every Clear operation on the collection. More...
 
virtual ItemsAddedHandler< T > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
virtual ItemsRemovedHandler< T > ItemsRemoved
 The item removed event. Will be raised for every individual removal from the collection. More...
 
virtual ItemInsertedHandler< T > ItemInserted
 The item added event. Will be raised for every individual addition to the collection. More...
 
virtual ItemRemovedAtHandler< T > ItemRemovedAt
 The item removed event. Will be raised for every individual removal from the collection. More...
 
abstract bool IsEmpty [get]
 Check if collection is empty. More...
 
abstract int Count [get]
 The number of items in this collection. More...
 
abstract 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.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]
 
- Properties inherited from C5.IList< T >
First [get]
 
Last [get]
 
bool FIFO [get, set]
 Since More...
 
bool IsFixedSize [get]
 
new T this[int index] [get, set]
 On this list, this indexer is read/write. More...
 
new int Count [get]
 
new bool IsReadOnly [get]
 
IList< T > Underlying [get]
 Null if this list is not a view. More...
 
int Offset [get]
 
bool IsValid [get]
 
- Properties inherited from C5.IIndexed< T >
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from C5.SequencedBase< T >
static int ComputeHashCode (ISequenced< T > items, SCG.IEqualityComparer< T > itemequalityComparer)
 Compute the unsequenced hash code of a collection More...
 
static bool StaticEquals (ISequenced< T > collection1, ISequenced< T > collection2, SCG.IEqualityComparer< T > itemequalityComparer)
 Examine if tit and tat are equal as sequenced collections using the specified item equalityComparer (assumed compatible with the two collections). More...
 
- Static Public Member Functions inherited from C5.CollectionBase< T >
static int ComputeHashCode (ICollectionValue< T > items, SCG.IEqualityComparer< T > itemequalityComparer)
 Compute the unsequenced hash code of a collection More...
 
static bool StaticEquals (ICollection< T > collection1, ICollection< T > collection2, SCG.IEqualityComparer< T > itemequalityComparer)
 Examine if collection1 and collection2 are equal as unsequenced collections using the specified item equalityComparer (assumed compatible with the two collections). More...
 
- Static Protected Member Functions inherited from C5.EnumerableBase< T >
static int countItems (SCG.IEnumerable< T > items)
 Count the number of items in an enumerable by enumeration More...
 
- Protected Attributes inherited from C5.ArrayBase< T >
T[] array
 The actual internal array container. Will be extended on demand. More...
 
int offsetField
 The offset into the internal array container of the first item. The offset is 0 for a base dynamic array and may be positive for an updatable view into a base dynamic array. More...
 
- Protected Attributes inherited from C5.CollectionBase< T >
bool isReadOnlyBase = false
 The underlying field of the ReadOnly property More...
 
int stamp
 The current stamp value More...
 
int size
 The number of items in the collection More...
 
readonly SCG.IEqualityComparer< T > itemequalityComparer
 The item equalityComparer of the collection More...
 
- 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 list collection based on a plain dynamic array data structure. Expansion of the internal array is performed by doubling on demand. The internal array is only shrinked by the Clear method.

When the FIFO property is set to false this class works fine as a stack of T. When the FIFO property is set to true the class will function as a (FIFO) queue but very inefficiently, use a LinkedList (T:C5.LinkedList`1) instead.

Constructor & Destructor Documentation

Create an array list with default item equalityComparer and initial capacity 8 items.

C5.HashedArrayList< T >.HashedArrayList ( SCG.IEqualityComparer< T >  itemequalityComparer)

Create an array list with external item equalityComparer and initial capacity 8 items.

Parameters
itemequalityComparerThe external item equalitySCG.Comparer
C5.HashedArrayList< T >.HashedArrayList ( int  capacity)

Create an array list with default item equalityComparer and prescribed initial capacity.

Parameters
capacityThe prescribed capacity
C5.HashedArrayList< T >.HashedArrayList ( int  capacity,
SCG.IEqualityComparer< T >  itemequalityComparer 
)

Create an array list with external item equalityComparer and prescribed initial capacity.

Parameters
capacityThe prescribed capacity
itemequalityComparerThe external item equalitySCG.Comparer

Member Function Documentation

virtual bool C5.HashedArrayList< T >.Add ( item)
virtual

Add an item to end of this list.

Parameters
itemThe item to add.
Returns
True

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.AddAll ( SCG.IEnumerable< T >  items)
virtual

Add the elements from another collection to this collection.

Parameters
items

Implements C5.IExtensible< T >.

override bool C5.HashedArrayList< T >.Check ( )
virtual

Check the integrity of the internal data structures of this array list.

Returns
True if check does not fail.

Reimplemented from C5.ArrayBase< T >.

override void C5.HashedArrayList< T >.Clear ( )
virtual

Remove all items from this collection, resetting internal array size.

Reimplemented from C5.ArrayBase< T >.

virtual bool C5.HashedArrayList< T >.Contains ( item)
virtual

Check if this collection contains (an item equivalent to according to the itemequalityComparer) a particular value.

Parameters
itemThe value to check for.
Returns
True if the items is in this collection.

Implements C5.IList< T >.

virtual bool C5.HashedArrayList< T >.ContainsAll ( SCG.IEnumerable< T >  items)
virtual

Check if this collection contains all the values in another collection, taking multiplicities into account. Current implementation is not optimal.

Parameters
itemsThe
Returns
True if all values in
items
is in this collection.

Implements C5.ICollection< T >.

virtual int C5.HashedArrayList< T >.ContainsCount ( item)
virtual

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.

Parameters
itemThe value to count.
Returns
The number of copies found.

Implements C5.ICollection< T >.

virtual void C5.HashedArrayList< T >.Dispose ( )
virtual

Invalidate this list. If a view, just invalidate the view. If not a view, invalidate the list and all views on it.

override void C5.HashedArrayList< T >.expand ( )
protectedvirtual

Double the size of the internal array.

Reimplemented from C5.ArrayBase< T >.

override void C5.HashedArrayList< T >.expand ( int  newcapacity,
int  newsize 
)
protectedvirtual

Expand the internal array, resetting the index of the first unused element.

Parameters
newcapacityThe new capacity (will be rounded upwards to a power of 2).
newsizeThe new count of

Reimplemented from C5.ArrayBase< T >.

virtual bool C5.HashedArrayList< T >.Find ( ref T  item)
virtual

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.

Parameters
itemThe value to look for.
Returns
True if the items is in this collection.

Implements C5.ICollection< T >.

virtual IList<T> C5.HashedArrayList< T >.FindAll ( Func< T, bool >  filter)
virtual

Create a new list consisting of the items of this list satisfying a certain predicate.

The new list will be of type HashedArrayList

Parameters
filterThe filter delegate defining the predicate.
Returns
The new list.

Implements C5.IList< T >.

virtual bool C5.HashedArrayList< T >.FindOrAdd ( ref T  item)
virtual

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.

Parameters
itemThe value to look for.
Returns
True if the item was found (hence not added).

Implements C5.ICollection< T >.

override SCG.IEnumerator<T> C5.HashedArrayList< T >.GetEnumerator ( )
virtual

Create an enumerator for the collection

Returns
The enumerator

Implements C5.SequencedBase< T >.

override int C5.HashedArrayList< T >.GetUnsequencedHashCode ( )
virtual

Returns

Reimplemented from C5.CollectionBase< T >.

virtual int C5.HashedArrayList< T >.IndexOf ( item)
virtual

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

Parameters
itemItem to search for.
Returns
Index of item from start.

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.Insert ( int  index,
item 
)
virtual

Insert an item at a specific index location in this list. /summary>

Exceptions
IndexOutOfRangeExceptionif index is negative or > the size of the collection.
DuplicateNotAllowedExceptionIf the item is already present in the list.
Parameters
indexThe index at which to insert.
itemThe item to insert.

void C5.HashedArrayList< T >.Insert ( IList< T >  pointer,
item 
)

Insert an item at the end of a compatible view, used as a pointer.

The pointer must be a view on the same list as this and the endpoint of pointer must be a valid insertion point of this

Exceptions
IncompatibleViewExceptionIf
pointer
is not a view on or the same list as
this
IndexOutOfRangeException?????? if the endpoint of
pointer
is not inside
this
DuplicateNotAllowedExceptionif the list has and the item is already in the list.
Parameters
pointer
item

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.InsertAll ( int  index,
SCG.IEnumerable< T >  items 
)
virtual

Insert into this list all items from an enumerable collection starting at a particular index.

Exceptions
IndexOutOfRangeExceptionif index is negative or > the size of the collection.
DuplicateNotAllowedExceptionIf
items
contains duplicates or some item already present in the list.
Parameters
indexIndex to start inserting at
itemsItems to insert

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.InsertFirst ( item)
virtual

Insert an item at the front of this list;

Exceptions
DuplicateNotAllowedExceptionIf the item is already in the list
Parameters
itemThe item to insert.

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.InsertLast ( item)
virtual

Insert an item at the back of this list.

Exceptions
DuplicateNotAllowedExceptionIf the item is already in the list
Parameters
itemThe item to insert.

Implements C5.IList< T >.

override void C5.HashedArrayList< T >.InsertProtected ( int  i,
item 
)
protectedvirtual

Internal version of Insert with no modification checks.

Exceptions
DuplicateNotAllowedExceptionif item already in list.
Parameters
iIndex to insert at
itemItem to insert

Reimplemented from C5.ArrayBase< T >.

bool C5.HashedArrayList< T >.IsSorted ( )

Check if this list is sorted according to the default sorting order for the item type T, as defined by the T:C5.Comparer`1 class

Exceptions
NotComparableExceptionif T is not comparable
Returns
True if the list is sorted, else false.

Implements C5.IList< T >.

virtual bool C5.HashedArrayList< T >.IsSorted ( SCG.IComparer< T >  c)
virtual

Check if this list is sorted according to a specific sorting order.

Parameters
cThe comparer defining the sorting order.
Returns
True if the list is sorted, else false.

Implements C5.IList< T >.

virtual ICollectionValue<KeyValuePair<T, int> > C5.HashedArrayList< T >.ItemMultiplicities ( )
virtual

Returns

Implements C5.ICollection< T >.

virtual int C5.HashedArrayList< T >.LastIndexOf ( item)
virtual

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

Parameters
itemItem to search for.
Returns
Index of item from the end.

Implements C5.IIndexed< T >.

virtual IList<T> C5.HashedArrayList< T >.LastViewOf ( item)
virtual

Create a list view on this list containing the last occurrence of a particular item.

Returns null if the item is not in this list.

Parameters
itemThe item to find.
Returns
The new list view.

Implements C5.IList< T >.

virtual IList<V> C5.HashedArrayList< T >.Map< V > ( Func< T, V >  mapper)
virtual

Create a new list consisting of the results of mapping all items of this list. The new list will use the default item equalityComparer for the item type V.

The new list will be of type HashedArrayList

Exceptions
DuplicateNotAllowedExceptionIf
mapper
creates duplicates
Template Parameters
VThe type of items of the new list
Parameters
mapperThe delegate defining the map.
Returns
The new list.

Implements C5.IList< T >.

virtual IList<V> C5.HashedArrayList< T >.Map< V > ( Func< T, V >  mapper,
SCG.IEqualityComparer< V >  itemequalityComparer 
)
virtual

Create a new list consisting of the results of mapping all items of this list. The new list will use a specified item equalityComparer for the item type.

The new list will be of type HashedArrayList

Exceptions
DuplicateNotAllowedExceptionIf
mapper
creates duplicates
Template Parameters
VThe type of items of the new list
Parameters
mapperThe delegate defining the map.
itemequalityComparerThe item equalityComparer to use for the new list
Returns
The new list.

Implements C5.IList< T >.

override void C5.HashedArrayList< T >.modifycheck ( int  stamp)
protectedvirtual

Check that the list has not been updated since a particular time.

To be used by enumerators and range

Exceptions
ViewDisposedExceptionIf check fails by this list being a disposed view.
CollectionModifiedExceptionIf the list has been updated since that time..
Parameters
stampThe stamp indicating the time.

Reimplemented from C5.CollectionBase< T >.

virtual T C5.HashedArrayList< T >.Remove ( )
virtual

Remove one item from the list: from the front if

FIFO is true, else from the back.

Exceptions
NoSuchItemExceptionif this list is empty.
Returns
The removed item.

Implements C5.IList< T >.

virtual bool C5.HashedArrayList< T >.Remove ( item)
virtual

Remove a particular item from this list. The item will be searched for from the end of the list if

FIFO == false (the default), else from the start.

Parameters
itemThe value to remove.
Returns
True if the item was found (and removed).

Implements C5.IList< T >.

virtual bool C5.HashedArrayList< T >.Remove ( item,
out T  removeditem 
)
virtual

Remove the first copy of a particular item from this collection if found. If an item was removed, report a binary copy of the actual item removed in the argument. The item will be searched for from the end of the list if

FIFO == false (the default), else from the start.

Parameters
itemThe value to remove.
removeditemThe removed value.
Returns
True if the item was found (and removed).

Implements C5.ICollection< T >.

virtual void C5.HashedArrayList< T >.RemoveAll ( SCG.IEnumerable< T >  items)
virtual

Remove all items in another collection from this one, taking multiplicities into account. Matching items will be removed from the front. Current implementation is not optimal.

Parameters
itemsThe items to remove.

Implements C5.ICollection< T >.

virtual void C5.HashedArrayList< T >.RemoveAllCopies ( item)
virtual

Remove all items equal to a given one.

Parameters
itemThe value to remove.

Implements C5.ICollection< T >.

virtual T C5.HashedArrayList< T >.RemoveAt ( int  index)
virtual

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.

Implements C5.IList< T >.

virtual T C5.HashedArrayList< T >.RemoveFirst ( )
virtual

Remove one item from the front of the list.

Exceptions
NoSuchItemExceptionif this list is empty.
Returns
The removed item.

Implements C5.IList< T >.

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

Remove all items in an index interval.

Exceptions
ArgumentOutOfRangeExceptionIf
start
and
count
does not describe a valid interval in the list
Parameters
startThe index of the first item to remove.
countThe number of items to remove.

Implements C5.IIndexed< T >.

virtual T C5.HashedArrayList< T >.RemoveLast ( )
virtual

Remove one item from the back of the list.

Exceptions
NoSuchItemExceptionif this list is empty.
Returns
The removed item.

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.RetainAll ( SCG.IEnumerable< T >  items)
virtual

Remove all items not in some other collection from this one, taking multiplicities into account. Items are retained front first.

Parameters
itemsThe items to retain.

Implements C5.ICollection< T >.

virtual void C5.HashedArrayList< T >.Reverse ( )
virtual

Reverse the list so the items are in the opposite sequence order.

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.Shuffle ( )
virtual

Randomly shuffle the items of this list.

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.Shuffle ( Random  rnd)
virtual

Shuffle the items of this list according to a specific random source.

Parameters
rndThe random source.

Implements C5.IList< T >.

virtual IList<T> C5.HashedArrayList< T >.Slide ( int  offset)
virtual

Slide this list view along the underlying list.

Exceptions
NotAViewExceptionif this list is not a view.
ArgumentOutOfRangeExceptionif the operation would bring either end of the view outside the underlying list.
Parameters
offsetThe signed amount to slide: positive to slide towards the end.

Implements C5.IList< T >.

virtual IList<T> C5.HashedArrayList< T >.Slide ( int  offset,
int  size 
)
virtual

Slide this list view along the underlying list, changing its size.

Exceptions
NotAViewExceptionif this list is not a view.
ArgumentOutOfRangeExceptionif the operation would bring either end of the view outside the underlying list.
Parameters
offsetThe signed amount to slide: positive to slide towards the end.
sizeThe new size of the view.

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.Sort ( )
virtual

Sort the items of the list according to the default sorting order for the item type T, as defined by the Comparer[T] class (T:C5.Comparer`1).

Exceptions
InvalidOperationExceptionif T is not comparable

Implements C5.IList< T >.

virtual void C5.HashedArrayList< T >.Sort ( SCG.IComparer< T >  comparer)
virtual

Sort the items of the list according to a specific sorting order.

Parameters
comparerThe comparer defining the sorting order.

Implements C5.IList< T >.

virtual IList<T> C5.HashedArrayList< T >.Span ( IList< T >  otherView)
virtual

Returns null if otherView is strictly to the left of this view

Parameters
otherView
Exceptions
IncompatibleViewExceptionIf otherView does not have the same underlying list as this
Returns

Implements C5.IList< T >.

virtual bool C5.HashedArrayList< T >.TrySlide ( int  offset)
virtual

Exceptions
NotAViewExceptionif this list is not a view.
Parameters
offset
Returns

Implements C5.IList< T >.

virtual bool C5.HashedArrayList< T >.TrySlide ( int  offset,
int  size 
)
virtual

Exceptions
NotAViewExceptionif this list is not a view.
Parameters
offset
size
Returns

Implements C5.IList< T >.

virtual ICollectionValue<T> C5.HashedArrayList< T >.UniqueItems ( )
virtual

Returns

Implements C5.ICollection< T >.

override bool C5.HashedArrayList< T >.UnsequencedEquals ( ICollection< T >  that)
virtual

Parameters
that
Returns

Reimplemented from C5.CollectionBase< T >.

virtual bool C5.HashedArrayList< T >.Update ( item)
virtual

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. This will only update the first mathching item.

Parameters
itemValue to update.
Returns
True if the item was found and hence updated.

Implements C5.ICollection< T >.

virtual bool C5.HashedArrayList< T >.Update ( item,
out T  olditem 
)
virtual

Parameters
item
olditem
Returns

Implements C5.ICollection< T >.

override void C5.HashedArrayList< T >.updatecheck ( )
protectedvirtual

Check if it is valid to perform updates and increment stamp if so.

Exceptions
ViewDisposedExceptionIf check fails by this list being a disposed view.
ReadOnlyCollectionExceptionIf check fails by this being a read only list.

Reimplemented from C5.CollectionBase< T >.

virtual bool C5.HashedArrayList< T >.UpdateOrAdd ( item)
virtual

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. This will only update the first matching item.

Parameters
itemValue to update.
Returns
True if the item was found and hence updated.

Implements C5.ICollection< T >.

virtual bool C5.HashedArrayList< T >.UpdateOrAdd ( item,
out T  olditem 
)
virtual

Parameters
item
olditem
Returns

Implements C5.ICollection< T >.

virtual IList<T> C5.HashedArrayList< T >.View ( int  start,
int  count 
)
virtual

Create a list view on this list.

Exceptions
ArgumentOutOfRangeExceptionif the start or count is negative or the range does not fit within list.
Parameters
startThe index in this list of the start of the view.
countThe size of the view.
Returns
The new list view.

Implements C5.IList< T >.

virtual IList<T> C5.HashedArrayList< T >.ViewOf ( item)
virtual

Create a list view on this list containing the (first) occurrence of a particular item.

Returns null if the item is not in this list.

Parameters
itemThe item to find.
Returns
The new list view.

Implements C5.IList< T >.

Property Documentation

virtual bool C5.HashedArrayList< T >.AllowsDuplicates
get

True, indicating array list has bag semantics.

virtual Speed C5.HashedArrayList< T >.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).

Speed.Linear

override int C5.HashedArrayList< T >.Count
get

The number of items in this collection

virtual bool C5.HashedArrayList< T >.DuplicatesByCounting
get

By convention this is true for any collection with set semantics.

True if only one representative of a group of equal items is kept in the collection together with the total count.

virtual bool C5.HashedArrayList< T >.FIFO
getset

Since

Add(T item) always add at the end of the list, this describes if list has FIFO or LIFO semantics.

True if the Remove() operation removes from the start of the list, false if it removes from the end. The default for a new array list is false.

virtual T C5.HashedArrayList< T >.First
get

Exceptions
NoSuchItemExceptionif this list is empty.

The first item in this list.

virtual Speed C5.HashedArrayList< T >.IndexingSpeed
get

virtual bool C5.HashedArrayList< T >.IsFixedSize
get

virtual bool C5.HashedArrayList< T >.IsValid
get

virtual T C5.HashedArrayList< T >.Last
get

Exceptions
NoSuchItemExceptionif this list is empty.

The last item in this list.

override EventTypeEnum C5.HashedArrayList< T >.ListenableEvents
get

virtual int C5.HashedArrayList< T >.Offset
get

Offset for this list view or 0 for an underlying list.

virtual T C5.HashedArrayList< T >.this[int index]
getset

On this list, this indexer is read/write.

Exceptions
IndexOutOfRangeExceptionif index is negative or >= the size of the collection.
DuplicateNotAllowedExceptionBy the get operation if the item already is present somewhere else in the list.

The index'th item of this list.

Parameters
indexThe index of the item to fetch or store.
virtual IList<T> C5.HashedArrayList< T >.Underlying
get

Null if this list is not a view.

Underlying list for view.


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