public class SortedList extends Object implements Serializable
Sorted List, backed by a TArrayList. The elements in the list are always ordered by priority. Methods exists to remove elements with the highest and lowest priorities. If more than one element has the highest priority, they will all be removed by calling removeHighest. Ditto for the lowest priority. The list has a preferred maximum size. If possible, entries with the lowest priority will be removed to limit the maximum size. Note that entries with the lowest priority will not be removed if this would leave fewer than the preferred maximum number of entries. This class is not optimised for large values of preferredMaximumSize. Values greater than, say, 5, are not recommended.
Constructor and Description |
---|
SortedList() |
Modifier and Type | Method and Description |
---|---|
void |
add(int id,
float priority) |
void |
forEachId(gnu.trove.procedure.TIntProcedure v) |
float |
getLowestPriority()
return the lowest priority currently stored, or float.NEGATIVE_INFINITY if no
entries are stored
|
void |
init(int preferredMaximumSize) |
void |
reset() |
int[] |
toNativeArray() |
public void init(int preferredMaximumSize)
public void reset()
public void add(int id, float priority)
public float getLowestPriority()
public void forEachId(gnu.trove.procedure.TIntProcedure v)
public int[] toNativeArray()
Copyright © 2014. All rights reserved.