|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.table.Tables
public class Tables
Utility class for miscellaneous table-related functionality.
Field Summary | |
---|---|
static DefaultValueInfo |
DEC_INFO
ValueInfo representing Declination. |
static ValueInfo |
NULL_VALUE_INFO
ValueInfo which may be used as part of a column's metadata to indicate a special value (preferably a Number
that should be interpreted as a null (blank). |
static DefaultValueInfo |
RA_INFO
ValueInfo representing Right Ascension. |
Constructor Summary | |
---|---|
Tables()
|
Method Summary | |
---|---|
static TableSequence |
arrayTableSequence(StarTable[] tables)
Convenience method to construct a TableSequence for a supplied array of tables. |
static int |
assertLongToInt(long lval)
Casts a long to an int, with an assertion that no truncation occurs. |
static int |
checkedLongToInt(long lval)
Convenience method to get an int value from a long. |
static void |
checkTable(StarTable table)
Diagnostic method which tests the invariants of a StarTable. |
static StarTable |
deleteColumn(StarTable startab,
int icol)
Returns a table equivalent to the original but with a given column deleted. |
static void |
fixColumns(ColumnInfo[][] infoLists,
JoinFixAction[] fixActs)
Performs deduplication of column names for N lists of column metadata objects that will be combined to form a new table. |
static ColumnInfo[] |
getColumnInfos(StarTable startab)
Convenience method to return an array of all the column headers in a given table. |
static java.lang.String[] |
getElementLabels(int[] shape)
Returns an array of strings suitable as labels or label suffixes for elements of an array as returned by ValueInfo.getShape() . |
static java.lang.String |
getUtype(ValueInfo info)
Deprecated. use ValueInfo.getUtype() instead |
static java.lang.Object |
getValue(java.util.Collection dvals,
ValueInfo info)
Returns the value from a list of DescribedValue objects
which corresponds to a given info key. |
static boolean |
isBlank(java.lang.Object value)
Indicates whether a given value is conventionally regarded as a blank value. |
static StarTable |
randomTable(StarTable startab)
Returns a table based on a given table and guaranteed to have random access. |
static void |
setUtype(ValueInfo info,
java.lang.String utype)
Deprecated. use DefaultValueInfo.setUtype(java.lang.String) instead |
static TableSequence |
singleTableSequence(StarTable table)
Convenience method to consruct a TableSequence for a single table. |
static StarTable |
sortTable(StarTable table,
int[] colIndices,
boolean up,
boolean nullsLast)
Returns a sorted version of a table. |
static void |
streamStarTable(StarTable source,
TableSink sink)
Copies the data and metadata from a StarTable into a table sink. |
static StarTable[] |
tableArray(TableSequence tseq)
Convenience method to construct an array of StarTables from a TableSequence. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ValueInfo NULL_VALUE_INFO
Number
that should be interpreted as a null (blank).
This should only be used on nullable columns, and really only
on ones with a contentClass which is an integer (or possibly boolean)
type; for other types, there is usually a value which can
conventionally be understood to mean blank.
Note this is here as a standard key to use when software components
wish to communicate this information; the table system does not
guarantee to honour instances of this value in a column's
auxiliary data. It is the job of a StarTable instance to ensure
that a null is returned from the table interrogation methods
if that is what is meant.
public static final DefaultValueInfo RA_INFO
public static final DefaultValueInfo DEC_INFO
Constructor Detail |
---|
public Tables()
Method Detail |
---|
public static StarTable randomTable(StarTable startab) throws java.io.IOException
This convenience method is equivalent to calling StoragePolicy.getDefaultPolicy().randomTable(startab).
startab
- original table
java.io.IOException
public static ColumnInfo[] getColumnInfos(StarTable startab)
startab
- the table being enquired about
public static StarTable deleteColumn(StarTable startab, int icol)
startab
- the table from which to delete a columnicol
- the index of the column to be deleted
java.lang.IndexOutOfBoundsException
- if startab has no column
at icolpublic static void streamStarTable(StarTable source, TableSink sink) throws java.io.IOException
source
- table to be copiedsink
- table destination
java.io.IOException
public static void checkTable(StarTable table) throws java.io.IOException
That a table passes this test does not guarantee that the table has no bugs. This method should not generally be used in production code, since it may be expensive in time and/or memory.
table
- table to test
java.lang.AssertionError
- if an invariant is violated
java.io.IOException
- if there is an I/O errorpublic static boolean isBlank(java.lang.Object value)
value
- value to test
public static TableSequence singleTableSequence(StarTable table)
table
- table
public static TableSequence arrayTableSequence(StarTable[] tables)
tables
- table array
public static StarTable[] tableArray(TableSequence tseq) throws java.io.IOException
tseq
- table sequence
java.io.IOException
public static StarTable sortTable(StarTable table, int[] colIndices, boolean up, boolean nullsLast) throws java.io.IOException
table
- table to sort - must be random accesscolIndices
- indices of the columns which are to act as sort
keys; first element is primary key etcup
- true for sorting into ascending order, false for
descending ordernullsLast
- true if blank values should be considered
last in the collation order, false if they should
be considered first
java.io.IOException
- if table.isRandom is not truepublic static int checkedLongToInt(long lval)
lval
- the long value to convert
java.lang.IllegalArgumentException
- if the conversion cannot be donepublic static int assertLongToInt(long lval)
lval
- long value, asserted to be in the range
Integer.MIN_VALUE..Integer.MAX_VALUE
lval
public static java.lang.String[] getElementLabels(int[] shape)
ValueInfo.getShape()
.
If the given shape cannot be decomposed into a fixed
size array, returns null.
shape
- vector giving dimensions of an array value
public static java.lang.String getUtype(ValueInfo info)
ValueInfo.getUtype()
instead
info
- metadata item
setUtype(uk.ac.starlink.table.ValueInfo, java.lang.String)
public static void setUtype(ValueInfo info, java.lang.String utype)
DefaultValueInfo.setUtype(java.lang.String)
instead
info
- metadata itemutype
- new utype valuegetUtype(uk.ac.starlink.table.ValueInfo)
public static java.lang.Object getValue(java.util.Collection dvals, ValueInfo info)
DescribedValue
objects
which corresponds to a given info key.
If the key is not represented in the list, or if its value is null,
then null is returned.
dvals
- list of DescribedValue objectsinfo
- key giving the value you want
public static void fixColumns(ColumnInfo[][] infoLists, JoinFixAction[] fixActs)
infoLists
- array of N arrays of column metadata objectsfixActs
- array of N policies for renaming columns
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |