new ArrayList()
A set data structure. Allows items to add themselves to and remove themselves from the set. Items can only exist once in the set.
- Source - core/ArrayList.js, line 13
Members
-
first :object
-
Resets the cursor to the first item in the list and returns it.
- Source - core/ArrayList.js, line 160
-
list :array
-
The list.
- Source - core/ArrayList.js, line 30
-
next :object
-
Gets the next item in the list and returns it, advancing the cursor. Advanced the cursor and return.
- Source - core/ArrayList.js, line 185
-
position :number
-
Current cursor position.
- Default Value:
- 0
- Source - core/ArrayList.js, line 25
-
total :number
-
Number of objects in the list.
- Default Value:
- 0
- Source - core/ArrayList.js, line 19
Methods
-
add(child) → {object}
-
Adds a new element to this list. The item can only exist in the list once.
Parameters:
Name Type Description child
object The element to add to this list. Can be a Phaser.Sprite or any other object you need to quickly iterate through.
Returns:
object -The child that was added.
- Source - core/ArrayList.js, line 36
-
callAll(callback, parameter)
-
Calls a function on all members of this list, using the member as the context for the callback. The function must exist on the member.
Parameters:
Name Type Argument Description callback
function The function to call.
parameter
* <repeatable>
Additional parameters that will be passed to the callback.
- Source - core/ArrayList.js, line 134
-
exists(child) → {boolean}
-
Checks for the child within this list.
Parameters:
Name Type Description child
object The element to get the list index for.
Returns:
boolean -True if the child is found in the list, otherwise false.
- Source - core/ArrayList.js, line 68
-
getIndex(child) → {number}
-
Gets the index of the child in the list, or -1 if it isn't in the list.
Parameters:
Name Type Description child
object The element to get the list index for.
Returns:
number -The index of the child or -1 if not found.
- Source - core/ArrayList.js, line 55
-
remove(child) → {object}
-
Removes the given element from this list if it exists.
Parameters:
Name Type Description child
object The child to be removed from the list.
Returns:
object -child - The child that was removed.
- Source - core/ArrayList.js, line 93
-
reset()
-
Resets the list length and drops all items in the list.
- Source - core/ArrayList.js, line 81
-
setAll(key, value)
-
Sets the property
key
to the given value on all members of this list.Parameters:
Name Type Description key
object The object on the child to set.
value
* The value to set the property to.
- Source - core/ArrayList.js, line 113