Package org.yamcs.parameter
Class ValueArray
java.lang.Object
org.yamcs.parameter.ValueArray
Stores parameters of the same type as array
For primitive types, it uses much less memory than having an Value[]
-
Constructor Summary
ConstructorDescriptionValueArray
(byte[][] r) ValueArray
(double[] r) ValueArray
(float[] r) ValueArray
(String[] r) ValueArray
(BitSet bitset, int size) ValueArray
(Yamcs.Value.Type type) ValueArray
(Yamcs.Value.Type type, int size) ValueArray
(Yamcs.Value.Type type, int[] r) ValueArray
(Yamcs.Value.Type type, long[] r) ValueArray
(Yamcs.Value.Type type, Object[] r) -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
get the array as an double[].float[]
get the array as an float[].int[]
get the array as an int[].long[]
get the array as an long[].getType()
getValue
(int idx) static ValueArray
merge
(int[] src, ValueArray... srcValueArray) merges the value arrays srcValueArray into a new array based on idx.void
setValue
(int idx, boolean b) void
int
size()
-
Constructor Details
-
ValueArray
-
ValueArray
-
ValueArray
-
ValueArray
-
ValueArray
public ValueArray(double[] r) -
ValueArray
public ValueArray(float[] r) -
ValueArray
public ValueArray(byte[][] r) -
ValueArray
-
ValueArray
-
ValueArray
-
-
Method Details
-
setValue
public void setValue(int idx, boolean b) -
setValue
-
getValue
-
getType
-
getIntArray
public int[] getIntArray()get the array as an int[]. Throws aClassCastException
if the array's type is not one ofYamcs.Value.Type.UINT32
orYamcs.Value.Type.SINT32
- Returns:
-
getLongArray
public long[] getLongArray()get the array as an long[]. Throws aClassCastException
if the array's type is not one ofYamcs.Value.Type.UINT64
,Yamcs.Value.Type.SINT64
orYamcs.Value.Type.TIMESTAMP
- Returns:
-
getFloatArray
public float[] getFloatArray()get the array as an float[]. Throws aClassCastException
if the array is not ofYamcs.Value.Type.FLOAT
type- Returns:
-
getDoubleArray
public double[] getDoubleArray()get the array as an double[]. Throws aClassCastException
if the array is not ofYamcs.Value.Type.DOUBLE
type- Returns:
-
size
public int size() -
merge
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
-