org.egothor.stemmer
Class MultiTrie2

java.lang.Object
  extended by org.egothor.stemmer.Trie
      extended by org.egothor.stemmer.MultiTrie
          extended by org.egothor.stemmer.MultiTrie2

public class MultiTrie2
extends MultiTrie

The MultiTrie is a Trie of Tries.

It stores words and their associated patch commands. The MultiTrie handles patch commmands broken into their constituent parts, as a MultiTrie does, but the commands are delimited by the skip command.


Constructor Summary
MultiTrie2(boolean forward)
          Constructor for the MultiTrie2 object
MultiTrie2(DataInput is)
          Constructor for the MultiTrie object.
 
Method Summary
 void add(CharSequence key, CharSequence cmd)
          Add an element to this structure consisting of the given key and patch command.
 CharSequence[] decompose(CharSequence cmd)
          Break the given patch command into its constituent pieces.
 CharSequence getFully(CharSequence key)
          Return the element that is stored in a cell associated with the given key.
 CharSequence getLastOnPath(CharSequence key)
          Return the element that is stored as last on a path belonging to the given key.
 Trie reduce(Reduce by)
          Remove empty rows from the given Trie and return the newly reduced Trie.
 void store(DataOutput os)
          Write this data structure to the given output stream.
 
Methods inherited from class org.egothor.stemmer.MultiTrie
printInfo
 
Methods inherited from class org.egothor.stemmer.Trie
getAll, getCells, getCellsPnt, getCellsVal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiTrie2

public MultiTrie2(DataInput is)
           throws IOException
Constructor for the MultiTrie object.

Parameters:
is - the input stream
Throws:
IOException - if an I/O error occurs

MultiTrie2

public MultiTrie2(boolean forward)
Constructor for the MultiTrie2 object

Parameters:
forward - set to true if the elements should be read left to right
Method Detail

getFully

public CharSequence getFully(CharSequence key)
Return the element that is stored in a cell associated with the given key.

Overrides:
getFully in class MultiTrie
Parameters:
key - the key to the cell holding the desired element
Returns:
the element

getLastOnPath

public CharSequence getLastOnPath(CharSequence key)
Return the element that is stored as last on a path belonging to the given key.

Overrides:
getLastOnPath in class MultiTrie
Parameters:
key - the key associated with the desired element
Returns:
the element that is stored as last on a path

store

public void store(DataOutput os)
           throws IOException
Write this data structure to the given output stream.

Overrides:
store in class MultiTrie
Parameters:
os - the output stream
Throws:
IOException - if an I/O error occurs

add

public void add(CharSequence key,
                CharSequence cmd)
Add an element to this structure consisting of the given key and patch command.

This method will return without executing if the cmd parameter's length is 0.

Overrides:
add in class MultiTrie
Parameters:
key - the key
cmd - the patch command

decompose

public CharSequence[] decompose(CharSequence cmd)
Break the given patch command into its constituent pieces. The pieces are delimited by NOOP commands.

Parameters:
cmd - the patch command
Returns:
an array containing the pieces of the command

reduce

public Trie reduce(Reduce by)
Remove empty rows from the given Trie and return the newly reduced Trie.

Overrides:
reduce in class MultiTrie
Parameters:
by - the Trie to reduce
Returns:
the newly reduced Trie