Packagecom.gestureworks.cml.utils
Classpublic class LinkedMap
InheritanceLinkedMap Inheritance flash.utils.Proxy
Subclasses ChildList

The LinkedMap utility is a data structure that creates an ordered map that can store duplicate keys. It has a built-in two-way iterator, and contains many options for storing and retrieving values.

The structure is comprised of:

        
        var lm:LinkedMap = new LinkedMap();
        lm.append("s1", new Sprite());
        lm.append("s2", new TouchSprite());
        
        lm.reset();
        trace(lm.next());
     
     

See also

List


Public Properties
 PropertyDefined By
  currentIndex : int
Returns and sets the current index
LinkedMap
  currentKey : *
[read-only] Returns the current key
LinkedMap
  currentValue : *
[read-only] Returns the current value
LinkedMap
  index : int
Returns and sets the current index
LinkedMap
  key : *
[read-only] Returns the current key
LinkedMap
  length : int
[read-only] Returns the length of the LinkedMap
LinkedMap
  value : *
[read-only] Returns the current value
LinkedMap
Public Methods
 MethodDefined By
  
LinkedMap(weakKeys:Boolean = false)
Constructor
LinkedMap
  
append(key:*, value:*):void
Appends a value to the keys
LinkedMap
  
getIndex(index:int):*
Returns the value by index
LinkedMap
  
getKey(key:*):*
Returns the value by key
LinkedMap
  
getKeyArray():Array
Returns an array of keys.
LinkedMap
  
Returns an array of values
LinkedMap
  
hasKey(key:*):Boolean
Returns true if key exists
LinkedMap
  
hasNext():Boolean
Returns true if the iteration can return one more than the current index
LinkedMap
  
hasPrev():Boolean
Returns true if the iteration can return one less than the current index
LinkedMap
  
hasValue(value:*):Boolean
Returns true if value exists
LinkedMap
  
insert(index:int, key:*, value:*):void
Inserts a new key and value by index
LinkedMap
  
next():*
Returns the next value
LinkedMap
  
prepend(key:*, value:*):void
Prepends a key and value
LinkedMap
  
prev():*
Returns the previous index
LinkedMap
  
remove():void
Removes a key, value at current index
LinkedMap
  
removeByValue(value:*):void
Removes a key, value pair by value
LinkedMap
  
removeIndex(index:int):void
Removes a key, value pair by index
LinkedMap
  
removeKey(key:*):void
Removes a key, value pair by key
LinkedMap
  
replace(key:*, value:*):void
Replaces a key, value pair at the current index
LinkedMap
  
replaceKey(key:*, value:*):void
Replaces a value by key.
LinkedMap
  
reset():void
Resets the current index to zero
LinkedMap
  
search(value:*):int
Searches by value and returns the first index found
LinkedMap
  
searchAll(value:*):Array
Searches by value and returns an array of indices found
LinkedMap
  
selectIndex(index:int):*
Returns a value by index and increments the current index to the provided index parameter
LinkedMap
  
selectKey(key:*):*
Returns a value by key and increments the current index to the provided index parameter
LinkedMap
  
toArray():Array
Returns a multidimensional array of key / value pairs
LinkedMap
Protected Methods
 MethodDefined By
  
deleteProperty(name:*):Boolean
[override]
LinkedMap
  
getProperty(name:*):*
[override]
LinkedMap
  
hasProperty(name:*):Boolean
[override]
LinkedMap
  
nextName(index:int):String
[override]
LinkedMap
  
nextNameIndex(index:int):int
[override]
LinkedMap
  
nextValue(index:int):*
[override]
LinkedMap
Property Detail
currentIndexproperty
currentIndex:int

Returns and sets the current index


Implementation
    public function get currentIndex():int
    public function set currentIndex(value:int):void
currentKeyproperty 
currentKey:*  [read-only]

Returns the current key


Implementation
    public function get currentKey():*
currentValueproperty 
currentValue:*  [read-only]

Returns the current value


Implementation
    public function get currentValue():*
indexproperty 
index:int

Returns and sets the current index


Implementation
    public function get index():int
    public function set index(value:int):void
keyproperty 
key:*  [read-only]

Returns the current key


Implementation
    public function get key():*
lengthproperty 
length:int  [read-only]

Returns the length of the LinkedMap


Implementation
    public function get length():int
valueproperty 
value:*  [read-only]

Returns the current value


Implementation
    public function get value():*
Constructor Detail
LinkedMap()Constructor
public function LinkedMap(weakKeys:Boolean = false)

Constructor

Parameters
weakKeys:Boolean (default = false)
Method Detail
append()method
public function append(key:*, value:*):void

Appends a value to the keys

Parameters

key:*
 
value:*

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

Parameters

name:*

Returns
Boolean
getIndex()method 
public function getIndex(index:int):*

Returns the value by index

Parameters

index:int

Returns
*
getKey()method 
public function getKey(key:*):*

Returns the value by key

Parameters

key:*

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

Returns an array of keys.

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

Parameters

name:*

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

Returns an array of values

Returns
Array
hasKey()method 
public function hasKey(key:*):Boolean

Returns true if key exists

Parameters

key:*

Returns
Boolean
hasNext()method 
public function hasNext():Boolean

Returns true if the iteration can return one more than the current index

Returns
Boolean
hasPrev()method 
public function hasPrev():Boolean

Returns true if the iteration can return one less than the current index

Returns
Boolean
hasProperty()method 
override flash_proxy function hasProperty(name:*):Boolean

Parameters

name:*

Returns
Boolean
hasValue()method 
public function hasValue(value:*):Boolean

Returns true if value exists

Parameters

value:*

Returns
Boolean
insert()method 
public function insert(index:int, key:*, value:*):void

Inserts a new key and value by index

Parameters

index:int
 
key:*
 
value:*

next()method 
public function next():*

Returns the next value

Returns
*
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
*
prepend()method 
public function prepend(key:*, value:*):void

Prepends a key and value

Parameters

key:*
 
value:*

prev()method 
public function prev():*

Returns the previous index

Returns
*
remove()method 
public function remove():void

Removes a key, value at current index

removeByValue()method 
public function removeByValue(value:*):void

Removes a key, value pair by value

Parameters

value:*

removeIndex()method 
public function removeIndex(index:int):void

Removes a key, value pair by index

Parameters

index:int

removeKey()method 
public function removeKey(key:*):void

Removes a key, value pair by key

Parameters

key:*

replace()method 
public function replace(key:*, value:*):void

Replaces a key, value pair at the current index

Parameters

key:*
 
value:*

replaceKey()method 
public function replaceKey(key:*, value:*):void

Replaces a value by key. If more than one key is found. The first instance will be replaced. To replace all keys, repeatedly call replaceKey until key is no longer found.

Parameters

key:*
 
value:*

reset()method 
public function reset():void

Resets the current index to zero

search()method 
public function search(value:*):int

Searches by value and returns the first index found

Parameters

value:*

Returns
int
searchAll()method 
public function searchAll(value:*):Array

Searches by value and returns an array of indices found

Parameters

value:*

Returns
Array
selectIndex()method 
public function selectIndex(index:int):*

Returns a value by index and increments the current index to the provided index parameter

Parameters

index:int

Returns
*
selectKey()method 
public function selectKey(key:*):*

Returns a value by key and increments the current index to the provided index parameter

Parameters

key:*

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

Returns a multidimensional array of key / value pairs

Returns
Array