Class SortedTimeSegment


  • public class SortedTimeSegment
    extends BaseSegment
    TimeSegment stores timestamps relative to a segmentStart. The timestamps are stored in a sorted int array. The timestamps have to be larger than the segmentStart and have to be part of the same interval (see ParameterArchive.INTERVAL_MASK.
    • Constructor Detail

      • SortedTimeSegment

        public SortedTimeSegment​(long segmentStart)
    • Method Detail

      • add

        public int add​(long instant)
        Insert instant into the array and return the position at which it has been inserted.
        Parameters:
        instant -
      • getTime

        public long getTime​(int idx)
        get timestamp at position idx
        Parameters:
        idx -
        Returns:
      • search

        public int search​(long instant)
        performs a binary search in the time segment and returns the position of t or where t would fit in.
        Parameters:
        instant -
        Returns:
        See Also:
        Arrays.binarySearch(int[], int)
      • getSegmentStart

        public long getSegmentStart()
      • 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
      • getSegmentEnd

        public long getSegmentEnd()
      • getRange

        public long[] getRange​(int posStart,
                               int posStop,
                               boolean ascending)