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.Type
getType()
Value
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
setValue(int idx, Value v)
int
size()
-
-
-
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 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
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
-
-