AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated v7 version of this document. Switch to the v8 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:

NameTypeDescription
newLengthLimitnumberThe new length limit

dequeue

Removes the first item from the queue and returns it.

Returns:

* - Removed item.

enqueue

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

Params:

NameTypeDescription
item*Item

Returns:

* - Returns replaced item.

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:

NameTypeDescription
indexnumberIndex of item.

Returns:

* - Queue item.

getLength

Returns current queue length.

Returns:

number - The current queue length.