The SlotList class represents an immutable list of Slot objects.
length:uint
[read-only]
The number of slots in the list.
Implementation public function get length():uint
public var nonEmpty:Boolean = false
public function SlotList(head:ISlot, tail:SlotList = null)
Creates and returns a new SlotList object.
A user never has to create a SlotList manually.
Use the NIL
element to represent an empty list.
NIL.prepend(value)
would create a list containing value
.
Parameters | head:ISlot — The first slot in the list.
|
|
| tail:SlotList (default = null ) — A list containing all slots except head.
|
Throws | ArgumentError — ArgumentError : Parameters head and tail are null. Use the NIL element instead.
|
|
| ArgumentError — ArgumentError : Parameter head cannot be null.
|
public function append(slot:ISlot):SlotList
Appends a slot to this list.
Note: appending is O(n). Where possible, prepend which is O(1).
In some cases, many list items must be cloned to
avoid changing existing lists.
Parameters
| slot:ISlot — The item to be appended.
|
Returns | SlotList — A list consisting of all elements of this list followed by slot.
|
public function contains(listener:Function):Boolean
Determines whether the supplied listener Function is contained within this list
Parameters
Returns public function filterNot(listener:Function):SlotList
Returns the slots in this list that do not contain the supplied listener.
Note: assumes the listener is not repeated within the list.
Parameters
| listener:Function — The function to remove.
|
Returns | SlotList — A list consisting of all elements of this list that do not have listener.
|
public function find(listener:Function):ISlot
Retrieves the ISlot associated with a supplied listener within the SlotList.
Parameters
| listener:Function — The Function being searched for
|
Returns | ISlot — The ISlot in this list associated with the listener parameter through the ISlot.listener property.
Returns null if no such ISlot instance exists or the list is empty.
|
public function insertWithPriority(slot:ISlot):SlotList
Insert a slot into the list in a position according to its priority.
The higher the priority, the closer the item will be inserted to the list head.
Parameters
ReturnsThrows | ArgumentError — ArgumentError : Parameters head and tail are null. Use the NIL element instead.
|
|
| ArgumentError — ArgumentError : Parameter head cannot be null.
|
public function prepend(slot:ISlot):SlotList
Prepends a slot to this list.
Parameters
| slot:ISlot — The item to be prepended.
|
Returns | SlotList — A list consisting of slot followed by all elements of this list.
|
Throws | ArgumentError — ArgumentError : Parameter head cannot be null.
|
public function toString():String
Returnspublic static const NIL:SlotList
Represents an empty list. Used as the list terminator.
Lundi Février 11 2013, 01:50 PM +01:00