new LinkedList()
A basic Linked List data structure.
This implementation modifies the prev
and next
properties of each item added:
- The prev
and next
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 - utils/LinkedList.js, line 18
Members
-
first :object
-
First element in the list.
- Default Value:
- null
- Source - utils/LinkedList.js, line 39
-
last :object
-
Last element in the list.
- Default Value:
- null
- Source - utils/LinkedList.js, line 46
-
next :object
-
Next element in the list.
- Default Value:
- null
- Source - utils/LinkedList.js, line 25
-
prev :object
-
Previous element in the list.
- Default Value:
- null
- Source - utils/LinkedList.js, line 32
-
total :integer
-
Number of elements in the list.
- Default Value:
- 0
- Source - utils/LinkedList.js, line 53
Methods
-
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:
object -The item that was added.
- Source - utils/LinkedList.js, line 59
-
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.
- Source - utils/LinkedList.js, line 156
-
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.
- Source - utils/LinkedList.js, line 107
-
reset()
-
Resets the first, last, next and previous node pointers in this list.
- Source - utils/LinkedList.js, line 92