Packagesystem.data.trees
Classpublic class Trie
InheritanceTrie Inheritance Object

The basic implementation of the Trie data structure.

More informations in wikipedia : Trie



Public Properties
 PropertyDefined By
  aerageClash : Number
[read-only] Indicates the aerage clash value of the trie.
Trie
  entries : Map
Indicates the Map of entries in this trie.
Trie
  entry : TrieEntry
Indicates the trie entry of this trie.
Trie
  numTries : int
[read-only] Indicates the numbers of tries in this trie.
Trie
  position : int
[read-only] Returns the character offset that this trie is off the main trie.
Trie
  previous : Trie
Indicates the previous Trie of this trie.
Trie
Public Methods
 MethodDefined By
  
Trie(parent:Trie = null)
Creates a new Trie instance.
Trie
  
add(key:String, value:*):void
Inserts the provided object into the trie with the given key.
Trie
  
contents(str:String):String
Take current Trie and dump output to StringBuffer
Trie
  
Returns the first element in a trie.
Trie
  
getTrieFor(key:String):*
Returns a Trie of all the elements starting with "key", or an Object which is a single exact match.
Trie
  
isEmpty():Boolean
Indicates if the trie is empty.
Trie
  
remove(key:String):void
Removes the object with the given key from the trie.
Trie
  
search(key:String):*
Returns a trie for multiple matches else returns null for no object matched, or returns the object matched.
Trie
  
searchExact(key:String):*
Returns a trie but 'not' return a Trie for 'multiple matches'.
Trie
  
size():int
Counts the number of linked objects off this trie.
Trie
  
toArray(comparator:Comparator = null):Array
Returns the Array representation of the object.
Trie
  
toString():String
Returns the String representation of the object.
Trie
Property Detail
aerageClashproperty
aerageClash:Number  [read-only]

Indicates the aerage clash value of the trie.


Implementation
    public function get aerageClash():Number
entriesproperty 
entries:Map

Indicates the Map of entries in this trie.


Implementation
    public function get entries():Map
    public function set entries(value:Map):void
entryproperty 
entry:TrieEntry

Indicates the trie entry of this trie.


Implementation
    public function get entry():TrieEntry
    public function set entry(value:TrieEntry):void
numTriesproperty 
numTries:int  [read-only]

Indicates the numbers of tries in this trie.


Implementation
    public function get numTries():int
positionproperty 
position:int  [read-only]

Returns the character offset that this trie is off the main trie.


Implementation
    public function get position():int
previousproperty 
previous:Trie

Indicates the previous Trie of this trie.


Implementation
    public function get previous():Trie
    public function set previous(value:Trie):void
Constructor Detail
Trie()Constructor
public function Trie(parent:Trie = null)

Creates a new Trie instance.

Parameters
parent:Trie (default = null) — This argument is used only inside the class.
Method Detail
add()method
public function add(key:String, value:*):void

Inserts the provided object into the trie with the given key.

Parameters

key:String
 
value:*


Throws
NonUniqueKeyError — If the specified key is non unique.
contents()method 
public function contents(str:String):String

Take current Trie and dump output to StringBuffer

Parameters

str:String

Returns
String — String holding content of current Trie
firstElement()method 
public function firstElement():TrieEntry

Returns the first element in a trie. Is generally only used when an element is erased from the trie and a trie delete a swapup is required.

Returns
TrieEntry — the first element in a trie. Is generally only used when an element is erased from the trie and a trie delete a swapup is required.
getTrieFor()method 
public function getTrieFor(key:String):*

Returns a Trie of all the elements starting with "key", or an Object which is a single exact match.

Parameters

key:String

Returns
* — a Trie of all the elements starting with "key", or an Object which is a single exact match.
isEmpty()method 
public function isEmpty():Boolean

Indicates if the trie is empty.

Returns
Boolean
remove()method 
public function remove(key:String):void

Removes the object with the given key from the trie.

Parameters

key:String

search()method 
public function search(key:String):*

Returns a trie for multiple matches else returns null for no object matched, or returns the object matched.

Parameters

key:String

Returns
* — a trie for multiple matches else returns null for no object matched, or returns the object matched.
searchExact()method 
public function searchExact(key:String):*

Returns a trie but 'not' return a Trie for 'multiple matches'.

Parameters

key:String

Returns
* — a trie but 'not' return a Trie for 'multiple matches'.
size()method 
public function size():int

Counts the number of linked objects off this trie.

Returns
int — The number of linked objects in this trie.
toArray()method 
public function toArray(comparator:Comparator = null):Array

Returns the Array representation of the object.

Parameters

comparator:Comparator (default = null)

Returns
Array — the Array representation of the object.
toString()method 
public function toString():String

Returns the String representation of the object.

Returns
String — the String representation of the object.