summaryrefslogtreecommitdiff
path: root/ext/spl/internal
diff options
context:
space:
mode:
authorEtienne Kneuss <colder@php.net>2008-01-21 21:55:55 +0000
committerEtienne Kneuss <colder@php.net>2008-01-21 21:55:55 +0000
commit7366d48c04690883f37a887c7dedeace820a6bc9 (patch)
tree9bc20f094eb10cba44b93f8023b0c16b5386e007 /ext/spl/internal
parentfa47e900e28fe5dd2c408288a7d43d48cf2706fa (diff)
downloadphp-git-7366d48c04690883f37a887c7dedeace820a6bc9.tar.gz
MFH: Add doxygen docs for SplDoublyLinkedList, SplStack, SplQueue
Diffstat (limited to 'ext/spl/internal')
-rw-r--r--ext/spl/internal/spldoublylinkedlist.inc100
-rw-r--r--ext/spl/internal/splqueue.inc50
-rw-r--r--ext/spl/internal/splstack.inc35
3 files changed, 185 insertions, 0 deletions
diff --git a/ext/spl/internal/spldoublylinkedlist.inc b/ext/spl/internal/spldoublylinkedlist.inc
new file mode 100644
index 0000000000..dffcefd255
--- /dev/null
+++ b/ext/spl/internal/spldoublylinkedlist.inc
@@ -0,0 +1,100 @@
+<?php
+
+/** @file spldoublylinkedlist.inc
+ * @ingroup SPL
+ * @brief class SplDoublyLinkedList
+ * @author Etienne Kneuss
+ * @date 2008
+ *
+ * SPL - Standard PHP Library
+ */
+
+/** @ingroup SPL
+ * @brief Doubly Linked List
+ * @since PHP 5.3
+ *
+ * The SplDoublyLinkedList class provides the main functionnalities of a
+ * doubly linked list (DLL).
+ */
+class SplDoublyLinkedList implements Traversable, ArrayAccess, Countable
+{
+
+ /** Iterator mode
+ * @see setIteratorMode
+ */
+ const IT_MODE_LIFO = 0x00000001;
+
+ /** Iterator mode
+ * @see setIteratorMode
+ */
+ const IT_MODE_FIFO = 0x00000000;
+
+
+ /** Iterator mode
+ * @see setIteratorMode
+ */
+ const IT_MODE_KEEP = 0x00000000;
+
+ /** Iterator mode
+ * @see setIteratorMode
+ */
+ const IT_MODE_DELETE = 0x00000002;
+
+ /** @return the element popped from the end of the DLL.
+ */
+ function pop() {/**/}
+
+ /** @return the element shifted from the beginning of the DLL.
+ */
+ function shift() {/**/}
+
+ /** Pushes an element to the end of the DLL.
+ * @param $data variable to add to the DLL.
+ */
+ function push($data) {/**/}
+
+ /** Adds an element to the beginning of the DLL.
+ * @param $data variable to add to the DLL.
+ */
+ function unshift($data) {/**/}
+
+ /** @return the element at the beginning of the DLL.
+ */
+ function top() {/**/}
+
+ /** @return the element at the end of the DLL.
+ */
+ function bottom() {/**/}
+
+ /** @return number elements in the DLL.
+ */
+ function count() {/**/}
+
+ /** @return whether the DLL is empty.
+ */
+ function isEmpty() {/**/}
+
+ /** Changes the iteration mode. There are two orthogonal sets of modes that
+ * can be set:
+ * - The direction of the iteration (either one or the other)
+ * - SplDoublyLnkedList::IT_MODE_LIFO (Stack style)
+ * - SplDoublyLnkedList::IT_MODE_FIFO (Queue style)
+ *
+ * - The behavior of the iterator (either one or the other)
+ * - SplDoublyLnkedList::IT_MODE_DELETE (Elements are deleted by the iterator)
+ * - SplDoublyLnkedList::IT_MODE_KEEP (Elements are traversed by the iterator)
+ *
+ * The default mode is 0 : SplDoublyLnkedList::IT_MODE_FIFO | SplDoublyLnkedList::IT_MODE_KEEP
+ *
+ * @param $mode new mode of iteration
+ */
+ function setIteratorMode($mode) {/**/}
+
+ /** @return the current iteration mode
+ * @see setIteratorMode
+ */
+ function getIteratorMode() {/**/}
+
+}
+
+?>
diff --git a/ext/spl/internal/splqueue.inc b/ext/spl/internal/splqueue.inc
new file mode 100644
index 0000000000..aaa62db843
--- /dev/null
+++ b/ext/spl/internal/splqueue.inc
@@ -0,0 +1,50 @@
+<?php
+
+/** @file splqueue.inc
+ * @ingroup SPL
+ * @brief class SplQueue
+ * @author Etienne Kneuss
+ * @date 2008
+ *
+ * SPL - Standard PHP Library
+ */
+
+/** @ingroup SPL
+ * @brief Implementation of a Queue through a DoublyLinkedList. As SplQueue
+ * extends SplDoublyLinkedList, unshift() and pop() are still available even
+ * though they don't make much sense for a queue. For convenience, two aliases
+ * are available:
+ * - enqueue() is an alias of push()
+ * - dequeue() is an alias of shift()
+ *
+ * @since PHP 5.3
+ *
+ * The SplQueue class provides the main functionnalities of a
+ * queue implemented by a doubly linked list.
+ */
+class SplQueue extends SplDoublyLinkedList
+{
+ /** Changes the iteration mode. For queues, the direction mode
+ * is frozen. Attempting to modify it will result in an RuntimeException.
+ *
+ * @throws RuntimeException
+ * @param $mode new mode of iteration
+ * @see SplDoublyLinkedList::setIteratorMode
+ */
+ function setIteratorMode($mode) {/**/}
+
+ /** @return the first element of the queue.
+ * @note dequeue is an alias of push()
+ * @see splDoublyLinkedList::push()
+ */
+ function dequeue() {/**/}
+
+ /** Pushes an element at the end of the queue.
+ * @param $data variable to add to the queue.
+ * @note enqueue is an alias of shift()
+ * @see splDoublyLinkedList::shift()
+ */
+ function enqueue($data) {/**/}
+}
+
+?>
diff --git a/ext/spl/internal/splstack.inc b/ext/spl/internal/splstack.inc
new file mode 100644
index 0000000000..a83d2c4b8e
--- /dev/null
+++ b/ext/spl/internal/splstack.inc
@@ -0,0 +1,35 @@
+<?php
+
+/** @file splstack.inc
+ * @ingroup SPL
+ * @brief class SplStack
+ * @author Etienne Kneuss
+ * @date 2008
+ *
+ * SPL - Standard PHP Library
+ */
+
+
+/** @ingroup SPL
+ * @brief Implementation of a stack through a DoublyLinkedList. As SplStack
+ * extends SplDoublyLinkedList, shift() and unshift() are still available even
+ * though they don't make much sense for a stack.
+ *
+ * @since PHP 5.3
+ *
+ * The SplStack class provides the main functionnalities of a
+ * stack implemented by a doubly linked list.
+ */
+class SplStack extends SplDoublyLinkedList
+{
+ /** Changes the iteration mode. For stacks, the direction mode
+ * is frozen. Attempting to modify it will result in an RuntimeException.
+ *
+ * @throws RuntimeException
+ * @param $mode new mode of iteration
+ * @see SplDoublyLinkedList::setIteratorMode
+ */
+ function setIteratorMode($mode) {/**/}
+}
+
+?>