Package | org.as3collections.maps |
Class | public class TypedListMap |
Inheritance | TypedListMap TypedMap Object |
Implements | IListMap |
Subclasses | TypedSortedMap |
TypedSortedMap
works as a wrapper for a map.
It stores the wrapMap
constructor's argument in the wrappedMap
variable.
So every method call to this class is forwarded to the wrappedMap
object.
The methods that need to be checked for the type of the keys and values are previously validated with the validateKeyType
, validateValueType
or validateMap
method before forward the call.
If the type of a key or value requested to be inserted to this map is incompatible with the type of the map a org.as3coreaddendum.errors.ClassCastError
is thrown.
The calls that are forwarded to the wrappedMap
returns the return of the wrappedMap
call.
TypedSortedMap
does not allow null
keys or values.
See also
Property | Defined By | ||
---|---|---|---|
allKeysEquatable : Boolean [read-only]
Indicates whether all keys in this map implements org.as3coreaddendum.system.IEquatable interface. | TypedMap | ||
allValuesEquatable : Boolean [read-only]
Indicates whether all values in this map implements org.as3coreaddendum.system.IEquatable interface. | TypedMap | ||
modCount : int [read-only]
Returns the return of the call wrapMap.modCount. | TypedListMap | ||
typeKeys : * [read-only]
Defines the acceptable type of the keys by this map. | TypedMap | ||
typeValues : * [read-only]
Defines the acceptable type of the values by this map. | TypedMap |
Method | Defined By | ||
---|---|---|---|
TypedListMap(wrapMap:IListMap, typeKeys:*, typeValues:*)
Constructor, creates a new TypedSortedMap object. | TypedListMap | ||
clear():void
Forwards the call to wrappedMap.clear. | TypedMap | ||
clone():* [override]
Creates and return a new TypedListMap object with the clone of the wrappedMap object. | TypedListMap | ||
containsKey(key:*):Boolean
Forwards the call to wrappedMap.containsKey. | TypedMap | ||
containsValue(value:*):Boolean
Forwards the call to wrappedMap.containsValue. | TypedMap | ||
Forwards the call to wrappedMap.entryCollection. | TypedMap | ||
equals(other:*):Boolean
This method uses MapUtil.equalNotConsideringOrder or MapUtil.equalConsideringOrder method to perform equality, sending this map and other argument. | TypedMap | ||
getKeyAt(index:int):*
Forwards the call to wrappedMap.getKeyAt. | TypedListMap | ||
Forwards the call to wrappedMap.getKeys. | TypedMap | ||
getValue(key:*):*
Forwards the call to wrappedMap.getValue. | TypedMap | ||
getValueAt(index:int):*
Forwards the call to wrappedMap.getValueAt. | TypedListMap | ||
Forwards the call to wrappedMap.getValues. | TypedMap | ||
Forwards the call to wrappedMap.headMap. | TypedListMap | ||
indexOfKey(key:*):int
Forwards the call to wrappedMap.indexOfKey. | TypedListMap | ||
indexOfValue(value:*):int
Forwards the call to wrappedMap.indexOfValue. | TypedListMap | ||
isEmpty():Boolean
Forwards the call to wrappedMap.isEmpty. | TypedMap | ||
Forwards the call to wrappedMap.iterator. | TypedMap | ||
listMapIterator(index:int = 0):IListMapIterator
Returns a IListMapIterator object to iterate over the mappings in this map (in proper sequence), starting at the specified position in this map. | TypedListMap | ||
put(key:*, value:*):*
The key and value are validated with the validateKeyType and validateValueType methods to be forwarded to wrappedMap.put. | TypedMap | ||
The map is validated with the validateMap method to be forwarded to wrappedMap.putAll. | TypedMap | ||
The map is validated to be forwarded to wrappedMap.putAllAt. | TypedListMap | ||
putAllByObject(o:Object):void
The objects is validated to be forwarded to wrappedMap.putAllByObject. | TypedMap | ||
putAt(index:int, key:*, value:*):void
The key and value are validated to be forwarded to wrappedMap.putAt. | TypedListMap | ||
The entry is validated with the validateKeyType and validateValueType methods to be forwarded to wrappedMap.putEntry. | TypedMap | ||
remove(key:*):*
Forwards the call to wrappedMap.remove. | TypedMap | ||
removeAll(keys:ICollection):Boolean
Forwards the call to wrappedMap.removeAll. | TypedMap | ||
Forwards the call to wrappedMap.removeAt. | TypedListMap | ||
removeRange(fromIndex:int, toIndex:int):IListMap
Forwards the call to wrappedMap.removeRange. | TypedListMap | ||
retainAll(keys:ICollection):Boolean
Forwards the call to wrappedMap.retainAll. | TypedMap | ||
reverse():void
Forwards the call to wrappedMap.reverse. | TypedListMap | ||
setKeyAt(index:int, key:*):*
The key is validated to be forwarded to wrappedMap.setKeyAt. | TypedListMap | ||
setValueAt(index:int, value:*):*
The value is validated to be forwarded to wrappedMap.setValueAt. | TypedListMap | ||
size():int
Forwards the call to wrappedMap.size. | TypedMap | ||
Forwards the call to wrappedMap.subMap. | TypedListMap | ||
Forwards the call to wrappedMap.tailMap. | TypedListMap | ||
toString():String
Returns the string representation of this instance. | TypedMap |
modCount | property |
modCount:int
[read-only]
Returns the return of the call wrapMap.modCount
.
public function get modCount():int
TypedListMap | () | Constructor |
public function TypedListMap(wrapMap:IListMap, typeKeys:*, typeValues:*)
Constructor, creates a new TypedSortedMap
object.
wrapMap:IListMap — the target map to wrap.
| |
typeKeys:* — the type of the keys allowed by this map.
| |
typeValues:* — the type of the values allowed by this map.
|
ArgumentError — if the wrapMap argument is null .
| |
ArgumentError — if the typeKeys argument is null .
| |
ArgumentError — if the typeValues argument is null .
| |
org.as3coreaddendum.errors:ClassCastError — if the types of one or more keys or values in the wrapMap argument are incompatible with the typeKeys or typeValues argument.
|
clone | () | method |
override public function clone():*
Creates and return a new TypedListMap
object with the clone of the wrappedMap
object.
* — a new TypedListMap object with the clone of the wrappedMap object.
|
getKeyAt | () | method |
public function getKeyAt(index:int):*
Forwards the call to wrappedMap.getKeyAt
.
Parameters
index:int |
* —
|
getValueAt | () | method |
public function getValueAt(index:int):*
Forwards the call to wrappedMap.getValueAt
.
Parameters
index:int |
* —
|
headMap | () | method |
public function headMap(toKey:*):IListMap
Forwards the call to wrappedMap.headMap
.
Parameters
toKey:* |
IListMap —
|
indexOfKey | () | method |
public function indexOfKey(key:*):int
Forwards the call to wrappedMap.indexOfKey
.
Parameters
key:* |
int —
|
indexOfValue | () | method |
public function indexOfValue(value:*):int
Forwards the call to wrappedMap.indexOfValue
.
Parameters
value:* |
int —
|
listMapIterator | () | method |
public function listMapIterator(index:int = 0):IListMapIterator
Returns a IListMapIterator
object to iterate over the mappings in this map (in proper sequence), starting at the specified position in this map.
The specified index indicates the first value that would be returned by an initial call to next
.
An initial call to previous
would return the value with the specified index minus one.
This implementation always throws an UnsupportedOperationError
.
Parameters
index:int (default = 0 ) — index of first value to be returned from the iterator (by a call to the next method)
|
IListMapIterator — a IListMapIterator object to iterate over the mappings in this map (in proper sequence), starting at the specified position in this map.
|
putAllAt | () | method |
public function putAllAt(index:int, map:IMap):void
The map is validated to be forwarded to wrappedMap.putAllAt
.
Parameters
index:int | |
map:IMap |
putAt | () | method |
public function putAt(index:int, key:*, value:*):void
The key and value are validated to be forwarded to wrappedMap.putAt
.
Parameters
index:int — index at which the specified mapping is to be inserted.
| |
key:* — key with which the specified value is to be associated.
| |
value:* — value to be associated with the specified key.
|
org.as3coreaddendum.errors:ClassCastError — if the type of the specified key or value is incompatible with this map.
|
removeAt | () | method |
public function removeAt(index:int):IMapEntry
Forwards the call to wrappedMap.removeAt
.
Parameters
index:int |
IMapEntry |
removeRange | () | method |
public function removeRange(fromIndex:int, toIndex:int):IListMap
Forwards the call to wrappedMap.removeRange
.
Parameters
fromIndex:int | |
toIndex:int |
IListMap — the return of the call wrappedMap.removeRange .
|
reverse | () | method |
public function reverse():void
Forwards the call to wrappedMap.reverse
.
setKeyAt | () | method |
public function setKeyAt(index:int, key:*):*
The key is validated to be forwarded to wrappedMap.setKeyAt
.
Parameters
index:int | |
key:* — the key to forward to wrappedMap.setKeyAt .
|
* — the return of the call wrappedMap.setKeyAt .
|
org.as3coreaddendum.errors:ClassCastError — if the type of the specified key or value is incompatible with this map.
|
setValueAt | () | method |
public function setValueAt(index:int, value:*):*
The value is validated to be forwarded to wrappedMap.setValueAt
.
Parameters
index:int | |
value:* — the key to forward to wrappedMap.setValueAt .
|
* — the return of the call wrappedMap.setValueAt .
|
org.as3coreaddendum.errors:ClassCastError — if the type of the specified key or value is incompatible with this map.
|
subMap | () | method |
public function subMap(fromIndex:int, toIndex:int):IListMap
Forwards the call to wrappedMap.subMap
.
Parameters
fromIndex:int | |
toIndex:int |
IListMap —
|
tailMap | () | method |
public function tailMap(fromKey:*):IListMap
Forwards the call to wrappedMap.tailMap
.
Parameters
fromKey:* |
IListMap —
|
import org.as3collections.ISortedMap; import org.as3collections.maps.SortedArrayListMap; import org.as3collections.maps.TypedSortedMap; var map1:ISortedMap = new SortedArrayListMap(); map1.put("e", 1) // null map1.put("d", 2) // null map1.put("c", 3) // null map1.put("b", 4) // null map1.put("a", 5) // null map1 // {a=5,b=4,c=3,d=2,e=1} map1.size() // 5 var map2:ISortedMap = new TypedSortedMap(map1, String, Number); // you can use this way //var map2:ISortedMap = MapUtil.getTypedSortedMap(map1, String, Number); // or you can use this way map2 // {a=5,b=4,c=3,d=2,e=1} map2.size() // 5 map2.equals(map1) // false map2.put("f", 6) // null map2 // {a=5,b=4,c=3,d=2,e=1,f=6} map2.size() // 6 map2.put("g", "h") // ClassCastError: Invalid value type. value: h | type: String | expected value type: Number map2.put(7, 8) // ClassCastError: Invalid key type. key: 7 | type: int | expected key type: String