org.apache.kahadb.util
Class SequenceSet
java.lang.Object
org.apache.kahadb.util.LinkedNodeList<Sequence>
org.apache.kahadb.util.SequenceSet
public class SequenceSet
- extends LinkedNodeList<Sequence>
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.
- Author:
- chirino
Methods inherited from class org.apache.kahadb.util.LinkedNodeList |
addFirst, addFirst, addLast, addLast, clear, getHead, getTail, isEmpty, reparent, rotate, rotateTo, size, toArrayList, toString |
SequenceSet
public SequenceSet()
add
public void add(Sequence value)
add
public boolean add(long value)
- Parameters:
value
- the value to add to the list
- Returns:
- false if the value was a duplicate.
removeFirst
public long removeFirst()
- Removes and returns the first element from this list.
- Returns:
- the first element from this list.
- Throws:
NoSuchElementException
- if this list is empty.
removeLastSequence
public Sequence removeLastSequence()
removeFirstSequence
public Sequence removeFirstSequence(long count)
- Removes and returns the first sequence that is count range large.
- Returns:
- a sequence that is count range large, or null if no sequence is that large in the list.
getMissing
public List<Sequence> getMissing(long first,
long last)
- Returns:
- all the id Sequences that are missing from this set that are not
in between the range provided.
getReceived
public List<Sequence> getReceived()
- Returns:
- all the Sequence that are in this list
contains
public boolean contains(int first,
int last)
Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.