Class ArrayBase<T>

Base class for collection classes of dynamic array type implementations.

Implements

IEnumerable<T>, System.Collections.IEnumerable, System.IFormattable, ICollectionValue<T>, IDirectedCollectionValue<T>, IDirectedEnumerable<T>, IShowable

Bases

object, EnumerableBase<T>, CollectionValueBase<T>, CollectionBase<T>, DirectedCollectionBase<T>, SequencedBase<T>

Base of

ArrayList<T>, HashedArrayList<T>, SortedArray<T>

Field overview

array ,
isReadOnly, Inherited from CollectionBase<T> ,
itemequalityComparer, Inherited from CollectionBase<T> ,
offset ,
size, Inherited from CollectionBase<T> ,
stamp, Inherited from CollectionBase<T>

Event overview

CollectionChanged, Inherited from CollectionValueBase<T> ,
CollectionCleared, Inherited from CollectionValueBase<T> ,
ItemInserted, Inherited from CollectionValueBase<T> ,
ItemRemovedAt, Inherited from CollectionValueBase<T> ,
ItemsAdded, Inherited from CollectionValueBase<T> ,
ItemsRemoved, Inherited from CollectionValueBase<T>

Property overview

ActiveEvents, Inherited from CollectionValueBase<T> ,
Count, Inherited from CollectionBase<T> ,
CountSpeed, Inherited from CollectionBase<T> ,
Direction, Inherited from SequencedBase<T> ,
EqualityComparer, Inherited from CollectionBase<T> ,
IsEmpty, Inherited from CollectionBase<T> ,
IsReadOnly, Inherited from CollectionBase<T> ,
this[int start, int count] ,
ListenableEvents, Inherited from CollectionValueBase<T> ,
SyncRoot, Inherited from CollectionBase<T>

Constructor overview

ArrayBase<T>(int capacity, System.Collections.Generic.IEqualityComparer<T> itemequalityComparer)

Method overview

All(Fun<T,bool> predicate), Inherited from CollectionValueBase<T> ,
Apply(Act<T> action), Inherited from CollectionValueBase<T> ,
Backwards() ,
Check() ,
checkRange(int start, int count), Inherited from CollectionBase<T> ,
Choose() ,
Clear() ,
CopyTo(T[] array, int index), Inherited from CollectionValueBase<T> ,
Equals(object obj), Inherited from object ,
Exists(Fun<T,bool> predicate), Inherited from CollectionValueBase<T> ,
expand() ,
expand(int newcapacity, int newsize) ,
Filter(Fun<T,bool> predicate), Inherited from CollectionValueBase<T> ,
Finalize(), Inherited from object ,
Find(Fun<T,bool> predicate, out T item), Inherited from CollectionValueBase<T> ,
FindIndex(Fun<T,bool> predicate), Inherited from SequencedBase<T> ,
FindLast(Fun<T,bool> predicate, out T item), Inherited from DirectedCollectionBase<T> ,
FindLastIndex(Fun<T,bool> predicate), Inherited from SequencedBase<T> ,
GetEnumerator() ,
GetHashCode(), Inherited from object ,
GetSequencedHashCode(), Inherited from SequencedBase<T> ,
GetType(), Inherited from object ,
GetUnsequencedHashCode(), Inherited from CollectionBase<T> ,
insert(int i, T item) ,
MemberwiseClone(), Inherited from object ,
modifycheck(int thestamp), Inherited from CollectionBase<T> ,
raiseCollectionChanged(), Inherited from CollectionValueBase<T> ,
raiseCollectionCleared(bool full, int count), Inherited from CollectionValueBase<T> ,
raiseCollectionCleared(bool full, int count, System.Nullable<int> offset), Inherited from CollectionValueBase<T> ,
raiseForAdd(T item), Inherited from CollectionValueBase<T> ,
raiseForInsert(int i, T item), Inherited from CollectionValueBase<T> ,
raiseForRemove(T item), Inherited from CollectionValueBase<T> ,
raiseForRemove(T item, int count), Inherited from CollectionValueBase<T> ,
raiseForRemoveAll(ICollectionValue<T> wasRemoved), Inherited from CollectionValueBase<T> ,
raiseForRemoveAt(int index, T item), Inherited from CollectionValueBase<T> ,
raiseForSetThis(int index, T value, T item), Inherited from CollectionValueBase<T> ,
raiseForUpdate(T newitem, T olditem), Inherited from CollectionValueBase<T> ,
raiseForUpdate(T newitem, T olditem, int count), Inherited from CollectionValueBase<T> ,
raiseItemInserted(T item, int index), Inherited from CollectionValueBase<T> ,
raiseItemRemovedAt(T item, int index), Inherited from CollectionValueBase<T> ,
raiseItemsAdded(T item, int count), Inherited from CollectionValueBase<T> ,
raiseItemsRemoved(T item, int count), Inherited from CollectionValueBase<T> ,
SequencedEquals(ISequenced<T> otherCollection), Inherited from SequencedBase<T> ,
Show(System.Text.StringBuilder stringbuilder, ref int rest, System.IFormatProvider formatProvider), Inherited from CollectionValueBase<T> ,
ToArray() ,
ToString(string format, System.IFormatProvider formatProvider), Inherited from CollectionValueBase<T> ,
ToString(), Inherited from CollectionValueBase<T> ,
UnsequencedEquals(ICollection<T> otherCollection), Inherited from CollectionBase<T> ,
updatecheck(), Inherited from CollectionBase<T>

Field details

P T[] array The actual internal array container. Will be extended on demand.
P int offset 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.

Property details

IDirectedCollectionValue<T> this[int start, int count]Access: Read-Only

Value:The directed collection of items in a specific index interval.

Throws
System.ArgumentOutOfRangeExceptionIf the arguments does not describe a valid range in the indexed collection, cf. CollectionBase<T>.checkRange(int start, int count).
Parameters:
start:The low index of the interval (inclusive).
count:The size of the range.

Constructor details

ArrayBase<T>(int capacity, System.Collections.Generic.IEqualityComparer<T> itemequalityComparer) Create an empty ArrayBase object.
Parameters:
capacity:The initial capacity of the internal array container. Will be rounded upwards to the nearest power of 2 greater than or equal to 8.
itemequalityComparer:The item equalityComparer to use, primarily for item equality

Method details

IDirectedCollectionValue<T> Backwards() Create a directed collection with the same contents as this one, but opposite enumeration sequence.
Returns:The mirrored collection.
bool Check() Perform an internal consistency (invariant) test on the array base.
Returns:True if test succeeds.
T Choose() Choose some item of this collection. The result is the last item in the internal array, making it efficient to remove.
Throws
NoSuchItemExceptionif collection is empty.
Returns:
void Clear() Remove all items and reset size of internal array container.
P void expand() Double the size of the internal array.
P void expand(int newcapacity, int newsize) Expand the internal array container.
Parameters:
newcapacity:The new size of the internal array - will be rounded upwards to a power of 2.
newsize:The (new) size of the (base) collection.
System.Collections.Generic.IEnumerator<T> GetEnumerator() Create an enumerator for this array based collection.
Returns:The enumerator
P void insert(int i, T item) Insert an item at a specific index, moving items to the right upwards and expanding the array if necessary.
Parameters:
i:The index at which to insert.
item:The item to insert.
T[] ToArray() Create an array containing (copies) of the items of this collection in enumeration order.
Returns:The new array