diff --git a/reference/spl/book.xml b/reference/spl/book.xml index fc98998ac8..61380fd08e 100644 --- a/reference/spl/book.xml +++ b/reference/spl/book.xml @@ -1,5 +1,5 @@ - + Standard PHP Library (SPL) @@ -43,6 +43,7 @@ &reference.spl.splheap; &reference.spl.splmaxheap; &reference.spl.splminheap; + &reference.spl.splpriorityqueue; diff --git a/reference/spl/spldoublylinkedlist/setiteratormode.xml b/reference/spl/spldoublylinkedlist/setiteratormode.xml index f7106a85f6..249ee8c1a3 100644 --- a/reference/spl/spldoublylinkedlist/setiteratormode.xml +++ b/reference/spl/spldoublylinkedlist/setiteratormode.xml @@ -1,5 +1,5 @@ - + SplDoublyLinkedList::setIteratorMode @@ -28,21 +28,21 @@ The direction of the iteration (either one or the other): - SplDoublyLnkedList::IT_MODE_LIFO (Stack style) - SplDoublyLnkedList::IT_MODE_FIFO (Queue style) + 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) + 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 + The default mode is: SplDoublyLnkedList::IT_MODE_FIFO | SplDoublyLnkedList::IT_MODE_KEEP diff --git a/reference/spl/splheap/rewind.xml b/reference/spl/splheap/rewind.xml index c5f0b9d3a1..fd42479a15 100644 --- a/reference/spl/splheap/rewind.xml +++ b/reference/spl/splheap/rewind.xml @@ -1,5 +1,5 @@ - + SplHeap::rewind @@ -13,7 +13,7 @@ - This rewinds the iterator to the beginning. This is a no-opp for heaps + This rewinds the iterator to the beginning. This is a no-op for heaps as the iterator is virtual and in fact never moves from the top of the heap. diff --git a/reference/spl/splpriorityqueue.xml b/reference/spl/splpriorityqueue.xml new file mode 100644 index 0000000000..d0ad32ca91 --- /dev/null +++ b/reference/spl/splpriorityqueue.xml @@ -0,0 +1,100 @@ + + + + The SplPriorityQueue class + SplPriorityQueue + + + + +
+ &reftitle.intro; + + The SplPriorityQueue class provides the main functionalities of an + prioritized queue, implemented using a heap. + +
+ + +
+ &reftitle.classsynopsis; + + + + SplPriorityQueue + + + + + + SplPriorityQueue + + + + Iterator + + + + Countable + + + + + + + + Methods + + + + +
+ + + +
+ + &reference.spl.entities.splpriorityqueue; + +
+ + + diff --git a/reference/spl/splpriorityqueue/compare.xml b/reference/spl/splpriorityqueue/compare.xml new file mode 100644 index 0000000000..d4e4bfdf54 --- /dev/null +++ b/reference/spl/splpriorityqueue/compare.xml @@ -0,0 +1,78 @@ + + + + + SplPriorityQueue::compare + Compare priorities in order to place elements correctly in the heap while sifting up. + + + + &reftitle.description; + + voidSplPriorityQueue::compare + mixedpriority1 + mixedpriority1 + + + + Compare priority1 with priority2. + + + + + &reftitle.parameters; + + + + priority1 + + + The priority of the first node being compared. + + + + + priority2 + + + The priority of the second node being compared. + + + + + + + + + &reftitle.returnvalues; + + Result of the comparison, positive integer if priority1 is greater than priority2, 0 if they are equal, negative integer otherwise. + + + + Multiple elements with the same priority will get dequeued in no particular order. + + + + + + diff --git a/reference/spl/splpriorityqueue/construct.xml b/reference/spl/splpriorityqueue/construct.xml new file mode 100644 index 0000000000..4f7d442a94 --- /dev/null +++ b/reference/spl/splpriorityqueue/construct.xml @@ -0,0 +1,53 @@ + + + + + SplPriorityQueue::__construct + Constructs a new empty queue + + + + &reftitle.description; + + SplPriorityQueue::__construct + + + + This constructs a new empty queue. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/spl/splpriorityqueue/count.xml b/reference/spl/splpriorityqueue/count.xml new file mode 100644 index 0000000000..981d233b05 --- /dev/null +++ b/reference/spl/splpriorityqueue/count.xml @@ -0,0 +1,50 @@ + + + + + SplPriorityQueue::count + Counts the number of elements in the queue. + + + + &reftitle.description; + + intSplPriorityQueue::count + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the number of elements in the queue. + + + + + + diff --git a/reference/spl/splpriorityqueue/current.xml b/reference/spl/splpriorityqueue/current.xml new file mode 100644 index 0000000000..cfd8e3fbed --- /dev/null +++ b/reference/spl/splpriorityqueue/current.xml @@ -0,0 +1,52 @@ + + + + + SplPriorityQueue::current + Return current node pointed by the iterator + + + + &reftitle.description; + + mixedSplPriorityQueue::current + + + + Get the current datastructure node. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + The value or priority (or both) of the current node, depending on the extract flag. + + + + + diff --git a/reference/spl/splpriorityqueue/extract.xml b/reference/spl/splpriorityqueue/extract.xml new file mode 100644 index 0000000000..4bd50f7f17 --- /dev/null +++ b/reference/spl/splpriorityqueue/extract.xml @@ -0,0 +1,50 @@ + + + + + SplPriorityQueue::extract + Extracts a node from top of the heap and sift up. + + + + &reftitle.description; + + mixedSplPriorityQueue::extract + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + The value or priority (or both) of the extracted node, depending on the extract flag. + + + + + + diff --git a/reference/spl/splpriorityqueue/insert.xml b/reference/spl/splpriorityqueue/insert.xml new file mode 100644 index 0000000000..7653d2814f --- /dev/null +++ b/reference/spl/splpriorityqueue/insert.xml @@ -0,0 +1,73 @@ + + + + + SplPriorityQueue::insert + Inserts an element in the queue by sifting it up. + + + + &reftitle.description; + + voidSplPriorityQueue::insert + mixedvalue + mixedpriority + + + + Insert value with the priority priority in the queue. + + + + + &reftitle.parameters; + + + + value + + + The value to insert. + + + + + priority + + + The associated priority. + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + diff --git a/reference/spl/splpriorityqueue/isempty.xml b/reference/spl/splpriorityqueue/isempty.xml new file mode 100644 index 0000000000..5f36f92e0f --- /dev/null +++ b/reference/spl/splpriorityqueue/isempty.xml @@ -0,0 +1,50 @@ + + + + + SplPriorityQueue::isEmpty + Checks whether the queue is empty. + + + + &reftitle.description; + + boolSplPriorityQueue::isEmpty + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns whether the queue is empty. + + + + + + diff --git a/reference/spl/splpriorityqueue/key.xml b/reference/spl/splpriorityqueue/key.xml new file mode 100644 index 0000000000..200b9fe3b9 --- /dev/null +++ b/reference/spl/splpriorityqueue/key.xml @@ -0,0 +1,53 @@ + + + + + SplPriorityQueue::key + Return current node index + + + + &reftitle.description; + + mixedSplPriorityQueue::key + + + + This function returns the current node index + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + The current node index. + + + + + + diff --git a/reference/spl/splpriorityqueue/next.xml b/reference/spl/splpriorityqueue/next.xml new file mode 100644 index 0000000000..663b95f857 --- /dev/null +++ b/reference/spl/splpriorityqueue/next.xml @@ -0,0 +1,53 @@ + + + + + SplPriorityQueue::next + Move to the next node + + + + &reftitle.description; + + voidSplPriorityQueue::next + + + + Extracts the top node from the queue. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/spl/splpriorityqueue/recoverfromcorruption.xml b/reference/spl/splpriorityqueue/recoverfromcorruption.xml new file mode 100644 index 0000000000..14f3cb957c --- /dev/null +++ b/reference/spl/splpriorityqueue/recoverfromcorruption.xml @@ -0,0 +1,49 @@ + + + + + SplPriorityQueue::recoverFromCorruption + Recover from the corrupted state and allow further actions on the queue. + + + + &reftitle.description; + + voidSplPriorityQueue::recoverFromCorruption + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + diff --git a/reference/spl/splpriorityqueue/rewind.xml b/reference/spl/splpriorityqueue/rewind.xml new file mode 100644 index 0000000000..a8bc6fc89c --- /dev/null +++ b/reference/spl/splpriorityqueue/rewind.xml @@ -0,0 +1,55 @@ + + + + + SplPriorityQueue::rewind + Rewind iterator back to the start (no-op) + + + + &reftitle.description; + + voidSplPriorityQueue::rewind + + + + This rewinds the iterator to the beginning. This is a no-op for heaps + as the iterator is virtual and in fact never moves from the top of the + heap. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/spl/splpriorityqueue/setextractflags.xml b/reference/spl/splpriorityqueue/setextractflags.xml new file mode 100644 index 0000000000..55efa39dd0 --- /dev/null +++ b/reference/spl/splpriorityqueue/setextractflags.xml @@ -0,0 +1,71 @@ + + + + + SplPriorityQueue::setExtractFlags + Sets the mode of extraction + + + + &reftitle.description; + + voidSplPriorityQueue::setExtractFlags + intflags + + + + + &reftitle.parameters; + + + + flags + + + Defines what is extracted by SplPriorityQueue::current, + SplPriorityQueue::top and + SplPriorityQueue::extract. + + + SplPriorityQueue::EXTR_DATA (0x00000001): Extract the data + SplPriorityQueue::EXTR_PRIORITY (0x00000002): Extract the priority + SplPriorityQueue::EXTR_BOTH (0x00000003): Extract an array containing both + + + The default mode is SplPriorityQueue::EXTR_DATA. + + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/spl/splpriorityqueue/top.xml b/reference/spl/splpriorityqueue/top.xml new file mode 100644 index 0000000000..a0ea7109f5 --- /dev/null +++ b/reference/spl/splpriorityqueue/top.xml @@ -0,0 +1,50 @@ + + + + + SplPriorityQueue::top + Peaks at the node from the top of the queue + + + + &reftitle.description; + + mixedSplPriorityQueue::top + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + The value or priority (or both) of the top node, depending on the extract flag. + + + + + + diff --git a/reference/spl/splpriorityqueue/valid.xml b/reference/spl/splpriorityqueue/valid.xml new file mode 100644 index 0000000000..8a5557a609 --- /dev/null +++ b/reference/spl/splpriorityqueue/valid.xml @@ -0,0 +1,53 @@ + + + + + SplPriorityQueue::valid + Check whether the queue contains more nodes + + + + &reftitle.description; + + boolSplPriorityQueue::valid + + + + Checks if the queue contains any more nodes. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns &true; if the queue contains any more nodes, &false; otherwise. + + + + + +