Class: Array

algo.core. Array

new Array(options)

construct a new Array DataStructure. These are simple 1 dimensional arrays with basic add/remove operations.
Parameters:
Name Type Description
options
Source:

Methods

getElement(index)

get the element at the given index
Parameters:
Name Type Description
index
Source:

getElementAccessor() → {*}

returns a read only accessor for the elements
Source:
Returns:
Type
*

getItem(index)

get the item at the given index
Parameters:
Name Type Description
index
Source:

getValue(index)

get the value at the given index
Parameters:
Name Type Description
index
Source:

getValueAccessor() → {function}

returns a read only accessor for the values
Source:
Returns:
- a function that can be called with the index of the required element
Type
function

insertAt(value, index)

add a new value at the given index
Parameters:
Name Type Description
value * anything
index number the index to insert at
Source:

pop()

remove the last item in the array
Source:

push(value)

add a new value to the end of the array
Parameters:
Name Type Description
value
Source:

removeAt(index)

remove an item at the given index which must be valid
Parameters:
Name Type Description
index
Source:

setValue(index)

set the value at the given index
Parameters:
Name Type Description
index
Source:

swap(index)

swap the two items at x and y, calling update on each
Parameters:
Name Type Description
index
Source:

<private> updateElements()

invoke updateElement on all elements. Since we don't know how the array is display ( maybe its in a circle? ) we update all elements after any CRUD operation.
Source:

validateIndex(index)

throw an exception if the given index is invalid
Parameters:
Name Type Description
index
Source: