|
SL-GMS Enterprise RTView Customization | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.sl.gmsjrt.GmsTabularData
public class GmsTabularData
The GmsTabularData is a 2 dimensional data type. This class allows you to populate a table of data.
| Field Summary | |
|---|---|
static int |
BOOLEAN
java.lang.Boolean column type |
static java.util.ArrayList |
customPatterns
A collection of custom, user-defined patterns for parsing dates and times. |
static int |
DATE
date column type, stored as long |
static boolean |
debugDateConversions
A flag to enable the output of debugging information during date conversions. |
static int |
DOUBLE
java.lang.Double column type |
static int |
FLOAT
java.lang.Float column type |
static int |
growthFactor
Percent growth of arrays on overflow. |
static int |
INTEGER
java.lang.Integer column type |
static int |
LONG
java.lang.Long column type |
static long |
NULL_DATE
The number value used to represent an unspecified date. |
static java.lang.String |
NULL_DATE_STRING
The string used to represent an unspecified date. |
static int |
STRING
java.lang.String column type |
| Constructor Summary | |
|---|---|
GmsTabularData()
Create a new GmsTabularData with default initial size of 10. |
|
| Method Summary | |
|---|---|
void |
addColumn(java.lang.String name,
int type)
Add a column with the specified name and type. |
void |
addRow(java.lang.String rowName)
Add a row with the specified name. |
GmsTabularData |
appendData(GmsTabularData newData)
Append all of the rows from another table to this table. |
java.lang.Object |
clone()
Clones the GmsTabularData and the data arrays. |
GmsTabularData |
cloneStructure()
Clones the GmsTabularData column structure only. |
boolean |
columnContainsNumericStrings(int column)
Find out if the specified column contains strings that are actually numbers. |
int |
compareRowsByColumn(int row1,
int row2,
int column,
boolean isNumericStringColumn)
Compare the values of the cells specified by row1 and row2 in the given column. |
void |
copyCellValue(int destRow,
int destCol,
GmsTabularData srcTable,
int srcRow,
int srcCol)
Copy a value from a cell in another table to a cell in this table, converting the value to the correct type if necessary. |
static void |
copyRowData(GmsTabularData destTable,
int destRow,
GmsTabularData srcTable,
int srcRow,
boolean columnOrderMatch,
boolean keepDestRowData)
Copy one row of data from the source table to the destination table. |
static long |
dateStringToLong(java.lang.String dateString)
Convert the given formatted date string into a number of milliseconds since epoch. |
static long |
dateStringToLong2(java.lang.String dateString)
Convert the given formatted date string into a number of milliseconds since epoch. |
boolean |
equals(java.lang.Object obj)
Returns true if this table is equal to the specified table. |
boolean |
getBooleanCellValue(int row,
int column)
Get the boolean value of a table cell at the given row and column. |
java.lang.String |
getCellValue(int row,
int column)
Get the string value of a table cell at the given row and column. |
java.lang.Object |
getCellValueObject(int row,
int col)
|
int |
getColumnIndex(java.lang.String column)
Return a column index, given the selected column name. |
int[] |
getColumnIndexArray(java.lang.String[] columnNames)
Return a column index array, given an array of column names. |
java.lang.String |
getColumnName(int col)
|
java.lang.String[] |
getColumnNames()
Returns an array of strings containing the column names. |
int |
getColumnTypeCode(int col)
|
int[] |
getColumnTypeCodes()
Returns an array of ints containing the column type codes. |
long |
getDateCellValue(int row,
int column)
Get the long value of a table cell at the given row and column. |
double |
getDoubleCellValue(int row,
int column)
Get the double value of a table cell at the given row and column. |
float |
getFloatCellValue(int row,
int column)
Get the float value of a table cell at the given row and column. |
int |
getIntCellValue(int row,
int column)
Get the integer value of a table cell at the given row and column. |
long |
getLongCellValue(int row,
int column)
Get the long value of a table cell at the given row and column. |
int |
getNumColumns()
Returns the number of columns. |
int |
getNumRows()
Returns the number of rows. |
java.util.Hashtable |
getRowIndexHashtable(java.util.Hashtable rowHash,
int[] indCols)
Returns a hashtable of row indexes hashed by the row identifier based on the specified index columns. |
java.lang.String |
getRowName(int row)
|
java.lang.String[] |
getRowNames()
Returns an array of strings containing the row names. |
void |
insertColumnAt(java.lang.String name,
int type,
int index)
Insert a column with the specified name and type at the specified index. |
GmsTabularData |
insertData(GmsTabularData newData,
int topFlag)
Creates a new GmsTabularData with the specified table inserted into a this GmsTabularData. |
void |
insertRowAt(java.lang.String rowName,
int index)
Insert a row with the specified name at the specified index. |
boolean |
isColumnNumeric(int column)
Find out if the specified column contains numbers or numeric strings. |
static boolean |
isNullDate(double msec)
Return true if the argument value represents NULL_DATE |
static boolean |
isNullDate(long msec)
Return true if the argument value represents NULL_DATE |
static boolean |
isNullDateString(java.lang.String dateString)
Return true if the argument value represents NULL_DATE_STRING |
GmsTabularData |
newColumnSubset(java.lang.String[] columns)
Create a new GmsTabularData by copying the contents of an existing one. |
GmsTabularData |
newRowSubset(int firstRow,
int lastRow)
Return a new table containing rows from this table, from firstRow to lastRow, inclusive. |
GmsTabularData |
newRowSubset(java.lang.String colStr,
java.lang.String filter)
Create a new GmsTabularData by copying the contents of an existing one. |
GmsTabularData |
newRowSubset(java.lang.String colStr,
java.lang.String filter,
int firstRow,
int lastRow)
|
void |
removeAllRows()
Remove all rows in the table. |
void |
removeRowAt(int index)
Remove the row at the specified index. |
void |
removeRowsAt(int startIndex,
int count)
Remove multiple consecutive rows. |
void |
setCellValue(boolean value,
int row,
int column)
Set the boolean value of a table cell at the given row and column. |
void |
setCellValue(double value,
int row,
int column)
Set the double value of a table cell at the given row and column. |
void |
setCellValue(float value,
int row,
int column)
Set the float value of a table cell at the given row and column. |
void |
setCellValue(int value,
int row,
int column)
Set the integer value of a table cell at the given row and column. |
void |
setCellValue(long value,
int row,
int column)
Set the long value of a table cell at the given row and column. |
void |
setCellValue(java.lang.String value,
int row,
int column)
Set the string value of a table cell at the given row and column. |
void |
setDateCellValue(long value,
int row,
int column)
Set the date value of a table cell at the given row and column. |
void |
setDateCellValue(java.lang.String value,
int row,
int column)
Set the date value of a table cell at the given row and column. |
void |
sortRows()
Sorts the rows in this GmsTabularData alphabetically by row name. |
void |
sortRows(int column,
boolean ascending)
Sort the rows in this GmsTabularData. |
java.lang.String |
toString()
Overrides default toString. |
boolean |
validateColumnNames(java.lang.String names)
Accept a semicolon-separated list of names and return true if all the names are valid column names. |
static boolean |
validateColumnNames(java.lang.String names,
java.lang.String[] columns)
Accept a semicolon-separated list of names and a reference list of column names and return true if all the names are found in the reference list. |
boolean |
validateFilterValues(java.lang.String names,
java.lang.String values)
Accept a semicolon-separated list of column names and a nested list of filter values in the form v1,v2;v3,v4 where each semicolon-separated set of values is associated with the corresponding column. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int BOOLEAN
public static java.util.ArrayList customPatterns
public static final int DATE
public static boolean debugDateConversions
public static final int DOUBLE
public static final int FLOAT
public static int growthFactor
public static final int INTEGER
public static final int LONG
public static final long NULL_DATE
public static final java.lang.String NULL_DATE_STRING
public static final int STRING
| Constructor Detail |
|---|
public GmsTabularData()
| Method Detail |
|---|
public void addColumn(java.lang.String name,
int type)
name - column name. This is used in the column headertype - column type. Valid arguments are INTEGER, LONG, DOUBLE,
STRING, FLOAT, DATE and BOOLEAN.public void addRow(java.lang.String rowName)
The row names are used in the removeRow and mergeData methods.
rowName - row name. May be null or an empty string.public GmsTabularData appendData(GmsTabularData newData)
newData - the table whose rows are to be appended
public java.lang.Object clone()
clone in class java.lang.Objectpublic GmsTabularData cloneStructure()
public boolean columnContainsNumericStrings(int column)
column - the column to test
public int compareRowsByColumn(int row1,
int row2,
int column,
boolean isNumericStringColumn)
row1 - the row index for the first cell to comparerow2 - the row index for the second cell to comparecolumn - the column index for both cellsisNumericStringColumn - set this to true if the column contains all
numeric strings and you want to compare the strings as numbers
public void copyCellValue(int destRow,
int destCol,
GmsTabularData srcTable,
int srcRow,
int srcCol)
destRow - The row of the cell in this table to which the value should be copied.destCol - The column of the cell in this table to which the value should be copied.srcTable - The table from which the value should be copied.srcRow - The row of the cell in srcTable from which the value should be copied.srcCol - The column of the cell in srcTable from which the value should be copied.
public static void copyRowData(GmsTabularData destTable,
int destRow,
GmsTabularData srcTable,
int srcRow,
boolean columnOrderMatch,
boolean keepDestRowData)
destTable - the destination tabledestRow - the row index in the destTable. Must be a valid row index for
destTable, so addRow() must be called first when using this method to copy
data to a new row.srcTable - the source tablesrcRow - the row index in the srcTablecolumnOrderMatch - Set this to true if both tables have the same number
and type of columns. If false, then for each column in destTable this
method will try to find a column in srcTable with the same name.keepDestRowData - If false, then for each column in destTable that is
not found in srcTable, set the value of that column in destRow to zero (for
numeric columns) or an empty string (for string columns). If true, don't
change the value of the column in destRow.
public static long dateStringToLong(java.lang.String dateString)
throws java.text.ParseException
dateString - the formatted date string
java.text.ParseException - if the specified date string is invalid.public static long dateStringToLong2(java.lang.String dateString)
dateString - the formatted date string
public boolean equals(java.lang.Object obj)
equals in class java.lang.Object
public boolean getBooleanCellValue(int row,
int column)
row - the row indexcolumn - the column index
public java.lang.String getCellValue(int row,
int column)
row - the row indexcolumn - the column index
public java.lang.Object getCellValueObject(int row,
int col)
public int getColumnIndex(java.lang.String column)
column - column namepublic int[] getColumnIndexArray(java.lang.String[] columnNames)
columnNames - array of column names
public java.lang.String getColumnName(int col)
public java.lang.String[] getColumnNames()
public int getColumnTypeCode(int col)
public int[] getColumnTypeCodes()
public long getDateCellValue(int row,
int column)
row - the row indexcolumn - the column index
public double getDoubleCellValue(int row,
int column)
row - the row indexcolumn - the column index
public float getFloatCellValue(int row,
int column)
row - the row indexcolumn - the column index
public int getIntCellValue(int row,
int column)
row - the row indexcolumn - the column index
public long getLongCellValue(int row,
int column)
row - the row indexcolumn - the column index
public int getNumColumns()
public int getNumRows()
public java.util.Hashtable getRowIndexHashtable(java.util.Hashtable rowHash,
int[] indCols)
rowHash the Hashtable to populate. If null, create a new Hashtable. indCols and array of column indexes to use as index columns
public java.lang.String getRowName(int row)
public java.lang.String[] getRowNames()
public void insertColumnAt(java.lang.String name,
int type,
int index)
name - column name. This is used in the column headertype - column type. Valid arguments are GmsTabularData.STRING,
INTEGER, LONG, DOUBLE, FLOAT, DATE, BOOLEAN.index - column index. The index at which to insert the column.
Index values start at zero.
public GmsTabularData insertData(GmsTabularData newData,
int topFlag)
newData - GmsTabularData to insert into this GmsTabularDatatopFlag - if greater than 0, insert the new rows at the beginning,
otherwise, insert them at the end.
public void insertRowAt(java.lang.String rowName,
int index)
This method validates the data arrays. The length of each data array is validated against the current number of rows. If the arrays are too short, the existing data in each array will be copied to a new longer array. The length of the new arrays will be determined by the growthFactor variable.
The row names are used in the removeRow and mergeData methods.
rowName - row name. May be null or an empty string.index - The index at which to insert the new row. Index values
start at zero.public boolean isColumnNumeric(int column)
column - the column to test
public static boolean isNullDate(double msec)
public static boolean isNullDate(long msec)
public static boolean isNullDateString(java.lang.String dateString)
public GmsTabularData newColumnSubset(java.lang.String[] columns)
columns - array of the names of the columns in this table to be
included in the returned table
public GmsTabularData newRowSubset(int firstRow,
int lastRow)
firstRow - index of first row to be copied. If less than zero, zero is
used instead.lastRow - index of last row to be copied. If greater than
this.getNumRows() - 1, then this.getNumRows() - 1 is used instead.
public GmsTabularData newRowSubset(java.lang.String colStr,
java.lang.String filter)
colStr - the name(s) of the filter column(s).filter - the filter value. This can be single value to match in a
single filter column or a nested list in the form v1,v2;v3,v4 to match
multiple filter values in each of multiple columns.
public GmsTabularData newRowSubset(java.lang.String colStr,
java.lang.String filter,
int firstRow,
int lastRow)
public void removeAllRows()
public void removeRowAt(int index)
This method removes a row immediately.
index - The index of the row to remove. Index values
start at zero.
public void removeRowsAt(int startIndex,
int count)
startIndex - The index of the first row to remove.count - The number of rows to remove.
public void setCellValue(boolean value,
int row,
int column)
value - the valuerow - the row indexcolumn - the column index
public void setCellValue(double value,
int row,
int column)
value - the valuerow - the row indexcolumn - the column index
public void setCellValue(float value,
int row,
int column)
value - the valuerow - the row indexcolumn - the column index
public void setCellValue(int value,
int row,
int column)
value - the valuerow - the row indexcolumn - the column index
public void setCellValue(long value,
int row,
int column)
value - the valuerow - the row indexcolumn - the column index
public void setCellValue(java.lang.String value,
int row,
int column)
value - the valuerow - the row indexcolumn - the column index
public void setDateCellValue(long value,
int row,
int column)
value - the date value as a number of milliseconds since epochrow - the row indexcolumn - the column index
public void setDateCellValue(java.lang.String value,
int row,
int column)
value - the date value as a formatted stringrow - the row indexcolumn - the column indexpublic void sortRows()
public void sortRows(int column,
boolean ascending)
column - The index of the column to use
for sorting. Column index values start at zero. If -1 is specified,
the row names are used.ascending - If true, sort in ascending order, else
in descending order.
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean validateColumnNames(java.lang.String names)
names - a single column name or semicolon-separated list
public static boolean validateColumnNames(java.lang.String names,
java.lang.String[] columns)
names - a single column name or semicolon-separated listcolumns - a list of column names to use as reference
public boolean validateFilterValues(java.lang.String names,
java.lang.String values)
names - a single column name or semicolon-separated listvalues - a nested list of filter value sets corresponding to
the column names
|
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||