public class SeqnoList extends FixedSizeBitSet implements Streamable, java.lang.Iterable<java.lang.Long>
Modifier and Type | Class and Description |
---|---|
protected class |
SeqnoList.SeqnoListIterator |
Modifier and Type | Field and Description |
---|---|
protected long |
offset |
ADDRESS_BITS_PER_WORD, BITS_PER_WORD, size, WORD_MASK, words
Constructor and Description |
---|
SeqnoList()
Only to be used by serialization
|
SeqnoList(int size) |
SeqnoList(int size,
long offset)
Creates a SeqnoList with a capacity for size elements.
|
Modifier and Type | Method and Description |
---|---|
SeqnoList |
add(long... seqnos) |
SeqnoList |
add(long seqno)
Adds a single seqno
|
SeqnoList |
add(long from,
long to)
Adds a seqno range
|
long |
getLast()
Returns the last seqno, this should also be the highest seqno in the list as we're supposed to add seqnos
in order
|
protected int |
index(long seqno) |
boolean |
isEmpty() |
java.util.Iterator<java.lang.Long> |
iterator() |
void |
readFrom(java.io.DataInput in)
Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
|
void |
removeHigherThan(long max_seqno)
Removes all seqnos > seqno
|
protected long |
seqno(int index) |
int |
serializedSize() |
int |
size() |
java.lang.String |
toString()
Returns a string representation of this bit set.
|
void |
writeTo(java.io.DataOutput out)
Write the entire state of the current object (including superclasses) to outstream.
|
cardinality, clear, clear, flip, get, nextClearBit, nextSetBit, previousSetBit, set, set, wordIndex
public SeqnoList()
public SeqnoList(int size, long offset)
size
- The max number of seqnos in the bitsetoffset
- Lowest seqno. Used to compute the index of a given seqno into the bitset: seqno - offsetpublic SeqnoList(int size)
public SeqnoList add(long seqno)
public SeqnoList add(long... seqnos)
public SeqnoList add(long from, long to)
public void removeHigherThan(long max_seqno)
public long getLast()
public int serializedSize()
public void writeTo(java.io.DataOutput out) throws java.lang.Exception
Streamable
writeTo
in interface Streamable
java.lang.Exception
public void readFrom(java.io.DataInput in) throws java.lang.Exception
Streamable
readFrom
in interface Streamable
java.lang.Exception
public int size()
size
in class FixedSizeBitSet
public boolean isEmpty()
public java.lang.String toString()
FixedSizeBitSet
BitSet
contains a bit in the set
state, the decimal representation of that index is included in
the result. Such indices are listed in order from lowest to
highest, separated by ", " (a comma and a space) and
surrounded by braces, resulting in the usual mathematical
notation for a set of integers.
Overrides the toString
method of Object
.
Example:
BitSet drPepper = new BitSet();Now
drPepper.toString()
returns "{}
".
drPepper.set(2);Now
drPepper.toString()
returns "{2}
".
drPepper.set(4); drPepper.set(10);Now
drPepper.toString()
returns "{2, 4, 10}
".toString
in class FixedSizeBitSet
public java.util.Iterator<java.lang.Long> iterator()
iterator
in interface java.lang.Iterable<java.lang.Long>
protected int index(long seqno)
protected long seqno(int index)
Copyright © 1998-2020 Red Hat. All Rights Reserved.