Class ValueArray


  • public class ValueArray
    extends Object
    Stores parameters of the same type as array For primitive types, it uses much less memory than having an Value[]
    • Constructor Detail

      • ValueArray

        public ValueArray​(org.yamcs.protobuf.Yamcs.Value.Type type,
                          int size)
      • ValueArray

        public ValueArray​(org.yamcs.protobuf.Yamcs.Value.Type type)
      • ValueArray

        public ValueArray​(org.yamcs.protobuf.Yamcs.Value.Type type,
                          int[] r)
      • ValueArray

        public ValueArray​(org.yamcs.protobuf.Yamcs.Value.Type type,
                          long[] r)
      • ValueArray

        public ValueArray​(double[] r)
      • ValueArray

        public ValueArray​(float[] r)
      • ValueArray

        public ValueArray​(byte[][] r)
      • ValueArray

        public ValueArray​(org.yamcs.protobuf.Yamcs.Value.Type type,
                          Object[] r)
      • ValueArray

        public ValueArray​(BitSet bitset,
                          int size)
      • ValueArray

        public ValueArray​(String[] r)
    • Method Detail

      • setValue

        public void setValue​(int idx,
                             boolean b)
      • setValue

        public void setValue​(int idx,
                             Value v)
      • getValue

        public Value getValue​(int idx)
      • getType

        public org.yamcs.protobuf.Yamcs.Value.Type getType()
      • getIntArray

        public int[] getIntArray()
        get the array as an int[]. Throws a ClassCastException if the array's type is not one of Yamcs.Value.Type.UINT32 or Yamcs.Value.Type.SINT32
        Returns:
      • getLongArray

        public long[] getLongArray()
        get the array as an long[]. Throws a ClassCastException if the array's type is not one of Yamcs.Value.Type.UINT64, Yamcs.Value.Type.SINT64 or Yamcs.Value.Type.TIMESTAMP
        Returns:
      • getFloatArray

        public float[] getFloatArray()
        get the array as an float[]. Throws a ClassCastException if the array is not of Yamcs.Value.Type.FLOAT type
        Returns:
      • getDoubleArray

        public double[] getDoubleArray()
        get the array as an double[]. Throws a ClassCastException if the array is not of Yamcs.Value.Type.DOUBLE type
        Returns:
      • size

        public int size()
      • merge

        public static ValueArray merge​(int[] src,
                                       ValueArray... srcValueArray)
        merges the value arrays srcValueArray into a new array based on idx. The returned array has the size of the sum of the sizes of srcValueArray arrays. The src[] array has the length of the returned array and for each element i of the returned array src[i] says which of the inputValueArray is used. The types of the inputValueArray arrays have to be the same and that will also be the type of the returned array.
        Parameters:
        src - - an array indicating which from the srcValueArray is the source of the data for each index
        srcValueArray - the source elements
        Returns:
        a new array representing the merge of the input arrays