Packagestencyl.api.engine.utils
Classpublic class HashSet
InheritanceHashSet Inheritance flash.utils.Proxy



Public Properties
 PropertyDefined By
  empty : Boolean
[read-only] Tells whether this set is empty.
HashSet
  size : int
[read-only] The number of members in this set.
HashSet
Public Methods
 MethodDefined By
  
Creates a new, empty instance.
HashSet
  
add(element:Object):void
Adds an element as a member of this set.
HashSet
  
addMembers(value:Object):void
Adds the members of another collection.
HashSet
  
clear():void
Removes all members.
HashSet
  
[static] Creates a copy of a set.
HashSet
  
createSingleton(member:Object):HashSet
[static] Creates a singleton set (a set with one member).
HashSet
  
diff(subtrahend:Object):HashSet
Returns the difference between this set and another object.
HashSet
  
equals(value:Object):Boolean
Checks if this set is equivalent to another set.
HashSet
  
every(test:Function, thisObject:* = null):Boolean
Checks whether all members of the set satisfy a criterion.
HashSet
  
filter(test:Function, thisObject:* = null):HashSet
Executes a test function on each member of this set and constructs a new set for all members that return true for the specified function.
HashSet
  
forEach(test:Function, thisObject:* = null):void
Executes a function on each member of this set.
HashSet
  
fromObject(value:Object):HashSet
[static] Creates a new set and populates with the the elements in another object.
HashSet
  
has(element:Object):Boolean
Checks if this set has a certain member.
HashSet
  
intersect(value:Object):HashSet
Returns the intersection of this set and another object.
HashSet
  
map(mapper:Function, thisObject:* = null):HashSet
Executes a function on each member of this set, and constructs a new set of elements corresponding to the results of the function on each member of the original set.
HashSet
  
prSubsetOf(value:Object):Boolean
Tells whether this is a proper subset (that is, a subset that is not identical) of another object.
HashSet
  
remove(element:Object):void
Removes a member of this set.
HashSet
  
removeMembers(value:Object):void
Removes the members of another collection.
HashSet
  
some(test:Function, thisObject:* = null):Boolean
Checks whether at least one member of the set satisfies a criterion.
HashSet
  
subsetOf(value:Object):Boolean
Tells whether this is a subset of another set.
HashSet
  
toArray():Array
Converts this set into an array with the same membership.
HashSet
  
toString():String
HashSet
  
union(value:Object):HashSet
Returns the union of this set and another set.
HashSet
Protected Methods
 MethodDefined By
  
deleteProperty(name:*):Boolean
[override] Removes an object from this set.
HashSet
  
getProperty(name:*):*
[override] Allows the use of bracket notation to check membership.
HashSet
  
hasProperty(name:*):Boolean
[override] Checks if this set has a certain member.
HashSet
  
nextName(index:int):String
[override]
HashSet
  
nextNameIndex(index:int):int
[override]
HashSet
  
nextValue(index:int):*
[override]
HashSet
  
setProperty(name:*, value:*):void
[override] Allows members to be added or removed using bracket notation.
HashSet
Public Constants
 ConstantDefined By
  hash : Dictionary
The hash table that stores data for this set.
HashSet
Property Detail
emptyproperty
empty:Boolean  [read-only]

Tells whether this set is empty. This set is empty if and only if size == 0.


Implementation
    public function get empty():Boolean

See also

sizeproperty 
size:int  [read-only]

The number of members in this set.


Implementation
    public function get size():int

See also

Constructor Detail
HashSet()Constructor
public function HashSet()

Creates a new, empty instance.

See also

Method Detail
add()method
public function add(element:Object):void

Adds an element as a member of this set. If it is already a member, does nothing.

Parameters

element:Object — New member to add.

See also

addMembers()method 
public function addMembers(value:Object):void

Adds the members of another collection.

Parameters

value:Object — Another collection. Can be a HashSet, an Array, or any object that allows for each..in iteration.

See also

clear()method 
public final function clear():void

Removes all members.

See also

clone()method 
public static function clone(value:HashSet):HashSet

Creates a copy of a set.

Parameters

value:HashSet — The set to copy.

Returns
HashSet — A new set with the same membership as value.

See also

createSingleton()method 
public static function createSingleton(member:Object):HashSet

Creates a singleton set (a set with one member).

Parameters

member:Object — The solitary member of the new set.

Returns
HashSet — A new set with a size of 1 and member as the only member.

See also

deleteProperty()method 
override flash_proxy function deleteProperty(name:*):Boolean

Removes an object from this set.

Works much like remove(). The following are equivalent:

		 delete hashSet[element];
		 hashSet.remove(element);
		 

Parameters

name:* — The member to remove.

Returns
Boolean — A value of true if the object was removed; false otherwise.

See also

diff()method 
public function diff(subtrahend:Object):HashSet

Returns the difference between this set and another object.

Parameters

subtrahend:Object — Set to subtract from this set. This function is optimized for a HashSet object, but can use any type of object that can be iterated over using for each..in.

Returns
HashSet — A set that includes all members of this set that are not in subtrahend. Under some circumstances, may simply return this set.
equals()method 
public function equals(value:Object):Boolean

Checks if this set is equivalent to another set.

Parameters

value:Object — Set to check against. If not a HashSet, returns false

Returns
Boolean — A value of true if value has the same membership as this set; false otherwise.
every()method 
public function every(test:Function, thisObject:* = null):Boolean

Checks whether all members of the set satisfy a criterion.

If this set is empty, this will always return true.

Parameters

test:Function — The criterion to test for. Must take a single argument and return a Boolean value.
 
thisObject:* (default = null) — An object to use as this for the test function.

Returns
Boolean — A value of true is at least one member causes test to return true; false otherwise.

See also

filter()method 
public function filter(test:Function, thisObject:* = null):HashSet

Executes a test function on each member of this set and constructs a new set for all members that return true for the specified function. If a member returns false, it is not included in the new set.

Parameters

test:Function — The criterion to test for. Must take a single argument and return a Boolean value.
 
thisObject:* (default = null) — An object to use as this for the test function.

Returns
HashSet — A new set including only the elements of this set which test returns true for.
forEach()method 
public function forEach(test:Function, thisObject:* = null):void

Executes a function on each member of this set.

Parameters

test:Function — The function to run on each member. Must take a single argument.
 
thisObject:* (default = null) — An object to use as this for the test function.

fromObject()method 
public static function fromObject(value:Object):HashSet

Creates a new set and populates with the the elements in another object.

If the other object is a HashSet, then using clone() is recommended.

Parameters

value:Object — An object containing the elements to add as members of the new set. Can be any type of object, as long as its elements can be iterated over using for each..in (for example, Array objects). Duplicated elements will only be added once.

Returns
HashSet — A new HashSet instance with the same membership as members.

See also

getProperty()method 
override flash_proxy function getProperty(name:*):*

Allows the use of bracket notation to check membership. If hashSet[x] == x, then x is a member of the set. If hashSet[x] == undefined, then x is not a member.

Parameters

name:* — Element to look up.

Returns
* — A value of undefined if name is not a member. Returns name if name is a member.
has()method 
public function has(element:Object):Boolean

Checks if this set has a certain member.

Parameters

element:Object — Element to check for.

Returns
Boolean — A value of true if element is a member of this set; false otherwise.
hasProperty()method 
override flash_proxy function hasProperty(name:*):Boolean

Checks if this set has a certain member.

Parameters

name:* — Element to check for.

Returns
Boolean — A value of true if element is a member of this set; false otherwise.
intersect()method 
public function intersect(value:Object):HashSet

Returns the intersection of this set and another object.

Parameters

value:Object — Object to calculate intersection with. May be a HashSet, an Array, or any type of object which can be iterated over using for each..in. (This function is optimized for HashSet objects.)

Returns
HashSet — A set containing all elements that are members of this set and members of value. In some circumstances this function may simply return this set or value.
map()method 
public function map(mapper:Function, thisObject:* = null):HashSet

Executes a function on each member of this set, and constructs a new set of elements corresponding to the results of the function on each member of the original set.

Parameters

mapper:Function — The function to run on each member of the set. Must take a single argument and return something. If it returns undefined, that result is not added to the new set.
 
thisObject:* (default = null) — An object to use as this for the test function.

Returns
HashSet — New set containing all mapped elements.
nextName()method 
override flash_proxy function nextName(index:int):String

Parameters

index:int

Returns
String
nextNameIndex()method 
override flash_proxy function nextNameIndex(index:int):int

Parameters

index:int

Returns
int
nextValue()method 
override flash_proxy function nextValue(index:int):*

Parameters

index:int

Returns
*
prSubsetOf()method 
public function prSubsetOf(value:Object):Boolean

Tells whether this is a proper subset (that is, a subset that is not identical) of another object.

Empty sets are considered subsets of all nonempty sets.

Parameters

value:Object — Set to check against. Optimized for HashSet objects, but can use any type of object whose elements can be iterated over using for each..in.

Returns
Boolean — A value of true if this set is a subset of value and not identical to it; false otherwise.

See also

remove()method 
public function remove(element:Object):void

Removes a member of this set.

Parameters

element:Object — Element to remove. If it is not a member, this function does nothing.

removeMembers()method 
public function removeMembers(value:Object):void

Removes the members of another collection.

Parameters

value:Object — Another collection. Can be a HashSet, an Array, or any object that allows for each..in iteration.

See also

setProperty()method 
override flash_proxy function setProperty(name:*, value:*):void

Allows members to be added or removed using bracket notation.

This is equivalent to hashSet.add(x): hashSet[x] = x;

This is equivalent to hashSet.remove(x): hashSet[x] = undefined;

Parameters

name:* — Member to set the value of.
 
value:* — A value of undefined to remove the member, or name to add it. If value is anything else, this function throws an error.


Throws
ArgumentError — If value is not undefined or the same as name.
some()method 
public function some(test:Function, thisObject:* = null):Boolean

Checks whether at least one member of the set satisfies a criterion.

If this set is empty, this will always return false.

Parameters

test:Function — The criterion to test for. Must take a single argument and return a Boolean value.
 
thisObject:* (default = null) — An object to use as this for the test function.

Returns
Boolean — A value of true is at least one member causes test to return true; false otherwise.

See also

subsetOf()method 
public function subsetOf(value:Object):Boolean

Tells whether this is a subset of another set.

Identical sets are considered subsets of each other. Empty sets are subsets of all other sets.

Parameters

value:Object — Set to check against. Optimized for HashSet objects, but can use any type of object whose elements can be iterated over using for each..in.

Returns
Boolean — A value of true if this set is a subset of value; false otherwise.

See also

toArray()method 
public final function toArray():Array

Converts this set into an array with the same membership.

Returns
Array — A new Array instance.
toString()method 
public final function toString():String

Returns
String
union()method 
public function union(value:Object):HashSet

Returns the union of this set and another set.

Parameters

value:Object — Set to calculate union with. Optimized for HashSet objects, but can use any type of object whose elements can be iterated over using for each..in.

Returns
HashSet — A set containing all elements that are members of this set or members of value. In some circumstances this function may simply return this set or value.
Constant Detail
hashConstant
public const hash:Dictionary

The hash table that stores data for this set. Keys and values must be the same. Any key or value is a member of the set; anything else is not.