Package ghidra.util.datastruct
Class ShortListIndexer
- java.lang.Object
- 
- ghidra.util.datastruct.ShortListIndexer
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class ShortListIndexer extends java.lang.Object implements java.io.SerializableClass 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:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description ShortListIndexer(short numLists, short capacity)The constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description shortadd(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.shortfirst(short listID)Returns the first index resource on the linked list indexed by listID.shortgetCapacity()Returns the current index capacity.intgetListSize(short listID)Returns the number of indexes in the specified list.shortgetNewCapacity()Computes the next size that should be used to grow the index capacity.shortgetNumLists()Returns 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.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.
 
- 
- 
- 
Method Detail- 
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:
- java.lang.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:
- java.lang.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:
- java.lang.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:
- java.lang.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:
- java.lang.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:
- java.lang.IndexOutOfBoundsException- thrown if the listID is not in the the range [0, numLists).
 
 
- 
 
-