|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umd.cfar.lamp.viper.util.LengthwiseEncodedList
A list, with the elements run length encoded. It offers log n
access and edit time, on average. Note that it uses the
equals method to check equality, not ==, so
null
elements will not be accepted.
Setting a range to null
is the same as removing that range.
It does not implement java.util.List, as it takes
java.util.Comparable indexes instead of ints.
Constructor Summary | |
LengthwiseEncodedList()
Creates a new instance of LengthwiseEncodedList. |
Method Summary | |
java.lang.Object |
clone()
Copies the list; does not copy the references. |
java.lang.Object |
get(java.lang.Comparable index)
Get the value at the specified index in the list. |
java.util.Iterator |
iterator()
An iterator over all the DynamicValue elements
of the list. |
boolean |
remove(java.lang.Comparable start,
java.lang.Comparable stop)
Removes all values at the given range. |
void |
set(java.lang.Comparable start,
java.lang.Comparable stop,
java.lang.Object value)
Sets the value at the given range. |
java.lang.String |
toString()
Gets a list in the form n*("item"), n*("item")... |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LengthwiseEncodedList()
Method Detail |
public java.lang.Object clone()
Object.clone()
public java.lang.Object get(java.lang.Comparable index)
get
in interface ArbitraryIndexList
index
- the index into the list
public void set(java.lang.Comparable start, java.lang.Comparable stop, java.lang.Object value)
SortedMap
, this means that value is set in the
range from start, inclusive, to stop, exclusive.
set
in interface ArbitraryIndexList
start
- the first index to setstop
- the first index that is not setvalue
- all elements in the list in the range [start, stop)
will take this value
java.lang.IllegalArgumentException
- if start is not less than stoppublic boolean remove(java.lang.Comparable start, java.lang.Comparable stop)
SortedMap
, this means that value is set in the
range from start, inclusive, to stop, exclusive.
remove
in interface ArbitraryIndexList
start
- the first index to removestop
- the first index that is not removed
true
if any elements were removedpublic java.lang.String toString()
n*("item"), n*("item")...
public java.util.Iterator iterator()
DynamicValue
elements
of the list.
iterator
in interface ArbitraryIndexList
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |