Packagesystem.data
Interfacepublic interface Bag extends Collection, Equatable, Cloneable, Iterable, Serializable
Implementors CoreMapBag

Defines a collection that counts the number of times an object appears in the collection.



Public Methods
 MethodDefined By
 Inherited
add(o:*):Boolean
Ensures that this collection contains the specified element (optional operation).
Collection
  
addAll(c:Collection):Boolean
Insert all elements represented in the given collection.
Bag
  
addCopies(o:*, nCopies:uint):Boolean
Adds n copies of the given object to the bag and keep a count.
Bag
 Inherited
clear():void
Removes all of the elements from this collection (optional operation).
Collection
 Inherited
clone():*
Creates and returns a shallow copy of the object.
Cloneable
 Inherited
contains(o:*):Boolean
Returns true if this collection contains the specified element.
Collection
  
Returns true if the bag contains all elements in the given collection, respecting cardinality.
Bag
 Inherited
equals(o:*):Boolean
Compares the specified object with this object for equality.
Equatable
 Inherited
get(key:*):*
Returns the element from this collection at the passed index.
Collection
  
getCount(o:*):uint
Returns the number of occurrences (cardinality) of the given object currently in the bag.
Bag
 Inherited
indexOf(o:*, fromIndex:uint = 0):int
Returns the position of the passed object in the collection.
Collection
 Inherited
isEmpty():Boolean
Returns true if this collection contains no elements.
Collection
 Inherited
Returns the iterator reference of the object.
Iterable
 Inherited
remove(o:*):*
Removes a single instance of the specified element from this collection, if it is present (optional operation).
Collection
  
Removes objects from the bag according to their count in the specified collection.
Bag
  
removeCopies(o:*, nCopies:uint):Boolean
Removes a specified number of copies of an object from the bag.
Bag
  
Removes any members of the bag that are not in the given collection, respecting cardinality.
Bag
 Inherited
size():uint
Retrieves the number of elements in this collection.
Collection
 Inherited
toArray():Array
Returns an array containing all of the elements in this collection.
Collection
 Inherited
toSource(indent:int = 0):String
Returns the source code string representation of the object.
Serializable
  
Returns the Set of unique members that represent all members in the bag.
Bag
Method Detail
addAll()method
public function addAll(c:Collection):Boolean

Insert all elements represented in the given collection.

Parameters

c:Collection

Returns
Boolean
addCopies()method 
public function addCopies(o:*, nCopies:uint):Boolean

Adds n copies of the given object to the bag and keep a count.

Parameters

o:*
 
nCopies:uint

Returns
Boolean
containsAll()method 
public function containsAll(c:Collection):Boolean

Returns true if the bag contains all elements in the given collection, respecting cardinality.

Parameters

c:Collection

Returns
Booleantrue if the bag contains all elements in the given collection, respecting cardinality.
getCount()method 
public function getCount(o:*):uint

Returns the number of occurrences (cardinality) of the given object currently in the bag.

Parameters

o:*

Returns
uint — the number of occurrences (cardinality) of the given object currently in the bag.
removeAll()method 
public function removeAll(c:Collection):Boolean

Removes objects from the bag according to their count in the specified collection.

Parameters

c:Collection — the collection to use.

Returns
Boolean — true if the bag changed.
removeCopies()method 
public function removeCopies(o:*, nCopies:uint):Boolean

Removes a specified number of copies of an object from the bag.

Parameters

o:* — the object to remove
 
nCopies:uint — the number of copies to remove

Returns
Boolean — true if the bag changed
retainAll()method 
public function retainAll(c:Collection):Boolean

Removes any members of the bag that are not in the given collection, respecting cardinality.

Parameters

c:Collection

Returns
Boolean
uniqueSet()method 
public function uniqueSet():Set

Returns the Set of unique members that represent all members in the bag.

Returns
Set — the Set of unique members that represent all members in the bag.