public class Trie extends Object
Constructor and Description |
---|
Trie(boolean forward)
Constructor for the Trie object.
|
Trie(boolean forward,
int root,
ArrayList cmds,
ArrayList rows)
Constructor for the Trie object.
|
Trie(DataInput is)
Constructor for the Trie object.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String key,
String cmd)
Add the given key associated with the given patch command.
|
String[] |
getAll(String 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
|
String |
getFully(String key)
Return the element that is stored in a cell associated with the
given key.
|
String |
getLastOnPath(String key)
Return the element that is stored as last on a path associated with
the given key.
|
static void |
main(String[] args) |
void |
printInfo(String prefix)
Description of the Method
|
Trie |
reduce(Reduce by)
Remove empty rows from the given Trie and return the newly reduced
Trie.
|
void |
store(DataOutput os)
Write this Trie to the given output stream.
|
public Trie(DataInput is) throws IOException
is
- the input streamIOException
public Trie(boolean forward)
forward
- set to truepublic Trie(boolean forward, int root, ArrayList cmds, ArrayList 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 ArrayList of ArrayLists. Each inner ArrayList is a node of
this Triepublic String[] getAll(String key)
key
- Description of the Parameterpublic int getCells()
public int getCellsPnt()
public int getCellsVal()
public String getFully(String key)
key
- the keypublic String getLastOnPath(String key)
key
- the key associated with the desired elementpublic void store(DataOutput os) throws IOException
os
- the output streamIOException
public void add(String key, String cmd)
key
- the keycmd
- the patch commandpublic Trie reduce(Reduce by)
by
- the Trie to reducepublic void printInfo(String prefix)
prefix
- Description of the ParameterCopyright © 2016 Egothor. All Rights Reserved.