Queue

new Cesium.Queue()

先进先出队列。

Members

readonlylength : Number

队列的长度。

Methods

从队列中删除所有项。

contains(item)

检查此队列是否包含指定的项。
Name Type Description
item * 要搜索的项。

dequeue()*

出队的项。如果队列为空,则返回undefined。
Returns:
要出队的项。

enqueue(item)

将指定的项进行入队。
Name Type Description
item * 要入队的项。

peek()*

返回队列最前端的项。如果队列为空,则返回undefined。
Returns:
队列最前端的项。

sort(compareFunction)

对队列中的项进行就地(in-place)排序。
Name Type Description
compareFunction Queue~Comparator 定义排序顺序的函数。

Type Definitions

Comparator(a, b)Number

在对队列排序时比较两个项的函数。
Name Type Description
a * 数组中的一项。
b * 数组中的一项。
Returns:
如果a小于b,则返回负值; 如果a大于b,则返回正值;如果a等于b,则返回0。
Example:
function compareNumbers(a, b) {
    return a - b;
}