Package org.yamcs.parameterarchive
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
-
-
Field Summary
-
Fields inherited from class org.yamcs.parameterarchive.BaseSegment
FORMAT_ID_BinaryValueSegment, FORMAT_ID_BooleanValueSegment, FORMAT_ID_DoubleValueSegment, FORMAT_ID_FloatValueSegment, FORMAT_ID_GenericValueSegment, FORMAT_ID_IntValueSegment, FORMAT_ID_LongValueSegment, FORMAT_ID_OldBooleanValueSegment, FORMAT_ID_ParameterStatusSegment, FORMAT_ID_SortedTimeValueSegment, FORMAT_ID_StringValueSegment, formatId
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int pos, E e)voidadd(E e)add element to the end of the segmentbooleanequals(Object obj)Eget(int index)intgetMaxSerializedSize()E[]getRangeArray(int posStart, int posStop, boolean ascending)E[]getRleRangeDescending(int posStart, int posStop)protected voidparse(ByteBuffer bb)intsize()the number of elements in this segment (not taking into account any compression due to run-length encoding)voidwriteRaw(ByteBuffer bb)voidwriteTo(ByteBuffer bb)-
Methods inherited from class org.yamcs.parameterarchive.BaseSegment
getFormatId, parseSegment
-
-
-
-
Method Detail
-
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:
writeToin classBaseSegment
-
writeRaw
public void writeRaw(ByteBuffer bb)
-
parse
protected void parse(ByteBuffer bb) throws DecodingException
- Throws:
DecodingException
-
getMaxSerializedSize
public int getMaxSerializedSize()
- Specified by:
getMaxSerializedSizein classBaseSegment- 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:
sizein classBaseSegment- Returns:
-
-