53 if (
count($this->_llist) == 0) {
56 return array_pop($this->_llist);
64 if (
count($this->_llist) == 0) {
67 return array_shift($this->_llist);
73 public function push($data)
75 array_push($this->_llist, $data);
84 array_unshift($this->_llist, $data);
92 return end($this->_llist);
99 return reset($this->_llist);
106 return count($this->_llist);
113 return ($this->
count() == 0);
132 $this->_it_mode = $mode;
147 if ($this->_it_mode & self::IT_MODE_LIFO) {
148 $this->_it_pos =
count($this->_llist)-1;
158 return array_key_exists($this->_it_pos, $this->_llist);
179 if ($this->_it_mode & self::IT_MODE_LIFO) {
180 if ($this->_it_mode & self::IT_MODE_DELETE) {
185 if ($this->_it_mode & self::IT_MODE_DELETE) {
201 if (!is_numeric($offset)) {
204 return array_key_exists($offset, $this->_llist);
216 if ($this->_it_mode & self::IT_MODE_LIFO) {
217 $realOffset =
count($this->_llist)-$offset;
219 $realOffset = $offset;
222 if (!is_numeric($offset) || !array_key_exists($realOffset, $this->_llist)) {
225 return $this->_llist[$realOffset];
238 if ($offset === null) {
239 return $this->
push($value);
242 if ($this->_it_mode & self::IT_MODE_LIFO) {
243 $realOffset =
count($this->_llist)-$offset;
245 $realOffset = $offset;
248 if (!is_numeric($offset) || !array_key_exists($realOffset, $this->_llist)) {
251 $this->_llist[$realOffset] = $value;
263 if ($this->_it_mode & self::IT_MODE_LIFO) {
264 $realOffset =
count($this->_llist)-$offset;
266 $realOffset = $offset;
269 if (!is_numeric($offset) || !array_key_exists($realOffset, $this->_llist)) {
272 array_splice($this->_llist, $realOffset, 1);
Interface to override array access of objects.
rewind()
Rewind to top iterator as set in constructor.
const IT_MODE_LIFO
Iterator mode.
offsetUnset($offset)
Unsets the element at a certain offset in the DLL.
unshift($data)
Adds an element to the beginning of the DLL.
const IT_MODE_FIFO
Iterator mode.
push($data)
Pushes an element to the end of the DLL.
const IT_MODE_KEEP
Iterator mode.
setIteratorMode($mode)
Changes the iteration mode.
Exception thrown for errors that are only detectable at runtime.
Exception thrown when an illegal index was requested.
This Interface allows to hook into the global count() function.
next()
Forward to next element.
const IT_MODE_DELETE
Iterator mode.
offsetSet($offset, $value)
Defines the data at a certain offset in the DLL.