Package org.yamcs.yarch
Class Tuple
- java.lang.Object
-
- org.yamcs.yarch.Tuple
-
public class Tuple extends Object
Contains the tuple value (as an array of Columns) together with a pointer to its definition
-
-
Constructor Summary
Constructors Constructor Description Tuple()
Create a new tuple with no column.Tuple(TupleDefinition tdef)
Create a tuple with all the column values set to null.Tuple(TupleDefinition definition, Object[] columns)
Tuple(TupleDefinition definition, List<Object> columns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumn(String colName, boolean colValue)
Add a BOOLEAN columnvoid
addColumn(String colName, int colValue)
Add a INT columnvoid
addColumn(String colName, long colValue)
Add a LONG columnvoid
addColumn(String colName, String colValue)
Add a STRING columnvoid
addColumn(String colName, DataType type, Object colValue)
void
addEnumColumn(String colName, String colValue)
Add an ENUM columnvoid
addTimestampColumn(String colName, long colValue)
Add a TIMESTAMP columnboolean
getBooleanColumn(String colName)
Get the value of column as boolean.byte
getByteColumn(String colName)
Get the value of column as byte.Object
getColumn(int i)
<T> T
getColumn(String colName)
ColumnDefinition
getColumnDefinition(int i)
ColumnDefinition
getColumnDefinition(String colName)
int
getColumnIndex(String colName)
List<Object>
getColumns()
TupleDefinition
getDefinition()
double
getDoubleColumn(String colName)
Get the value of column as double.int
getIntColumn(String colName)
Get the value of column as int.long
getLongColumn(String colName)
Get the value of column as long.short
getShortColumn(String colName)
Get the value of column as short.long
getTimestampColumn(String colName)
boolean
hasColumn(String colName)
void
setColumn(int index, Object value)
void
setColumn(String colName, Object value)
void
setColumns(List<Object> cols)
void
setDefinition(TupleDefinition definition)
int
size()
String
toString()
-
-
-
Constructor Detail
-
Tuple
public Tuple()
Create a new tuple with no column.Can be used by the
addColumn(String, DataType, Object)
methods
-
Tuple
public Tuple(TupleDefinition definition, List<Object> columns)
-
Tuple
public Tuple(TupleDefinition definition, Object[] columns)
-
Tuple
public Tuple(TupleDefinition tdef)
Create a tuple with all the column values set to null.- Parameters:
tdef
-
-
-
Method Detail
-
setDefinition
public void setDefinition(TupleDefinition definition)
-
getDefinition
public TupleDefinition getDefinition()
-
setColumn
public void setColumn(int index, Object value)
-
getColumnIndex
public int getColumnIndex(String colName)
-
getColumn
public <T> T getColumn(String colName)
-
getLongColumn
public long getLongColumn(String colName)
Get the value of column as long.Throws exception if the column does not exist or is of different type
- Parameters:
colName
-- Returns:
-
getTimestampColumn
public long getTimestampColumn(String colName)
-
getBooleanColumn
public boolean getBooleanColumn(String colName)
Get the value of column as boolean.Throws exception if the column does not exist or is of different type
- Parameters:
colName
-- Returns:
-
getByteColumn
public byte getByteColumn(String colName)
Get the value of column as byte.Throws exception if the column does not exist or is of different type
- Parameters:
colName
-- Returns:
-
getShortColumn
public short getShortColumn(String colName)
Get the value of column as short.Throws exception if the column does not exist or is of different type
- Parameters:
colName
-- Returns:
-
getIntColumn
public int getIntColumn(String colName)
Get the value of column as int.Throws exception if the column does not exist or is of different type
- Parameters:
colName
-- Returns:
-
getDoubleColumn
public double getDoubleColumn(String colName)
Get the value of column as double.Throws exception if the column does not exist or is of different type
- Parameters:
colName
-- Returns:
-
getColumnDefinition
public ColumnDefinition getColumnDefinition(String colName)
-
getColumnDefinition
public ColumnDefinition getColumnDefinition(int i)
-
hasColumn
public boolean hasColumn(String colName)
-
getColumn
public Object getColumn(int i)
-
addTimestampColumn
public void addTimestampColumn(String colName, long colValue)
Add a TIMESTAMP column- Parameters:
colName
-colValue
-
-
addColumn
public void addColumn(String colName, int colValue)
Add a INT column- Parameters:
colName
-colValue
-
-
addColumn
public void addColumn(String colName, boolean colValue)
Add a BOOLEAN column- Parameters:
colName
-colValue
-
-
addColumn
public void addColumn(String colName, long colValue)
Add a LONG column- Parameters:
colName
-colValue
-
-
addColumn
public void addColumn(String colName, String colValue)
Add a STRING column- Parameters:
colName
-colValue
-
-
addEnumColumn
public void addEnumColumn(String colName, String colValue)
Add an ENUM column- Parameters:
colName
-colValue
-
-
size
public int size()
- Returns:
- return the number of columns
-
-