Class SeqnoList

    • Constructor Summary

      Constructors 
      Constructor 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SeqnoList add​(long seqno)
      Adds a single seqno
      SeqnoList add​(long... seqnos)  
      SeqnoList add​(long from, long to)
      Adds a seqno range
      SeqnoList add​(java.util.Collection<java.lang.Long> seqnos)  
      java.util.function.Supplier<? extends SeqnoList> create()
      Creates an instance of the class implementing this interface
      long getFirst()
      Returns the first seqno, this is also the lowest seqno in the list as we add seqnos in order
      long getLast()
      Returns the last seqno, this is also the highest seqno in the list as we 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
      SeqnoList removeHigherThan​(long seqno)
      Removes all seqnos > seqno
      SeqnoList removeLowerThan​(long seqno)
      Removes all seqnos < seqno
      protected long seqno​(int index)  
      int serializedSize()
      Returns the size (in bytes) of the marshalled object
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • offset

        protected long offset
    • Constructor Detail

      • SeqnoList

        public SeqnoList()
        Only to be used by serialization
      • SeqnoList

        public SeqnoList​(int size,
                         long offset)
        Creates a SeqnoList with a capacity for size elements.
        Parameters:
        size - The max number of seqnos in the bitset
        offset - Lowest seqno. Used to compute the index of a given seqno into the bitset: seqno - offset
      • SeqnoList

        public SeqnoList​(int size)
    • Method Detail

      • add

        public SeqnoList add​(long seqno)
        Adds a single seqno
      • add

        public SeqnoList add​(long... seqnos)
      • add

        public SeqnoList add​(java.util.Collection<java.lang.Long> seqnos)
      • add

        public SeqnoList add​(long from,
                             long to)
        Adds a seqno range
      • removeHigherThan

        public SeqnoList removeHigherThan​(long seqno)
        Removes all seqnos > seqno
      • removeLowerThan

        public SeqnoList removeLowerThan​(long seqno)
        Removes all seqnos < seqno
      • getLast

        public long getLast()
        Returns the last seqno, this is also the highest seqno in the list as we add seqnos in order
      • getFirst

        public long getFirst()
        Returns the first seqno, this is also the lowest seqno in the list as we add seqnos in order
      • writeTo

        public void writeTo​(java.io.DataOutput out)
                     throws java.io.IOException
        Description copied from interface: Streamable
        Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed
        Specified by:
        writeTo in interface Streamable
        Throws:
        java.io.IOException
      • readFrom

        public void readFrom​(java.io.DataInput in)
                      throws java.io.IOException
        Description copied from interface: Streamable
        Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
        Specified by:
        readFrom in interface Streamable
        Throws:
        java.io.IOException
      • isEmpty

        public boolean isEmpty()
      • toString

        public java.lang.String toString()
        Description copied from class: FixedSizeBitSet
        Returns a string representation of this bit set. For every index for which this 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}".
        Overrides:
        toString in class FixedSizeBitSet
        Returns:
        a string representation of this bit set.
      • iterator

        public java.util.Iterator<java.lang.Long> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Long>
      • index

        protected int index​(long seqno)
      • seqno

        protected long seqno​(int index)