public static class Trie.TrieNode extends javax.swing.tree.DefaultMutableTreeNode implements RevisionHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.Character |
STOP
the stop character
|
Constructor and Description |
---|
TrieNode(char c)
initializes the node
|
TrieNode(java.lang.Character c)
initializes the node
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.String suffix)
adds the given string to its children (creates children if necessary)
|
java.lang.Object |
clone()
creates a deep copy of itself
|
boolean |
contains(java.lang.String suffix)
checks whether a suffix can be found in its children
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
Trie.TrieNode |
find(java.lang.String suffix)
returns the node with the given suffix
|
java.lang.Character |
getChar()
returns the stored character
|
java.lang.String |
getCommonPrefix()
returns the common prefix for all the nodes starting with this node.
|
java.lang.String |
getCommonPrefix(java.lang.String startPrefix)
returns the common prefix for all the nodes starting with the node for
the specified prefix.
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.String |
getString()
returns the full string up to the root
|
boolean |
remove(java.lang.String suffix)
Removes a suffix from the trie.
|
void |
setChar(java.lang.Character value)
sets the character this node represents
|
int |
size()
returns the number of stored strings, i.e., leaves
|
java.lang.String |
toString()
returns the node in a string representation
|
add, breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
public TrieNode(char c)
c
- the value of this nodepublic TrieNode(java.lang.Character c)
c
- the value of this nodepublic java.lang.Character getChar()
public void setChar(java.lang.Character value)
value
- the character to storepublic boolean add(java.lang.String suffix)
suffix
- the suffix to add to its childrenpublic boolean remove(java.lang.String suffix)
suffix
- the suffix to removepublic boolean contains(java.lang.String suffix)
suffix
- the suffix to look forpublic java.lang.Object clone()
clone
in class javax.swing.tree.DefaultMutableTreeNode
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to check for equalitypublic Trie.TrieNode find(java.lang.String suffix)
suffix
- the suffix to look forpublic java.lang.String getCommonPrefix()
public java.lang.String getCommonPrefix(java.lang.String startPrefix)
startPrefix
- the prefix of the node to start the search frompublic int size()
public java.lang.String getString()
public java.lang.String toString()
toString
in class javax.swing.tree.DefaultMutableTreeNode
public java.lang.String getRevision()
getRevision
in interface RevisionHandler