Class RedBlackLongKeySet

java.lang.Object
ghidra.util.datastruct.RedBlackLongKeySet
All Implemented Interfaces:
Serializable

public class RedBlackLongKeySet extends Object implements Serializable
A RedBlack Tree implementation of a long key set.
See Also:
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final int
    the number of bytes in a RedBlackLongKeySet node
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Creates a new RedBlackLongKeySet that can store keys between 0 and n.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    boolean
    containsKey(long key)
    Returns true if the key is in the set.
    long
    Returns the first key in this set.
    long
    Returns the last key in this set.
    long
    getNext(long key)
    Returns the smallest key in the set that is greater than the given key.
    long
    getPrevious(long key)
    Returns the largest key in the set that is less than the given key.
    boolean
    Test if the set is empty.
    void
    put(long key)
    Adds the given key to the set.
    boolean
    remove(long key)
    Removes the given key from the set.
    void
    Removes all keys from the set.
    int
    Returns the number keys in this set.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

    • NODESIZE Link icon

      public static final int NODESIZE
      the number of bytes in a RedBlackLongKeySet node
      See Also:
  • Constructor Details Link icon

    • RedBlackLongKeySet Link icon

      public RedBlackLongKeySet()
      Creates a new RedBlackLongKeySet that can store keys between 0 and n.
  • Method Details Link icon

    • size Link icon

      public int size()
      Returns the number keys in this set.
    • containsKey Link icon

      public boolean containsKey(long key)
      Returns true if the key is in the set.
      Parameters:
      key - the key whose presence is to be tested.
      Throws:
      IndexOutOfBoundsException - thrown if the given key is not in the range [0, maxKey].
    • getFirst Link icon

      public long getFirst()
      Returns the first key in this set.
    • getLast Link icon

      public long getLast()
      Returns the last key in this set.
    • getNext Link icon

      public long getNext(long key)
      Returns the smallest key in the set that is greater than the given key. Returns -1 if there are no keys greater than the given key.
      Parameters:
      key - the key for which to find the next key after.
      Throws:
      IndexOutOfBoundsException - thrown if the given key is not in the range [0, maxKey].
    • getPrevious Link icon

      public long getPrevious(long key)
      Returns the largest key in the set that is less than the given key. Returns -1 if there are not keys less than the given key.
      Parameters:
      key - the key for which to find the previous key.
      Throws:
      IndexOutOfBoundsException - thrown if the given key is not in the range [0, maxKey].
    • put Link icon

      public void put(long key)
      Adds the given key to the set.
      Parameters:
      key - the key to add to the set.
      Throws:
      IndexOutOfBoundsException - thrown if the given key is not in the range [0, maxKey].
    • remove Link icon

      public boolean remove(long key)
      Removes the given key from the set.
      Parameters:
      key - the key to remove from the set.
      Throws:
      IndexOutOfBoundsException - thrown if the given key is not in the range [0, maxKey].
    • removeAll Link icon

      public void removeAll()
      Removes all keys from the set.
    • isEmpty Link icon

      public boolean isEmpty()
      Test if the set is empty.
      Returns:
      true if the set is empty.