public class KeyedTreeTable
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
KeyedTreeTable.TimedValueBlock
Class TimedValueBlock defines a block that holds a 'value' object,
a timestamp, and a reference to a 'List' object.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap |
keyEntriesMapObj
Entries table where each entry-value is a 'List' object.
|
protected boolean |
rejectDuplicatesFlag
Flag set true if duplicate entries are to be rejected.
|
protected java.util.ArrayList |
valueBlksListObj
Flat list of timed-value blocks for all 'value' objects in table.
|
Constructor and Description |
---|
KeyedTreeTable(boolean rejectDuplicatesFlag)
Creates a "keyed" tree-table where any number of 'value' objects
may be associated with a 'key' object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addEntry(java.lang.Object keyObj,
java.lang.Object valueObj)
Adds a 'value' object to the table.
|
java.lang.String |
getTableDisplayStr()
Returns a display string containing all the current entries in the
table.
|
java.lang.String |
getTableDisplayStr(java.lang.String sepStr)
Returns a display string containing all the current entries in the
table.
|
java.util.Iterator |
getValues(java.lang.Object keyObj)
Returns an iterator for the values associated with the given
key object.
|
java.lang.String |
getValuesDisplayStr()
Returns a display string containing all the current values in the
table.
|
boolean |
removeEntriesForKey(java.lang.Object keyObj)
Removes all entries associated with the given 'key' object.
|
boolean |
removeEntry(java.lang.Object keyObj,
java.lang.Object valueObj)
Removs the given 'value' object from the table.
|
void |
removeOldEntries(long minTimeMsVal,
int maxRemoveCount)
Removes "old" entries from the table.
|
java.util.Iterator |
removeOldEntries(long minTimeMsVal,
int maxRemoveCount,
boolean returnRemovedFlag)
Removes "old" entries from the table.
|
protected boolean |
removeTimedValueBlock(KeyedTreeTable.TimedValueBlock blkObj)
Removes the given timed-value block from the table.
|
protected final java.util.ArrayList valueBlksListObj
protected final java.util.HashMap keyEntriesMapObj
protected final boolean rejectDuplicatesFlag
public KeyedTreeTable(boolean rejectDuplicatesFlag)
rejectDuplicatesFlag
- true to reject duplicate 'value' objects.public boolean addEntry(java.lang.Object keyObj, java.lang.Object valueObj)
keyObj
- the 'key' object to be associated with the 'value'
object.valueObj
- the 'value' object to use.public java.util.Iterator getValues(java.lang.Object keyObj)
keyObj
- the key object to use.public boolean removeEntry(java.lang.Object keyObj, java.lang.Object valueObj)
keyObj
- the 'key' object associated with the 'value' object.valueObj
- the 'value' object to remove.public boolean removeEntriesForKey(java.lang.Object keyObj)
keyObj
- the 'key' object to remove.public java.util.Iterator removeOldEntries(long minTimeMsVal, int maxRemoveCount, boolean returnRemovedFlag)
minTimeMsVal
- the minimum time value (in ms since 1/1/1970 GMT)
such that entries with time values below this value are removed.maxRemoveCount
- the maximum number of entries to be removed,
or 0 for no limit.returnRemovedFlag
- true to return an iterator that can be used
to fetch a list of removed entries; false for none.public void removeOldEntries(long minTimeMsVal, int maxRemoveCount)
minTimeMsVal
- the minimum time value (in ms since 1/1/1970 GMT)
such that entries with time values below this value are removed.maxRemoveCount
- the maximum number of entries to be removed,
or 0 for no limit.public java.lang.String getValuesDisplayStr()
public java.lang.String getTableDisplayStr(java.lang.String sepStr)
sepStr
- the separator string to use between key-entries.public java.lang.String getTableDisplayStr()
protected boolean removeTimedValueBlock(KeyedTreeTable.TimedValueBlock blkObj)
blkObj
- the timed-value block block to remove.