Package ghidra.util.datastruct
Class ShortListIndexer
java.lang.Object
ghidra.util.datastruct.ShortListIndexer
- All Implemented Interfaces:
- Serializable
Class to manage multiple linked lists of short indexes. Users can add indexes
 to a list, remove indexes from a list, remove all indexes from a list, and
 retrieve all indexes within a given list.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionshortadd(short listID) Allocates a new index resource and adds it to the front of the linked list indexed by listID.shortappend(short listID) Allocates a new index resource and adds it to the end of the linked list indexed by listID.voidclear()Removes all indexes from all lists.final shortfirst(short listID) Returns the first index resource on the linked list indexed by listID.shortReturns the current index capacity.intgetListSize(short listID) Returns the number of indexes in the specified list.shortComputes the next size that should be used to grow the index capacity.shortReturns the number of linked list being managed.shortgetSize()Returns the current number of used index resources.voidgrowCapacity(short newCapacity) Increases the index resource pool.voidgrowNumLists(short newListSize) Increases the number of managed linked lists.final shortnext(short index) Returns the next index resource that follows the given index in a linked list.voidremove(short listID, short index) Remove the index resource from the linked list indexed by listID.voidremoveAll(short listID) Removes all indexes from the specified list.
- 
Constructor Details- 
ShortListIndexerpublic ShortListIndexer(short numLists, short capacity) The constructor- Parameters:
- numLists- - The initial number of lists to be managed.
- capacity- - The current size of the pool of possible indexes. All indexes begin on the free list.
 
 
- 
- 
Method Details- 
addpublic short add(short listID) Allocates a new index resource and adds it to the front of the linked list indexed by listID.- Parameters:
- listID- the id of the list to add to.
- Throws:
- IndexOutOfBoundsException- thrown if the listID is not in the the range [0, numLists).
 
- 
appendpublic short append(short listID) Allocates a new index resource and adds it to the end of the linked list indexed by listID.- Parameters:
- listID- the id of the list to add to.
- Throws:
- IndexOutOfBoundsException- thrown if the listID is not in the the range [0, numLists).
 
- 
removepublic void remove(short listID, short index) Remove the index resource from the linked list indexed by listID.- Parameters:
- listID- the id of the list from which to removed the value at index.
- index- the index of the value to be removed from the specified list.
- Throws:
- IndexOutOfBoundsException- thrown if the listID is not in the the range [0, numLists).
 
- 
removeAllpublic void removeAll(short listID) Removes all indexes from the specified list.- Parameters:
- listID- the list to be emptied.
 
- 
getNewCapacitypublic short getNewCapacity()Computes the next size that should be used to grow the index capacity.
- 
getSizepublic short getSize()Returns the current number of used index resources.
- 
getCapacitypublic short getCapacity()Returns the current index capacity.
- 
getNumListspublic short getNumLists()Returns the number of linked list being managed.
- 
nextpublic final short next(short index) Returns the next index resource that follows the given index in a linked list. The index should be an index that is in some linked list. Otherwise, the results are undefined( probably give you the next index on the free list )- Parameters:
- index- to search after to find the next index.
- Throws:
- IndexOutOfBoundsException- thrown if the index is not in the the range [0, capacity].
 
- 
firstpublic final short first(short listID) Returns the first index resource on the linked list indexed by listID.- Throws:
- IndexOutOfBoundsException- thrown if the listID is not in the the range [0, numLists].
 
- 
growCapacitypublic void growCapacity(short newCapacity) Increases the index resource pool.- Parameters:
- newCapacity- the new number of resource indexes to manage. if this number is smaller than the current number of resource indexes, then nothing changes.
 
- 
growNumListspublic void growNumLists(short newListSize) Increases the number of managed linked lists.- Parameters:
- newListSize- the new number of linked lists. If this number is smaller than the current number of linked lists, then nothing changes.
 
- 
clearpublic void clear()Removes all indexes from all lists.
- 
getListSizepublic int getListSize(short listID) Returns the number of indexes in the specified list.- Throws:
- IndexOutOfBoundsException- thrown if the listID is not in the the range [0, numLists).
 
 
-