Packagesystem.data.maps
Classpublic class MultiSetMap
InheritanceMultiSetMap Inheritance MultiValueMap Inheritance Object

The MultiSetMap is a MutltiMap that contains no duplicate elements in a specified key.

Example :

     import system.data.Collection ;
     import system.data.collections.ArrayCollection ;
     
     import system.data.maps.MultiSetMap ;
     
     var s:MultiSetMap = new MultiSetMap() ;
     
     trace("----- Test put()") ;
     
     trace("insert key1:valueA1 : " + s.put("key1", "valueA1")) ;
     trace("insert key1:valueA2 : " + s.put("key1", "valueA2"))
     trace("insert key1:valueA2 : " + s.put("key1", "valueA2")) ;
     trace("insert key1:valueA3 : " + s.put("key1", "valueA3")) ;
     trace("insert key2:valueA2 : " + s.put("key2", "valueA2")) ;
     trace("insert key2:valueB1 : " + s.put("key2", "valueB1")) ;
     trace("insert key2:valueB2 : " + s.put("key2", "valueB2")) ;
     
     trace("size : " + s.size()) ;
     trace("totalSize : " + s.totalSize()) ;
     
     trace("---- Test toArray") ;
     
     var ar:Array = s.toArray() ;
     trace("s.toArray : " + ar) ;
     
     trace("----- Test contains") ;
     
     trace("contains valueA1 : " + s.contains("valueA1") ) ;
     trace("contains valueA1 in key1 : " + s.containsByKey("key1", "valueA1") ) ;
     trace("contains valueA1 in key2 : " + s.containsByKey("key2", "valueA1") ) ;
     
     trace("---- Test removeBy(key, value)") ;
     
     trace("remove key1:valueA2 : " + s.removeByKey("key1", "valueA2")) ;
     trace("insert key1:valueA2 : " + s.put("key1", "valueA2")) ;
     trace("insert key1:valueA2 : " + s.put("key1", "valueA2")) ;
     
     trace("---- Test remove(key)") ;
     
     trace("remove key2 : " + s.remove("key2")) ;
     trace("size : " + s.size()) ;
     
     trace("---- Test putCollection(key, co:Collection)") ;
     
     var co:Collection = new ArrayCollection(["valueA1", "valueA4", "valueA1"]) ;
     
     s.putCollection("key1", co) ;
     
     trace("s : " + s) ;
     

See also

system.data.MultiMap


Public Properties
 PropertyDefined By
  internalBuildClass : Class
[override] Determinates the internal build class used in the createCollection() method to create a new collection to register all values with a new key.
MultiSetMap
Public Methods
 MethodDefined By
  
MultiSetMap(map:Map = null, factory:* = null)
Creates a new MultiSetMap instance.
MultiSetMap
  
clear():void
[override] This clears each collection in the map, and so may be slow.
MultiSetMap
  
clone():*
[override] Returns the shallow copy of this object.
MultiSetMap
  
contains(o:*):Boolean
Checks whether the map contains the value specified .
MultiSetMap
  
containsByKey(key:*, value:*):Boolean
Checks whether the map contains the value specified with the specified key.
MultiSetMap
 Inherited
containsKey(key:*):Boolean
Checks whether the map contains the key specified.
MultiValueMap
 Inherited
containsValue(value:*):Boolean
Checks whether the map contains the value specified.
MultiValueMap
 Inherited
containsValueByKey(key:*, value:*):Boolean
Checks whether the map contains the value specified or at the specified key contains the value.
MultiValueMap
 Inherited
Creates a new instance of the map value Collection container.
MultiValueMap
 Inherited
get(key:*):*
Gets the collection mapped to the specified key.
MultiValueMap
 Inherited
Gets the collection mapped to the specified key.
MultiValueMap
 Inherited
getKeys():Array
Returns an Array containing the combination of all keys in the Map.
MultiValueMap
  
getSet(key:*):Set
Returns the Set defined in the map with the specified key.
MultiSetMap
 Inherited
getValues():Array
Returns an Array containing the combination of values from all keys.
MultiValueMap
 Inherited
isEmpty():Boolean
Returns whether this object contains any mappings.
MultiValueMap
 Inherited
