Package org.yamcs.parameter
Class ValueArray
- java.lang.Object
-
- org.yamcs.parameter.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 Summary
Constructors Constructor Description ValueArray(byte[][] r)ValueArray(double[] r)ValueArray(float[] r)ValueArray(String[] r)ValueArray(BitSet bitset, int size)ValueArray(org.yamcs.protobuf.Yamcs.Value.Type type)ValueArray(org.yamcs.protobuf.Yamcs.Value.Type type, int size)ValueArray(org.yamcs.protobuf.Yamcs.Value.Type type, int[] r)ValueArray(org.yamcs.protobuf.Yamcs.Value.Type type, long[] r)ValueArray(org.yamcs.protobuf.Yamcs.Value.Type type, Object[] r)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]getDoubleArray()get the array as an double[].float[]getFloatArray()get the array as an float[].int[]getIntArray()get the array as an int[].long[]getLongArray()get the array as an long[].org.yamcs.protobuf.Yamcs.Value.TypegetType()ValuegetValue(int idx)static ValueArraymerge(int[] src, ValueArray... srcValueArray)merges the value arrays srcValueArray into a new array based on idx.voidsetValue(int idx, boolean b)voidsetValue(int idx, Value v)intsize()
-
-
-
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 aClassCastExceptionif the array's type is not one ofYamcs.Value.Type.UINT32orYamcs.Value.Type.SINT32- Returns:
-
getLongArray
public long[] getLongArray()
get the array as an long[]. Throws aClassCastExceptionif the array's type is not one ofYamcs.Value.Type.UINT64,Yamcs.Value.Type.SINT64orYamcs.Value.Type.TIMESTAMP- Returns:
-
getFloatArray
public float[] getFloatArray()
get the array as an float[]. Throws aClassCastExceptionif the array is not ofYamcs.Value.Type.FLOATtype- Returns:
-
getDoubleArray
public double[] getDoubleArray()
get the array as an double[]. Throws aClassCastExceptionif the array is not ofYamcs.Value.Type.DOUBLEtype- 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 indexsrcValueArray- the source elements- Returns:
- a new array representing the merge of the input arrays
-
-