Package ghidra.util.datastruct
Class RedBlackLongKeySet
- java.lang.Object
- 
- ghidra.util.datastruct.RedBlackLongKeySet
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class RedBlackLongKeySet extends java.lang.Object implements java.io.SerializableA RedBlack Tree implementation of a long key set.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intNODESIZEthe number of bytes in a RedBlackLongKeySet node
 - 
Constructor SummaryConstructors Constructor Description RedBlackLongKeySet()Creates a new RedBlackLongKeySet that can store keys between 0 and n.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(long key)Returns true if the key is in the set.longgetFirst()Returns the first key in this set.longgetLast()Returns the last key in this set.longgetNext(long key)Returns the smallest key in the set that is greater than the given key.longgetPrevious(long key)Returns the largest key in the set that is less than the given key.booleanisEmpty()Test if the set is empty.voidput(long key)Adds the given key to the set.booleanremove(long key)Removes the given key from the set.voidremoveAll()Removes all keys from the set.intsize()Returns the number keys in this set.
 
- 
- 
- 
Field Detail- 
NODESIZEpublic static final int NODESIZE the number of bytes in a RedBlackLongKeySet node- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
sizepublic int size() Returns the number keys in this set.
 - 
containsKeypublic boolean containsKey(long key) Returns true if the key is in the set.- Parameters:
- key- the key whose presence is to be tested.
- Throws:
- java.lang.IndexOutOfBoundsException- thrown if the given key is not in the range [0, maxKey].
 
 - 
getFirstpublic long getFirst() Returns the first key in this set.
 - 
getLastpublic long getLast() Returns the last key in this set.
 - 
getNextpublic 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:
- java.lang.IndexOutOfBoundsException- thrown if the given key is not in the range [0, maxKey].
 
 - 
getPreviouspublic 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:
- java.lang.IndexOutOfBoundsException- thrown if the given key is not in the range [0, maxKey].
 
 - 
putpublic void put(long key) Adds the given key to the set.- Parameters:
- key- the key to add to the set.
- Throws:
- java.lang.IndexOutOfBoundsException- thrown if the given key is not in the range [0, maxKey].
 
 - 
removepublic boolean remove(long key) Removes the given key from the set.- Parameters:
- key- the key to remove from the set.
- Throws:
- java.lang.IndexOutOfBoundsException- thrown if the given key is not in the range [0, maxKey].
 
 - 
removeAllpublic void removeAll() Removes all keys from the set.
 - 
isEmptypublic boolean isEmpty() Test if the set is empty.- Returns:
- true if the set is empty.
 
 
- 
 
-