Package ghidra.util.search.trie
Class ByteTrieNode<T>
- java.lang.Object
-
- ghidra.util.search.trie.ByteTrieNode<T>
-
- Type Parameters:
T
- the user item type
- All Implemented Interfaces:
ByteTrieNodeIfc<T>
- Direct Known Subclasses:
CaseInsensitiveByteTrieNode
public class ByteTrieNode<T> extends java.lang.Object implements ByteTrieNodeIfc<T>
Class to represent a (possibly non-terminal!) node within the ByteTrie.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteTrieNode<T>
getChild(byte value)
Returns the child node (successor in the byte sequence) which has byte value, or null if no such child exists.protected byte
getId()
Returns the final byte in the byte sequence represented by this node (fast, but uses a bitmask).T
getItem()
Returns the user item stored in a terminal node (or null in an internal node).byte[]
getValue()
Returns a new byte array with the value of the byte sequence represented by this node (slow, built from scratch every time).boolean
isTerminal()
Returns whether this node represents a byte sequence in the trie or just an internal node on our way down to one.int
length()
Returns the length of the byte sequence represented by this node (cached integer, very fast).java.lang.String
toString()
protected byte
transformByte(byte v)
-
-
-
Method Detail
-
transformByte
protected byte transformByte(byte v)
-
isTerminal
public boolean isTerminal()
Returns whether this node represents a byte sequence in the trie or just an internal node on our way down to one.- Specified by:
isTerminal
in interfaceByteTrieNodeIfc<T>
- Returns:
- whether this node represents a terminal value
-
getItem
public T getItem()
Returns the user item stored in a terminal node (or null in an internal node).- Specified by:
getItem
in interfaceByteTrieNodeIfc<T>
- Returns:
- the user item
-
length
public int length()
Returns the length of the byte sequence represented by this node (cached integer, very fast).- Specified by:
length
in interfaceByteTrieNodeIfc<T>
- Returns:
- the length of the byte sequence
-
getValue
public byte[] getValue()
Returns a new byte array with the value of the byte sequence represented by this node (slow, built from scratch every time).- Specified by:
getValue
in interfaceByteTrieNodeIfc<T>
- Returns:
- the byte sequence
-
getId
protected byte getId()
Returns the final byte in the byte sequence represented by this node (fast, but uses a bitmask).- Returns:
- the final byte in the byte sequence
-
getChild
public ByteTrieNode<T> getChild(byte value)
Returns the child node (successor in the byte sequence) which has byte value, or null if no such child exists.- Parameters:
value
- the byte value- Returns:
- the child node if present or null
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-