|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.kahadb.util.LinkedNodeList<Sequence>
org.apache.kahadb.util.SequenceSet
public class SequenceSet
Keeps track of a added long values. Collapses ranges of numbers using a Sequence representation. Use to keep track of received message ids to find out if a message is duplicate or if there are any missing messages.
Nested Class Summary | |
---|---|
static class |
SequenceSet.Marshaller
|
Constructor Summary | |
---|---|
SequenceSet()
|
Method Summary | |
---|---|
boolean |
add(long value)
|
void |
add(Sequence value)
|
boolean |
contains(int first,
int last)
|
boolean |
contains(long value)
Returns true if the value given is contained within one of the sequences held in this set. |
java.util.List<Sequence> |
getMissing(long first,
long last)
|
java.util.List<Sequence> |
getReceived()
|
java.util.Iterator<java.lang.Long> |
iterator()
|
long |
rangeSize()
Computes the size of this Sequence by summing the values of all the contained sequences. |
boolean |
remove(long value)
Removes the given value from the Sequence set, splitting a contained sequence if necessary. |
long |
removeFirst()
Removes and returns the first element from this list. |
Sequence |
removeFirstSequence(long count)
Removes and returns the first sequence that is count range large. |
Sequence |
removeLastSequence()
Removes and returns the last sequence from this list. |
Methods inherited from class org.apache.kahadb.util.LinkedNodeList |
---|
addFirst, addFirst, addLast, addLast, clear, getHead, getTail, isEmpty, reparent, rotate, rotateTo, size, toArrayList, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SequenceSet()
Method Detail |
---|
public void add(Sequence value)
public boolean add(long value)
value
- the value to add to the list
public boolean remove(long value)
value
- The value that should be removed from the SequenceSet.
public long removeFirst()
java.util.NoSuchElementException
- if this list is empty.public Sequence removeLastSequence()
public Sequence removeFirstSequence(long count)
public java.util.List<Sequence> getMissing(long first, long last)
public java.util.List<Sequence> getReceived()
public boolean contains(long value)
value
- The value to search for in the set.
public boolean contains(int first, int last)
public long rangeSize()
public java.util.Iterator<java.lang.Long> iterator()
iterator
in interface java.lang.Iterable<java.lang.Long>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |