public class Trie
extends java.lang.Object
Actually, what is stored are words with their respective patch commands. A trie can be termed forward (keys read from left to right) or backward (keys read from right to left). This property will vary depending on the language for which a Trie is constructed.
Constructor and Description |
---|
Trie(boolean forward)
Constructor for the Trie object.
|
Trie(boolean forward,
int root,
java.util.List<java.lang.CharSequence> cmds,
java.util.List<Row> rows)
Constructor for the Trie object.
|
Trie(java.io.DataInput is)
Constructor for the Trie object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.CharSequence[] |
getAll(java.lang.CharSequence key)
Gets the all attribute of the Trie object
|
int |
getCells()
Return the number of cells in this Trie object.
|
int |
getCellsPnt()
Gets the cellsPnt attribute of the Trie object
|
int |
getCellsVal()
Gets the cellsVal attribute of the Trie object
|
java.lang.CharSequence |
getFully(java.lang.CharSequence key)
Return the element that is stored in a cell associated with the given key.
|
java.lang.CharSequence |
getLastOnPath(java.lang.CharSequence key)
Return the element that is stored as last on a path associated with the
given key.
|
void |
printInfo(java.io.PrintStream out,
java.lang.CharSequence prefix)
writes debugging info to the printstream
|
Trie |
reduce(Reduce by)
Remove empty rows from the given Trie and return the newly reduced Trie.
|
void |
store(java.io.DataOutput os)
Write this Trie to the given output stream.
|
public Trie(java.io.DataInput is) throws java.io.IOException
is
- the input streamjava.io.IOException
- if an I/O error occurspublic Trie(boolean forward)
forward
- set to truepublic Trie(boolean forward, int root, java.util.List<java.lang.CharSequence> cmds, java.util.List<Row> rows)
forward
- true if read left to right, false if read
right to leftroot
- index of the row that is the root nodecmds
- the patch commands to storerows
- a Vector of Vectors. Each inner Vector is a node of this Triepublic java.lang.CharSequence[] getAll(java.lang.CharSequence key)
key
- Description of the Parameterpublic int getCells()
public int getCellsPnt()
public int getCellsVal()
public java.lang.CharSequence getFully(java.lang.CharSequence key)
key
- the keypublic java.lang.CharSequence getLastOnPath(java.lang.CharSequence key)
key
- the key associated with the desired elementpublic void store(java.io.DataOutput os) throws java.io.IOException
os
- the output streamjava.io.IOException
- if an I/O error occurspublic Trie reduce(Reduce by)
by
- the Trie to reducepublic void printInfo(java.io.PrintStream out, java.lang.CharSequence prefix)
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.