public class BinaryTable extends Data implements TableData
dataSize, fileOffset, input
Constructor and Description |
---|
BinaryTable()
Create a null binary table data segment.
|
BinaryTable(ColumnTable tab)
Create a binary table from an existing ColumnTable
|
BinaryTable(Header myHeader)
Create a binary table from given header information.
|
BinaryTable(Object[] o)
Create a binary table from existing data in column order.
|
BinaryTable(Object[][] data)
Create a binary table from existing data in row order.
|
Modifier and Type | Method and Description |
---|---|
int |
addColumn(Object o)
Add a column to the end of a table.
|
int |
addFlattenedColumn(Object o,
int[] dims)
Add a column where the data is already flattened.
|
int |
addRow(Object[] o)
Add a row at the end of the table.
|
void |
fillHeader(Header h)
Modify a header to point to this data
|
Class[] |
getBases() |
Object |
getColumn(int col)
Get a given column
|
Object |
getData()
Return the data array object.
|
int[][] |
getDimens() |
Object |
getElement(int i,
int j)
Get a particular element from the table.
|
Object[] |
getFlatColumns() |
Object |
getFlattenedColumn(int col)
Get a column in flattened format.
|
int |
getHeapOffset() |
int |
getHeapSize() |
int |
getNCols()
Get the number of columns in the table.
|
int |
getNRows()
Get the number of rows in the table
|
Object[] |
getRow(int row)
Get a given row
|
int[] |
getSizes() |
static int[] |
getTDims(String tdims)
Parse the TDIMS value.
|
int |
getTrueSize()
Get the size of the data in the HDU sans padding.
|
char[] |
getTypes() |
void |
read(ArrayDataInput i)
Read the data -- or defer reading on random access
|
protected void |
readTrueData(ArrayDataInput i)
Read table, heap and padding
|
void |
setColumn(int col,
Object xcol)
Replace a column in the table.
|
void |
setElement(int i,
int j,
Object o)
Replace a single element within the table.
|
void |
setFlattenedColumn(int col,
Object data)
Set a column with the data aleady flattened.
|
void |
setRow(int row,
Object[] data)
Replace a row in the table.
|
protected boolean |
validColumn(int j)
Check if the column number is valid.
|
protected boolean |
validRow(int i)
Check to see if this is a valid row.
|
void |
write(ArrayDataOutput os)
Write the table, heap and padding
|
getFileOffset, getKernel, getSize, rewrite, rewriteable, setFileOffset
public BinaryTable() throws FitsException
FitsException
public BinaryTable(Header myHeader) throws FitsException
header
- A header describing what the binary
table should look like.FitsException
public BinaryTable(Object[][] data) throws FitsException
data
- The data used to initialize the binary table.FitsException
public BinaryTable(Object[] o) throws FitsException
FitsException
public BinaryTable(ColumnTable tab)
public static int[] getTDims(String tdims)
tdims
- The value of the TDIMSn card.arraySize
- The size field found on the TFORMn card.public void fillHeader(Header h) throws FitsException
Data
FitsException
public Object[] getRow(int row) throws FitsException
getRow
in interface TableData
row
- The index of the row to be returned.FitsException
public void setRow(int row, Object[] data) throws FitsException
setRow
in interface TableData
row
- The index of the row to be replaced.data
- The new values for the row.FitsException
- Thrown if the new row cannot
match the existing data.public void setColumn(int col, Object xcol) throws FitsException
setColumn
in interface TableData
col
- The index of the column to be replaced.xcol
- The new data for the columnFitsException
- Thrown if the data does not match
the current column description.public void setFlattenedColumn(int col, Object data) throws FitsException
col
- The index of the column to be replaced.data
- The new data array. This should be a one-d
primitive array.FitsException
- Thrown if the type of length of
the replacement data differs from the
original.public Object getColumn(int col) throws FitsException
getColumn
in interface TableData
col
- The index of the column.FitsException
public Object getFlattenedColumn(int col) throws FitsException
col
- FitsException
public Object getElement(int i, int j) throws FitsException
getElement
in interface TableData
i
- The row of the element.j
- The column of the element.FitsException
public int addRow(Object[] o) throws FitsException
addRow
in interface TableData
o
- An array of objects instantiating the data. These
should have the same structure as any existing rows.FitsException
public int addColumn(Object o) throws FitsException
addColumn
in interface TableData
o
- An array of identically structured objects with the
same number of elements as other columns in the table.FitsException
public int addFlattenedColumn(Object o, int[] dims) throws FitsException
o
- The new column data. This should be a one-dimensional
primitive array.dimens
- The dimensions of one row of the column.FitsException
public int getNRows()
public int getNCols()
protected boolean validRow(int i)
i
- The Java index (first=0) of the row to check.protected boolean validColumn(int j)
j
- The Java index (first=0) of the column to check.public void setElement(int i, int j, Object o) throws FitsException
setElement
in interface TableData
i
- The row of the data.j
- The column of the data.o
- The replacement data.FitsException
public void read(ArrayDataInput i) throws FitsException
read
in interface FitsElement
read
in class Data
i
- The input data streamFitsException
protected void readTrueData(ArrayDataInput i) throws FitsException
FitsException
public int getTrueSize()
public void write(ArrayDataOutput os) throws FitsException
write
in interface FitsElement
write
in class Data
os
- The output stream on which to write the data.FitsException
public Object getData() throws FitsException
Data
getData
in class Data
FitsException
public int[][] getDimens()
public Class[] getBases()
public char[] getTypes()
public Object[] getFlatColumns()
public int[] getSizes()
public int getHeapSize()
public int getHeapOffset()
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.