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
Class to represent a (possibly non-terminal!) node within the ByteTrie.
-
Method Summary
Modifier and TypeMethodDescriptiongetChild
(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).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
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).toString()
protected byte
transformByte
(byte v)
-
Method Details
-
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
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
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
-