Access keys

AbstractList

Kind of class: class
Inherits from: BasicClass
Known subclasses:
Author: Simon Wacker
Classpath: org.as2lib.data.holder.list.AbstractList
File last modified: Sunday, 10 July 2005, 15:41:22
AbstractList provides common implementations of methods needed by
implementations of the org.as2lib.data.holder.List interface.

Class methods

getStringifier

static function getStringifier (
Void) : Stringifier
Returns the stringifier to stringify lists.
Returns:
the list stringifier

setStringifier

static function setStringifier (
listStringifier:Stringifier) : Void
Sets the stringifier to stringify lists.
Parameters:
listStringifier:
the stringifier to stringify lists

Instance methods

contains

function contains (
value) : Boolean
Checks whether value is contained in this list.
Parameters:
value:
the value to check whether it is contained
Returns:
true if value is contained else false

containsAll

function containsAll (
list:List) : Boolean
Checks whether all values of list are contained in this list.
Parameters:
list:
the values to check whether they are contained
Returns:
true if all values of list are contained else
false

indexOf

function indexOf (
value) : Number
Returns the index of value.
Parameters:
value:
the value to return the index of
Returns:
the index of value

insert

function insert (
) : Void
Overloading:
insertByValue (value) : Void
insertByIndexAndValue

insertAllByIndexAndList

function insertAllByIndexAndList (
index:Number, list:List) : Void
Inserts all values contained in list to this list, starting at the
specified index.

Elements that are at an affected index are shifted to the right by the size
of the given list.

Parameters:
index:
the index to start the insertion at
list :
the values to insert
Throws:
org.as2lib.data.holder.IndexOutOfBoundsException if the given index is not in range,
this is less than 0 or greater than this list's size

insertAllByList

function insertAllByList (
list:List) : Void
Inserts all values contained in list to the end of this list.
Parameters:
list:
the values to insert

insertByValue

function insertByValue (
value) : Void
Inserts value at the end of this list.
Parameters:
value:
the value to insert
See also:

insertFirst

function insertFirst (
value) : Void
Inserts value at the beginning of this list.
Parameters:
value:
the value to insert

insertLast

function insertLast (
value) : Void
Inserts value at the end of this list.
Parameters:
value:
the value to insert
See also:

isEmpty

function isEmpty (
Void) : Boolean
Returns whether this list is empty.

This list is empty if it has no values assigned to it.

Returns:
true if this list is empty else false

remove

function remove (
)
Overloading:

removeAll

function removeAll (
list:List) : Void
Removes all values contained in list.
Parameters:
list:
the values to remove

removeByValue

function removeByValue (
value) : Number
Removes value from this list if it exists.
Parameters:
value:
the value to remove

removeFirst

function removeFirst (
Void)
Removes the value at the beginning of this list.
Returns:
the removed value

removeLast

function removeLast (
Void)
Removes the value at the end of this list.
Returns:
the removed value

retainAll

function retainAll (
list:List) : Void
Retains all values the are contained in list and removes all others.
Parameters:
list:
the list of values to retain

setAll

function setAll (
index:Number, list:List) : Void
Sets all values contained in list to this list, starting from given
index. They values that were originally at the given index
and following indices will be overwritten.

This method only overwrites existing index-value pairs. If an affected index
is equal to or greater than this list's size, which would mean that this list's
size had to be expanded, an IndexOutOfBoundsException will be thrown. In
such a case use the insertAll method instead, which expands this list
dynamically.

Parameters:
index:
the index to start at
list :
the values to set
Throws:
org.as2lib.data.holder.IndexOutOfBoundsException if given index is less than 0 or if
any affected index, that is the given index plus the index of the
specific value in the given list, is equal to or greater than this list's
size

subList

function subList (
fromIndex:Number, toIndex:Number) : List
Returns a view of the portion of this list between the specified fromIndex,
inclusive, and toIndex, exclusive.

If fromIndex and toIndex are equal an empty list is returned.

The returned list is backed by this list, so changes in the returned list are
reflected in this list, and vice-versa.

Parameters:
fromIndex:
the index from which the sub-list starts (inclusive)
toIndex :
the index specifying the end of the sub-list (exclusive)
Returns:
a view of the specified range within this list
Throws:
org.as2lib.data.holder.IndexOutOfBoundsException if argument fromIndex is less than 0
org.as2lib.data.holder.IndexOutOfBoundsException if argument toIndex is greater than
the size of this list
org.as2lib.data.holder.IndexOutOfBoundsException if argument fromIndex is greater than
toIndex

toString

function toString (
) : String
Returns the string representation of this list.

The string representation is obtained via the stringifier returned by the
static getStringifier method.

Returns:
the string representation of this list