Top
You are looking at an outdated 7.11.0 version of this document. Switch to the 8.0.1 version to see the up to date information.

class anychart.math.CycledQueue Improve this Doc

Class for queues with random access by indexes. Default maximum queue length is 256. It dequeues automatically when the length of the queue reaches that limit. So if you need larger queue - set the length limit explicitly.

Methods Overview

Miscellaneous
clear()Clears the queue. You can optionally reset the queue length limit.
dequeue()Removes the first item from the queue and returns it.
enqueue()Enqueues passed item.
get()Returns the queue item at the specified index.
getLength()Returns current queue length.

Methods Description

clear

Clears the queue. You can optionally reset the queue length limit.

Params:

Name Type Description
newLengthLimit number The new length limit

Try it:

dequeue

Removes the first item from the queue and returns it.

Returns:

* - Removed item.

Try it:

enqueue

Enqueues passed item. If this call dequeued an item - returns it.

Params:

Name Type Description
item * Item

Returns:

* - Returns replaced item.

Try it:

get

Returns the queue item at the specified index. The index can be negative - that will interpreted as the index from the end of the queue.

Params:

Name Type Description
index number Index of item.

Returns:

* - Queue item.

Try it:

getLength

Returns current queue length.

Returns:

number - The current queue length.

Try it: