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 Object implements ByteTrieNodeIfc<T>
Class to represent a (possibly non-terminal!) node within the ByteTrie.

- ## Method Summary

  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).
  `String`
  `toString()`
  `protected byte`
  `transformByte(byte v)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 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 interface `ByteTrieNodeIfc<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 interface `ByteTrieNodeIfc<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 interface `ByteTrieNodeIfc<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 interface `ByteTrieNodeIfc<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 String toString()
    Overrides:
      `toString` in class `Object`