Library: data-structure.js
Overview
No overview provided.
Constructors
A basic set (in the mathematical sense) data structure
parameters
Array or SimileAjax.Set | a | an initial collection |
methods
A sorted array data structure
parameters
compare | ||
initialArray |
Functions
Adds the given object to this set, assuming there it does not already exist
parameters
Object | o | the object to add |
returns
Boolean | true if the object was added, false if not |
Adds each element in the given set to this set
parameters
SimileAjax.Set | set | the set of elements to add |
Removes the given element from this set
parameters
Object | o | the object to remove |
returns
Boolean | true if the object was successfully removed, false otherwise |
Removes the elements in this set that correspond to the elements in the
given set
parameters
SimileAjax.Set | set | the set of elements to remove |
Removes all elements in this set that are not present in the given set, i.e.
modifies this set to the intersection of the two sets
parameters
SimileAjax.Set | set | the set to intersect |
Returns whether or not the given element exists in this set
parameters
SimileAjax.Set | o | the object to test for |
returns
Boolean | true if the object is present, false otherwise |
SimileAjax.Set.size()
Returns the number of elements in this set
returns
Number | the number of elements in this set |
SimileAjax.Set.toArray()
Returns the elements of this set as an array
returns
Array | a new array containing the elements of this set |
Iterates through the elements of this set, order unspecified, executing the
given function on each element until the function returns true
parameters
Function | f | a function of form f(element) |
Objects