Class ISet
Defined in: ilib-full-dyn.js.
Constructor Attributes | Constructor Name and Description |
---|---|
ISet(elements)
Create a new set with elements in the given array.
|
Method Attributes | Method Name and Description |
---|---|
add(element)
Adds the specified element or array of elements to this set if it is or they are not
already present.
|
|
asArray()
Return the set as a javascript array.
|
|
clear()
Removes all of the elements from this set.
|
|
contains(element)
Returns true if this set contains the specified element.
|
|
fromJS(obj)
Convert from a js representation to an internal one.
|
|
isEmpty()
Returns true if this set contains no elements.
|
|
remove(element)
Removes the specified element from this set if it is present.
|
|
toJS()
Convert to a javascript representation of this object.
|
|
toJson()
Represents the current set as json.
|
Class Detail
ISet(elements)
Create a new set with elements in the given array. The type of
the set is gleaned from the type of the first element in the
elements array, or the first element added to the set. The type
may be "string" or "number", and all elements will be returned
as elements of that type.
- Parameters:
- {Array.<string|number>=} elements
- initial elements to add to the set
Method Detail
{boolean}
add(element)
Adds the specified element or array of elements to this set if it is or they are not
already present.
- Parameters:
- {*|Array.<*>} element
- element or array of elements to add
- Returns:
- {boolean} true if this set did not already contain the specified element[s]
{Array.<*>}
asArray()
Return the set as a javascript array.
- Returns:
- {Array.<*>} the set represented as a javascript array
clear()
Removes all of the elements from this set.
{boolean}
contains(element)
Returns true if this set contains the specified element.
- Parameters:
- {*} element
- the element to test
- Returns:
- {boolean}
{ISet|undefined}
fromJS(obj)
Convert from a js representation to an internal one.
- Parameters:
- obj
- Returns:
- {ISet|undefined} the current object, or undefined if the conversion did not work
{boolean}
isEmpty()
Returns true if this set contains no elements.
- Returns:
- {boolean}
{boolean}
remove(element)
Removes the specified element from this set if it is present.
- Parameters:
- {*} element
- the element to remove
- Returns:
- {boolean} true if the set contained the specified element
{*}
toJS()
Convert to a javascript representation of this object.
In this case, it is a normal JS array.
- Returns:
- {*} the JS representation of this object
{string}
toJson()
Represents the current set as json.
- Returns:
- {string} the current set represented as json