Class: Phaser.LinkedList
Constructor
new LinkedList()
A basic Linked List data structure.
This implementation modifies the prev
and next
properties of each item added:
- The
prev
andnext
properties must be writable and should not be used for any other purpose. - Items cannot be added to multiple LinkedLists at the same time.
- Only objects can be added.
- Source code: utils/LinkedList.js (Line 18)
Public Properties
- Source code: utils/LinkedList.js (Line 39)
- Source code: utils/LinkedList.js (Line 46)
- Source code: utils/LinkedList.js (Line 25)
- Source code: utils/LinkedList.js (Line 32)
- Source code: utils/LinkedList.js (Line 53)
first : Object
First element in the list.
last : Object
Last element in the list.
next : Object
Next element in the list.
prev : Object
Previous element in the list.
total : integer
Number of elements in the list.
Public Methods
- Source code: utils/LinkedList.js (Line 59)
- Source code: utils/LinkedList.js (Line 156)
- Source code: utils/LinkedList.js (Line 107)
- Source code: utils/LinkedList.js (Line 92)
add(item) → {object}
Adds a new element to this linked list.
Parameters
Name | Type | Description |
---|---|---|
item | object | The element to add to this list. Can be a Phaser.Sprite or any other object you need to quickly iterate through. |
Returns
The item that was added.
callAll(callback)
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 | Description |
---|---|---|
callback | function | The function to call. |
remove(item)
Removes the given element from this linked list if it exists.
Parameters
Name | Type | Description |
---|---|---|
item | object | The item to be removed from the list. |
reset()
Resets the first, last, next and previous node pointers in this list.
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.LinkedList.html