Class ObjectSegment<E>

java.lang.Object
org.yamcs.parameterarchive.BaseSegment
org.yamcs.parameterarchive.ObjectSegment<E>
Direct Known Subclasses:
BinaryValueSegment, ParameterStatusSegment, StringValueSegment

public class ObjectSegment<E> extends BaseSegment
Segment for all non primitive types. Each element is encoded to a binary that is not compressed. The compression of the segment (if any) is realized by not repeating elements. Finds best encoding among: - raw - list of values stored verbatim, each preceded by its size varint32 encoded - enum - the list of unique values are stored at the beginning of the segment - each value has an implicit id (the order in the list) - the rest of the segment is the list of ids and can be encoded in one of the following formats - VB: varint32 of each id - FPROF: coded with the FPROF codec + varint32 of remaining - RLE: run length encoded
  • Method Details

    • add

      public void add(E e)
      add element to the end of the segment
      Parameters:
      e -
    • add

      public void add(int pos, E e)
    • writeTo

      public void writeTo(ByteBuffer bb)
      Specified by:
      writeTo in class BaseSegment
    • writeRaw

      public void writeRaw(ByteBuffer bb)
    • parse

      protected void parse(ByteBuffer bb) throws DecodingException
      Throws:
      DecodingException
    • getMaxSerializedSize

      public int getMaxSerializedSize()
      Specified by:
      getMaxSerializedSize in class BaseSegment
      Returns:
      a high approximation for the serialized size in order to allocate a ByteBuffer big enough
    • getRangeArray

      public E[] getRangeArray(int posStart, int posStop, boolean ascending)
    • getRleRangeDescending

      public E[] getRleRangeDescending(int posStart, int posStop)
    • get

      public E get(int index)
    • size

      public int size()
      the number of elements in this segment (not taking into account any compression due to run-length encoding)
      Specified by:
      size in class BaseSegment
      Returns:
    • consolidate

      public void consolidate()
      Overrides:
      consolidate in class BaseSegment
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object