lexx.trie
Class TrieNode

java.lang.Object
  |
  +--lexx.trie.TrieNode
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, Trie
Direct Known Subclasses:
RootNode

public class TrieNode
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, Trie

Create a Trie data structure

The purpose of this class is to produce a tree like structure for accessing text quickly

Copyright (c) 2002-2003

Since:
18/02/2003
Version:
1.0
Author:
Mohammed Imran
See Also:
Serialized Form

Field Summary
(package private)  CharMapBase childNodes
           
(package private)  char letter
           
(package private)  int level
           
(package private)  java.lang.Object obj
           
 
Constructor Summary
  TrieNode()
           
protected TrieNode(java.lang.String key, java.lang.Object _obj, int _level, boolean isMutable)
           
 
Method Summary
(package private)  void add(java.lang.String key, java.lang.Object _obj, int _level, boolean isMutable)
           
static void clearMutableObjectList()
           
 java.lang.Object clone()
           
(package private)  java.lang.Object cloneToDisk(java.lang.String dir, int maxLevel)
           
 java.util.Vector getAllNodes()
          Returns all the objects node and all its sub-nodes
 java.util.List getCurrentObjects()
          As Trie can have multiple objects with the same key, instead of returning an object, it returns a list of objects
 Trie getNode(java.lang.String key)
          Returns a specific sub-tree
 java.lang.Object getObject()
           
 boolean isLeaf()
           
 boolean isSingleLeaf()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

obj

java.lang.Object obj

level

int level

childNodes

CharMapBase childNodes

letter

char letter
Constructor Detail

TrieNode

protected TrieNode(java.lang.String key,
                   java.lang.Object _obj,
                   int _level,
                   boolean isMutable)

TrieNode

public TrieNode()
Method Detail

clearMutableObjectList

public static void clearMutableObjectList()

clone

public java.lang.Object clone()
Specified by:
clone in interface Trie
Overrides:
clone in class java.lang.Object

cloneToDisk

java.lang.Object cloneToDisk(java.lang.String dir,
                             int maxLevel)

getCurrentObjects

public final java.util.List getCurrentObjects()
As Trie can have multiple objects with the same key, instead of returning an object, it returns a list of objects

Specified by:
getCurrentObjects in interface Trie
Returns:
list of objects

add

final void add(java.lang.String key,
               java.lang.Object _obj,
               int _level,
               boolean isMutable)

getObject

public final java.lang.Object getObject()
Specified by:
getObject in interface Trie

isLeaf

public final boolean isLeaf()
Specified by:
isLeaf in interface Trie

isSingleLeaf

public final boolean isSingleLeaf()
Specified by:
isSingleLeaf in interface Trie

getNode

public Trie getNode(java.lang.String key)
Returns a specific sub-tree

Specified by:
getNode in interface Trie
Parameters:
key - sub-tree that has that specific key value
Returns:
Returns a specific sub-tree

getAllNodes

public final java.util.Vector getAllNodes()
Returns all the objects node and all its sub-nodes

Specified by:
getAllNodes in interface Trie
Returns:
Returns all the objects node and all its sub-nodes

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object