Class Index | File Index

Classes


Class CircularBuffer


Defined in: DataStructures.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Class for managing a circular buffer.
Field Summary
Field Attributes Field Name and Description
 
Is true if buffer is empty, false otherwise.
 
Is true if buffer is full, false otherwise.
 
The index of the position of the head of the buffer.
 
The items stored in the buffer.
 
The size of the buffer.
 
The index of the position of the tail of the buffer.
Method Summary
Method Attributes Method Name and Description
 
Clones the circular buffer into a new circular buffer.
 
free(from, to)
Frees the buffer between indexes from and to.
 
Frees all the buffer.
 
Returns the iterator relative to the aggregate.
 
Returns true if the buffer is empty, false otherwise.
 
Returns true if the buffer is full, false otherwise.
 
read(index)
Reads the item stored at the position index.
 
resize(size)
Resize the buffer.
 
write(item)
Writes the item at the head of the buffer.
Class Detail
CircularBuffer(size)
Class for managing a circular buffer.
Parameters:
size
{Number} The size of the buffer.
Field Detail
empty
Is true if buffer is empty, false otherwise.

full
Is false if buffer is full, false otherwise.

head
The index of the position of the head of the buffer.

items
The items stored in the buffer.

size
The size of the buffer.

tail
The index of the position of the tail of the buffer.
Method Detail
{CircularBuffer} clone()
Clones the circular buffer into a new circular buffer.
Returns:
{CircularBuffer} The circular buffer cloned from this circular buffer.

{void} free(from, to)
Frees the buffer between indexes from and to. If from > to, positions between from and the end of the buffer and between the start and to will be free.
Parameters:
from
{Number} The index from which start to free (inclusive index)
to
{Number} The index where stop to free (exclusive index)
Returns:
{void}

{void} freeAll()
Frees all the buffer.
Returns:
{void}

{Iterator} getIterator()
Returns the iterator relative to the aggregate.
Returns:
{Iterator} The iterator.

{boolean} isEmpty()
Returns true if the buffer is empty, false otherwise.
Returns:
{boolean}

{boolean} isFull()
Returns true if the buffer is full, false otherwise.
Returns:
{boolean}

{*} read(index)
Reads the item stored at the position index.
Parameters:
index
{Number} The position of the item to read.
Returns:
{*} The item read.

{void} resize(size)
Resize the buffer.
Parameters:
size
{number} The new size of the buffer.
Returns:
{void}

{void} write(item)
Writes the item at the head of the buffer.
Parameters:
item
{*} The item to write.
Returns:
{void}

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 23 2014 22:40:58 GMT+0200 (CEST)