Returns the Iterator representation of the object.
MultiValueMap
 Inherited
Gets an Iterator for the collection mapped to the specified key.
MultiValueMap
 Inherited
Gets an iterator for the map to iterate keys.
MultiValueMap
  
put(key:*, value:*):*
[override] Adds the value to the Set associated with the specified key.
MultiSetMap
 Inherited
putAll(map:Map):void
Override superclass to ensure that MultiMap instances are correctly handled.
MultiValueMap
  
putCollection(key:*, c:Collection):void
[override] Adds a collection of values to the collection associated with the specified key.
MultiSetMap
  
remove(o:*):*
[override] Removes a specific value from map with a specific key.
MultiSetMap
  
removeByKey(key:*, value:*):*
[override] Removes a specific value from map with the specific passed-in key value.
MultiSetMap
 Inherited
size():uint
Returns the size of the collection mapped to the specified key.
MultiValueMap
  
toArray():Array
Returns an Array containing the combination of values from all keys.
MultiSetMap
 Inherited
toSource(indent:int = 0):String
Returns the source code string representation of the object.
MultiValueMap
 Inherited
toString():String
Returns the string representation of this instance.
MultiValueMap
 Inherited
totalSize():uint
Returns the total size of the map by counting all the values.
MultiValueMap
 Inherited
Returns the iterator representation of all Collections register in the MultiValueMap, all collections represents a key.
MultiValueMap
 Inherited
Returns a Collection of all values in the MultiValueMap.
MultiValueMap
 Inherited
Returns an Iterator representation of all values in the MultiValueMap.
MultiValueMap
Property Detail
internalBuildClassproperty
internalBuildClass:Class[override]

Determinates the internal build class used in the createCollection() method to create a new collection to register all values with a new key. The class must implements the Set interface and by default the HashSet class is used.


Implementation
    public function get internalBuildClass():Class
    public function set internalBuildClass(value:Class):void
Constructor Detail
MultiSetMap()Constructor
public function MultiSetMap(map:Map = null, factory:* = null)

Creates a new MultiSetMap instance.

Example :

         import system.data.sets.MultiSetMap ;
         
         var s:MultiSetMap = new MultiSetMap() ;
         
         trace( s ) ;
         

Parameters
map:Map (default = null) — Optional Map reference to initialize and fill this MultiMap.
 
factory:* (default = null) — Optional Map reference to create the internal Map of the MultiSetMap.
Method Detail
clear()method
override public function clear():void

This clears each collection in the map, and so may be slow.

clone()method 
override public function clone():*

Returns the shallow copy of this object.

Returns
* — the shallow copy of this object.
contains()method 
public function contains(o:*):Boolean

Checks whether the map contains the value specified .

Parameters

o:* — the object to search in this instance.

Returns
Booleantrue if the MultiSetMap container the passed-in object.
containsByKey()method 
public function containsByKey(key:*, value:*):Boolean

Checks whether the map contains the value specified with the specified key.

Parameters

key:* — the specified key in the MultiSetMap to search the value.
 
value:* — the object to search in this instance.

Returns
Booleantrue if the MultiSetMap container the passed-in object.
getSet()method 
public function getSet(key:*):Set

Returns the Set defined in the map with the specified key.

Parameters

key:* — the key in the map

Returns
Set — the Set defined in the map with the specified key.
put()method 
override public function put(key:*, value:*):*

Adds the value to the Set associated with the specified key.

Parameters

key:*
 
value:*

Returns
*true if the value is inserted in the object.
putCollection()method 
override public function putCollection(key:*, c:Collection):void

Adds a collection of values to the collection associated with the specified key.

Parameters

key:*
 
c:Collection

remove()method 
override public function remove(o:*):*

Removes a specific value from map with a specific key.

Parameters

o:*

Returns
*
removeByKey()method 
override public function removeByKey(key:*, value:*):*

Removes a specific value from map with the specific passed-in key value.

Note : Use Set implementation and not Map implementation !

Parameters

key:*
 
value:*

Returns
*
toArray()method 
public function toArray():Array

Returns an Array containing the combination of values from all keys.

Returns
Array — an Array containing the combination of values from all keys.