Interface List
access this type via: data.adt.List (provides, requires or uses)
An ordered list of items.
Transfer fields
Data content[]
int iteratorIndex
Functions
void add(storeData item)
void remove(Data item)
void update(Data item, storeData newVersion)
Data getFirst()
Data getNext()
bool isEnd()
Data getIndex(int n)
void setIndex(int n, storeData d)
int getLength()
Data[] getContents(optional Type t)
Transfer fields
content The contents of the list.
iteratorIndex The current iterator index.
void add(storeData item)
Add a new item to the list; this function adds a reference (shallow copy) of the given item onto the list.
void remove(Data item)
Remove an item from the list; this function locates the given item using a reference (===) check.
void update(Data item, storeData newVersion)
Update an existing list item to a new version. This locates the given item using a reference (===) check, then replaces that reference with the reference to newVersion.
Data getFirst()
Iterator: call this function to begin iterating over the list. Note that this function, together with getNext(), are not thread-safe: if getFirst() is called by thread A, which then begins using getNext() to iterate through the list, a second call of getFirst() by thread B will reset thread A's iterator.
returns: The first element in the list, or null if the list is empty.
Data getNext()
Iterator: call this function to get the next element in the list.
returns: The next element in the list, or null if the end of the list has been reached.
bool isEnd()
Iterator: call this function to check if we've reached the end of the list, such that calling getNext() again would return null as there are no more items.
returns: True if the end of the list has been reached; false otherwise.
Data getIndex(int n)
Get the data instance at this index in the list.
returns: The data instance at this index, if any, or null if the index is out of bounds or empty.
void setIndex(int n, storeData d)
Set the given index of the list to stored the given data instance.
int getLength()
Get the number of items currently stored in the list.
returns: The number of items in the list.
Data[] getContents(optional Type t)
Get all items in the list as an array of type Data[].
t The specific type for the resulting array.
returns: An array of type Data[] containing all items in the list, in order.