[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/zendframework/zend-stdlib/src/ -> PriorityQueue.php (summary)

Zend Framework (http://framework.zend.com/)

Copyright: Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
License: http://framework.zend.com/license/new-bsd New BSD License
File Size: 301 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

PriorityQueue:: (15 methods):
  insert()
  remove()
  isEmpty()
  count()
  top()
  extract()
  getIterator()
  serialize()
  unserialize()
  toArray()
  setInternalQueueClass()
  contains()
  hasPriority()
  getQueue()
  __clone()


Class: PriorityQueue  - X-Ref

Re-usable, serializable priority queue implementation

SplPriorityQueue acts as a heap; on iteration, each item is removed from the
queue. If you wish to re-use such a queue, you need to clone it first. This
makes for some interesting issues if you wish to delete items from the queue,
or, as already stated, iterate over it multiple times.

This class aggregates items for the queue itself, but also composes an
"inner" iterator in the form of an SplPriorityQueue object for performing
the actual iteration.
insert($data, $priority = 1)   X-Ref
Insert an item into the queue

Priority defaults to 1 (low priority) if none provided.

param: mixed $data
param: int $priority
return: PriorityQueue

remove($datum)   X-Ref
Remove an item from the queue

This is different than {@link extract()}; its purpose is to dequeue an
item.

This operation is potentially expensive, as it requires
re-initialization and re-population of the inner queue.

Note: this removes the first item matching the provided item found. If
the same item has been added multiple times, it will not remove other
instances.

param: mixed $datum
return: bool False if the item was not found, true otherwise.

isEmpty()   X-Ref
Is the queue empty?

return: bool

count()   X-Ref
How many items are in the queue?

return: int

top()   X-Ref
Peek at the top node in the queue, based on priority.

return: mixed

extract()   X-Ref
Extract a node from the inner queue and sift up

return: mixed

getIterator()   X-Ref
Retrieve the inner iterator

SplPriorityQueue acts as a heap, which typically implies that as items
are iterated, they are also removed. This does not work for situations
where the queue may be iterated multiple times. As such, this class
aggregates the values, and also injects an SplPriorityQueue. This method
retrieves the inner queue object, and clones it for purposes of
iteration.

return: SplPriorityQueue

serialize()   X-Ref
Serialize the data structure

return: string

unserialize($data)   X-Ref
Unserialize a string into a PriorityQueue object

Serialization format is compatible with {@link Zend\Stdlib\SplPriorityQueue}

param: string $data
return: void

toArray($flag = self::EXTR_DATA)   X-Ref
Serialize to an array

By default, returns only the item data, and in the order registered (not
sorted). You may provide one of the EXTR_* flags as an argument, allowing
the ability to return priorities or both data and priority.

param: int $flag
return: array

setInternalQueueClass($class)   X-Ref
Specify the internal queue class

Please see {@link getIterator()} for details on the necessity of an
internal queue class. The class provided should extend SplPriorityQueue.

param: string $class
return: PriorityQueue

contains($datum)   X-Ref
Does the queue contain the given datum?

param: mixed $datum
return: bool

hasPriority($priority)   X-Ref
Does the queue have an item with the given priority?

param: int $priority
return: bool

getQueue()   X-Ref
Get the inner priority queue instance

return: SplPriorityQueue

__clone()   X-Ref
Add support for deep cloning

return: void



Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1