|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.nist.nlpir.irf.util.CircQueue
A circular queue of keys and associated values
Field Summary | |
private int |
backOne
Value to add to index to get previous |
private java.lang.Object[] |
keys
Array of keys to queue |
private int |
newestIndex
Index of most recently added value |
private int |
qMod
Modulus to give queue its circularity |
private java.lang.Object[] |
values
Array of values, each associated with keys at same index |
Constructor Summary | |
CircQueue(int maxEntries)
Constructs a new, empty circular queue of the size specified |
Method Summary | |
void |
add(java.lang.Object key,
java.lang.Object value)
Adds an object (key-value pair) to the queue |
java.lang.Object |
find(java.lang.Object key)
Finds the most recently added value with the given key |
void |
present()
Presents the contents of the queue, most recent first |
void |
replace(java.lang.Object key,
java.lang.Object value)
Finds the most recently added value with the given key |
void |
setMaxEntries(int newMaxEntries)
Constructs a new, empty circular queue of the size specified with as much data from the old as will fit |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.Object[] keys
private java.lang.Object[] values
private int newestIndex
private int qMod
private int backOne
Constructor Detail |
public CircQueue(int maxEntries)
maxEntries
- maximum number of entries the queue can holdMethod Detail |
public void setMaxEntries(int newMaxEntries)
maxEntries
- maximum number of entries the queue can holdpublic final void add(java.lang.Object key, java.lang.Object value)
key
- of object to be addedvalue
- of object to be addedpublic final java.lang.Object find(java.lang.Object key)
key
- search key of object soughtpublic final void replace(java.lang.Object key, java.lang.Object value)
key
- search key of object soughtvalue
- replacement valuepublic void present()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |