Constructor. Create a new ordered list.
OrderedList
OrderedList
()
Add a referenced object to the end of the list and reset the internal counter.
void
add
(object $object, [string $key = ""])
-
object
$object: The object to add to the queue.
-
string
$key: the key by which the object is referenced in the list. By default the key will be the integer position in the list.
Clear the list.
void
clear
()
Create a new instance of the object in the list with a given reference.
object A
copy
(string $key)
-
string
$key: The primary key of the object to get a copy of.
Delete an element by reference.
boolean
delete
(string $key)
-
string
$key: The primary key of the object to delete.
Tell whether an element with a given reference exists in the list.
boolean
exists
(string $key)
-
string
$key: The primary key of the object to check.
Get the size of the list.
integer
getSize
()
Tell whether there exists an object in the queue at the current position.
boolean
hasNext
()
Move an element down (towards the end) the list.
boolean
moveDown
(string $key)
-
string
$key: The primary key of the object to move.
Move an element up (towards the beginning) the list.
boolean
moveUp
(string $key)
-
string
$key: The primary key of the object to move.
Get the current element and increase the position by one.
object The
next
()
Move an element to the position that preceeds that of another element or the end of the list.
boolean
putBefore
(string $source, string $destination)
-
string
$source: The primary key of object to move.
-
string
$destination: The primary key of object in front of which the source object is to be put. If $destination==="list_end" the source will be put at the end of the list, in the hope that there is no element whose key is "list_end,"
Retrieve an element by reference.
object The
retrieve
(string $key)
-
string
$key: The primary key of the object to retrieve.
Swap two elements in the list.
boolean
swap
(string $key1, string $key2)
-
string
$key1: The primary key of first object to swap the position of.
-
string
$key2: The primary key of second object to swap the position of.