Property | Defined by | ||
---|---|---|---|
capacity : uint Returns the capacity of the RingBuffer.
| RingBuffer | ||
empty : Boolean [read-only] Returns true if the RingBuffer contains 0 elements.
| RingBuffer | ||
length : uint [read-only] Returns the number of elements currently stored in the RingBuffer.
| RingBuffer |
Property | Defined by | ||
---|---|---|---|
_array : Array | RingBuffer | ||
_capacity : uint | RingBuffer | ||
_firstIndex : uint | RingBuffer | ||
_length : uint | RingBuffer |
Method | Defined by | ||
---|---|---|---|
RingBuffer(capacity:uint = 1)
Creates a new RingBuffer with the specified capacity.
| RingBuffer | ||
at(index:uint):*
Returns the element at the specified index.
| RingBuffer | ||
clear():void
Removes all elements from the RingBuffer.
| RingBuffer | ||
every(callback:Function, thisObject:* = null):Boolean
Executes a test function on each item in the ring buffer
until an item is reached that returns false for the specified
function.
| RingBuffer | ||
forEach(callback:Function, thisObject:* = null):void
Executes a function on each item in the ring buffer.
| RingBuffer | ||
indexOf(searchElement:*, fromIndex:int = 0):int
Searches for an item in the ring buffer by using strict equality
(===) and returns the index position of the item, or -1
if the item is not found.
| RingBuffer | ||
pop():*
Removes the last element from the RingBuffer and returns it.
| RingBuffer | ||
push(... args):uint
Adds the specified elements to the back of the RingBuffer.
| RingBuffer | ||
shift():*
Removes the first element from the RingBuffer and returns it.
| RingBuffer | ||
unshift(... args):uint
Adds the specified elements to the front of the RingBuffer.
| RingBuffer |
_array | property |
protected var _array:Array
_capacity | property |
protected var _capacity:uint
capacity | property |
capacity:uint
[read-write]Returns the capacity of the RingBuffer.
Implementation public function get capacity():uint
public function set capacity(value:uint):void
empty | property |
empty:Boolean
[read-only]Returns true if the RingBuffer contains 0 elements.
Implementation public function get empty():Boolean
_firstIndex | property |
protected var _firstIndex:uint
_length | property |
protected var _length:uint
length | property |
length:uint
[read-only]Returns the number of elements currently stored in the RingBuffer.
Implementation public function get length():uint
RingBuffer | () | constructor |
public function RingBuffer(capacity:uint = 1)
Creates a new RingBuffer with the specified capacity.
Parameterscapacity:uint (default = 1 )
|
at | () | method |
public function at(index:uint):*
Returns the element at the specified index. If index >= length, at() will return undefined.
Parametersindex:uint |
* |
clear | () | method |
public function clear():void
Removes all elements from the RingBuffer.
every | () | method |
public function every(callback:Function, thisObject:* = null):Boolean
Executes a test function on each item in the ring buffer until an item is reached that returns false for the specified function. Returns a Boolean value of true if all items in the buffer return true for the specified function; otherwise, false.
Parameterscallback:Function |
|
thisObject:* (default = null )
|
Boolean |
forEach | () | method |
public function forEach(callback:Function, thisObject:* = null):void
Executes a function on each item in the ring buffer.
Parameterscallback:Function |
|
thisObject:* (default = null )
|
indexOf | () | method |
public function indexOf(searchElement:*, fromIndex:int = 0):int
Searches for an item in the ring buffer by using strict equality (===) and returns the index position of the item, or -1 if the item is not found.
ParameterssearchElement:* |
|
fromIndex:int (default = 0 )
|
int |
pop | () | method |
public function pop():*
Removes the last element from the RingBuffer and returns it. If the RingBuffer is empty, pop() will return undefined.
Returns* |
push | () | method |
public function push(... args):uint
Adds the specified elements to the back of the RingBuffer. If the RingBuffer's length is equal to its capacity, this will cause a elements to be removed from the front of the RingBuffer. Returns the new length of the RingBuffer.
Parameters... args |
uint |
shift | () | method |
public function shift():*
Removes the first element from the RingBuffer and returns it. If the RingBuffer is empty, shift() will return undefined.
Returns* |
unshift | () | method |
public function unshift(... args):uint
Adds the specified elements to the front of the RingBuffer. If the RingBuffer's length is equal to its capacity, this will cause elements to be removed from the back of the RingBuffer. Returns the new length of the RingBuffer.
Parameters... args |
uint |