| Package | system.data.bags |
| Class | public class CoreMapBag |
| Inheritance | CoreMapBag Object |
| Implements | Bag |
| Subclasses | ArrayBag, HashBag |
Bag interface, to minimize
the effort required to implement this interface.
To implement a bag, the programmer needs only to extend this class and provide implementations for the cursor, insert and size methods. For supporting the removal of elements, the cursor returned by the cursor method must additionally implement its remove method.
| Property | Defined By | ||
|---|---|---|---|
| modCount : int
This property is a protector used in the BagIterator object of this bag. | CoreMapBag | ||
| Method | Defined By | ||
|---|---|---|---|
Creates a new CoreMapBag instance. | CoreMapBag | ||
add(o:*):Boolean
Add one copy of the given object to the bag and keep a count. | CoreMapBag | ||
addAll(c:Collection):Boolean
Insert all elements represented in the given collection. | CoreMapBag | ||
addCopies(o:*, nCopies:uint):Boolean
Add n copies of the given object to the bag and keep a count. | CoreMapBag | ||
clear():void
Removes all of the elements from this bag. | CoreMapBag | ||
clone():*
Returns the shallow copy of this bag. | CoreMapBag | ||
contains(o:*):Boolean
Returns true if this bag contains the object passed in argument. | CoreMapBag | ||
containsAll(c:Collection):Boolean
Returns true if thie bag contains all object in the passed collection in argument. | CoreMapBag | ||
containsAllInBag(b:Bag):Boolean
Returns true if thie bag contains all object in the passed bag in argument. | CoreMapBag | ||
equals(o:*):Boolean
Compares this Bag to another. | CoreMapBag | ||
get(key:*):*
Unsupported by bag objects. | CoreMapBag | ||
getCount(o:*):uint
Returns the count of the specified object passed in argument. | CoreMapBag | ||
indexOf(o:*, fromIndex:uint = 0):int
Unsupported by bag objects. | CoreMapBag | ||
isEmpty():Boolean
Returns true if the bag is empty. | CoreMapBag | ||
Returns the Iterator representation of the Bag. | CoreMapBag | ||
remove(o:*):*
Removes the object in argument in the bag. | CoreMapBag | ||
removeAll(c:Collection):Boolean
Removes objects from the bag according to their count in the specified collection. | CoreMapBag | ||
removeCopies(o:*, nCopies:uint):Boolean
Removes a specified number of copies of an object from the bag. | CoreMapBag | ||
retainAll(c:Collection):Boolean
Removes any members of the bag that are not in the given collection, respecting cardinality. | CoreMapBag | ||
retainAllInBag(b:Bag):Boolean
Removes any members of the bag that are not in the given bag, respecting cardinality. | CoreMapBag | ||
size():uint
Returns the number of elements in this bag (its cardinality). | CoreMapBag | ||
toArray():Array
Returns the array representation of the bag. | CoreMapBag | ||
toSource(indent:int = 0):String
Returns the source code string representation of the object. | CoreMapBag | ||
toString():String
Returns the string representation of this instance. | CoreMapBag | ||
Returns the Set of unique members that represent all members in the bag. | CoreMapBag | ||
| modCount | property |
modCount:intThis property is a protector used in the BagIterator object of this bag.
public function get modCount():int public function set modCount(value:int):void| CoreMapBag | () | Constructor |
public function CoreMapBag(map:Map = null, co:Collection = null)Creates a new CoreMapBag instance.
Parametersmap:Map (default = null) — a Map reference used to register all elements in the Bag.
| |
co:Collection (default = null) — a Collection to constructs a bag containing all the members of the given collection.
|
| add | () | method |
public function add(o:*):BooleanAdd one copy of the given object to the bag and keep a count.
Parameters
o:* |
Boolean |
| addAll | () | method |
public function addAll(c:Collection):BooleanInsert all elements represented in the given collection.
Parameters
c:Collection |
Boolean |
| addCopies | () | method |
public function addCopies(o:*, nCopies:uint):BooleanAdd n copies of the given object to the bag and keep a count.
Parameters
o:* | |
nCopies:uint |
Boolean — true if the object was not already in the uniqueSet
|
| clear | () | method |
public function clear():voidRemoves all of the elements from this bag.
| clone | () | method |
public function clone():*Returns the shallow copy of this bag.
Returns* — the shallow copy of this bag.
|
| contains | () | method |
public function contains(o:*):Boolean
Returns true if this bag contains the object passed in argument.
Parameters
o:* |
Boolean — true if this bag contains the object passed in argument.
|
| containsAll | () | method |
public function containsAll(c:Collection):Boolean
Returns true if thie bag contains all object in the passed collection in argument.
Parameters
c:Collection |
Boolean — true if thie bag contains all object in the passed collection in argument.
|
| containsAllInBag | () | method |
public function containsAllInBag(b:Bag):Boolean
Returns true if thie bag contains all object in the passed bag in argument.
Parameters
b:Bag |
Boolean — true if thie bag contains all object in the passed bag in argument.
|
| equals | () | method |
public function equals(o:*):BooleanCompares this Bag to another. This Bag equals another Bag if it contains the same number of occurrences of the same elements.
Parameters
o:* — the Bag to compare to.
|
Boolean — true if equal.
|
| get | () | method |
public function get(key:*):*Unsupported by bag objects.
Parameters
key:* |
* |
IllegalOperationError — the 'get' method is unsupported with a bag object.
|
| getCount | () | method |
public function getCount(o:*):uintReturns the count of the specified object passed in argument.
Parameters
o:* |
uint — the count of the specified object passed in argument.
|
| indexOf | () | method |
public function indexOf(o:*, fromIndex:uint = 0):intUnsupported by bag objects.
Parameters
o:* | |
fromIndex:uint (default = 0) |
int |
IllegalOperationError — the 'indexOf' method is unsupported with a bag object.
|
| isEmpty | () | method |
public function isEmpty():Boolean
Returns true if the bag is empty.
Boolean — true if the bag is empty.
|
| iterator | () | method |
public function iterator():IteratorReturns the Iterator representation of the Bag.
ReturnsIterator — the Iterator representation of the Bag.
|
| remove | () | method |
public function remove(o:*):*Removes the object in argument in the bag.
Parameters
o:* |
* |
| removeAll | () | method |
public function removeAll(c:Collection):BooleanRemoves objects from the bag according to their count in the specified collection.
Parameters
c:Collection — the collection to use.
|
Boolean — true if the bag changed.
|
| removeCopies | () | method |
public function removeCopies(o:*, nCopies:uint):BooleanRemoves 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
|
Boolean — true if the bag changed
|
| retainAll | () | method |
public function retainAll(c:Collection):BooleanRemoves any members of the bag that are not in the given collection, respecting cardinality.
Example :
import system.data.Collection;
import system.data.collections.ArrayCollection;
import system.data.bags.CoreMapBag;
import system.data.maps.ArrayMap;
var bag:CoreMapBag = new CoreMapBag( new ArrayMap() ) ;
bag.add("item1") ;
bag.add("item2") ;
bag.add("item2") ;
bag.add("item3") ;
bag.add("item3") ;
bag.add("item3") ;
var col:Collection = new ArrayCollection(["item1","item2","item3"]) ;
bag.retainAll(col) ;
trace( bag ) ; // {1:item1,2:item2}
Parameters
c:Collection — the collection to retain.
|
Boolean — true if this call changed the collection.
|
| retainAllInBag | () | method |
public function retainAllInBag(b:Bag):BooleanRemoves any members of the bag that are not in the given bag, respecting cardinality.
Parameters
b:Bag — the bag to retain.
|
Boolean — true if this call changed the collection.
|
| size | () | method |
public function size():uintReturns the number of elements in this bag (its cardinality).
Returnsuint — the number of elements in this bag (its cardinality).
|
| toArray | () | method |
public function toArray():ArrayReturns the array representation of the bag.
ReturnsArray — the array representation of the bag.
|
| toSource | () | method |
public function toSource(indent:int = 0):StringReturns the source code string representation of the object.
Parameters
indent:int (default = 0) |
String — the source code string representation of the object.
|
| toString | () | method |
public function toString():StringReturns the string representation of this instance.
ReturnsString — the string representation of this instance.
|
| uniqueSet | () | method |
public function uniqueSet():SetReturns the Set of unique members that represent all members in the bag.
ReturnsSet — the Set of unique members that represent all members in the bag.
|