SplPriorityQueue - 优先队列
类摘要
SplPriorityQueue implements Iterator , Countable {
public __construct ( void )
public int compare ( mixed $priority1 , mixed $priority2 ) // 比较优先级,以便在筛选时将元素正确放置在堆中。
public int count ( void ) // 计算队列中元素的数量。
public mixed current ( void ) // 返回迭代器指向的当前节点
public mixed extract ( void ) // 从堆顶部提取一个节点并向上移动
public void insert ( mixed $value , mixed $priority ) // 在队列中插入一个元素
public bool isEmpty ( void ) //检查队列是否为空。
public mixed key ( void ) // 返回当前节点索引(key键)
public void next ( void ) // 移动到下一个节点
public void recoverFromCorruption ( void ) // 从损坏的状态恢复,并允许队列中的其他操作。
public void rewind ( void ) // 将迭代器倒回起始
public void setExtractFlags ( int $flags ) // 设置提取模式
public mixed top ( void ) // 从队列顶部的节点上看一眼
public bool valid ( void ) // 检查队列是否包含多个节点。
}简单示例:
资料
Last updated