Class TabularData

java.lang.Object
COM.TIBCO.hawk.talon.TabularData
All Implemented Interfaces:
Serializable

public class TabularData extends Object implements Serializable
An open data type used to tabular data structures.

TabularData object may have a variable number of rows (including none) and still conform to the TabularDataDescriptor

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    TabularData(String[] columnNames, String[] indexNames, Object[][] data)
    Constructor NOTE: when building a TabularData object to conform to a particular TabularDataDescriptor, it may have 0 rows but the columnNames parameter must still match those specified by the descriptor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the table contains the row indexed by the specified data elements.
    boolean
    Compares this object against the specified object.
    Object[][]
    Retrieves all elements of the table in an array of Object arrays.
    Retrieves all elements of the table in an array of DataElement arrays.
    Returns an array of the column names used to construct this table
    An array of strings representing the types of the data objects in each column.
    Returns an array of the index names used to construct this table
    getRow(DataElement[] indexes)
    Retrieves the row, uniquely indexed by the indexes parameter, as an array of Object.
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TabularData

      public TabularData(String[] columnNames, String[] indexNames, Object[][] data)
      Constructor NOTE: when building a TabularData object to conform to a particular TabularDataDescriptor, it may have 0 rows but the columnNames parameter must still match those specified by the descriptor.
      Parameters:
      columnNames - Identifies the names of all columns. Must contain at least one column name. All column names must be non-null and non-empty strings. No two columns may have the same name.
      indexNames - Identifies those columns of the table that can be used as a unique index for each row. Must identify at least one index column. All index names must be non-null and non-empty strings. No two array entries may contain the same string. All index names identified by this array must also be present in the array specified by the columnNames parameter.
      data - An array of arrays containing objects representing each cell of the table to be constructed. Every object must be of a type which is one of the open data types as identified by the OpenData interface. Their ordering corresponds directly to their position in the table. Every row must have the same number columns as the length of the columnNames array parameter. Ex: data[x][y] identifies the cell in row x, column y where column y is labeled by columnNames[y]. If data has 0 rows or is null, an empty table is constructed. The values of every cell in a single column must be of the same type or null. Each row must be uniquely indexed. That is, each row must have a unique combination of cell values for those cells in the columns identified by the indexNames parameter.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toXML

      public String toXML()
    • equals

      public boolean equals(Object obj)
      Compares this object against the specified object.

      Two TabularData objects are considered equal if

      • they have the same column names (although they may not have been specified in same order)
      • they have the same index names (although they may not have been specified in same order)
      • they have the same number of rows (although they may not have been specified in same order)
      • each uniquely indexed row of one has the same column values as the same uniquely indexed row of the other
      Overrides:
      equals in class Object
      Returns:
      true if the two objects are equal.
    • containsRow

      public boolean containsRow(DataElement[] indexes)
      Returns true if the table contains the row indexed by the specified data elements.
      Parameters:
      indexes - Array of DataElements forming a unique index into the table.
    • getRow

      public DataElement[] getRow(DataElement[] indexes)
      Retrieves the row, uniquely indexed by the indexes parameter, as an array of Object. The returned row is represented by an array of DataElememnt objects, each one corresponding to a cell of the row. DataElement.getName() identifies the column of the cell and DataElement.getValue() returns the value of that cell.
      Parameters:
      indexes - A DataElement array holding the objects used to uniquely identify a row. The DataElement names must all be strings which must be equal, in number and in value, to those returned by getIndexNames(). They identify columns in the table. The corresponding DataElement values represent table cell values (in the corresponding columns) which will be used to retrieve the row. This parameter may not be null.
      Returns:
      an array of DataElement objects representing the row, or null if row not found.
      Throws:
      IllegalArgumentException - if parameter conditions are violated.
      See Also:
    • getAllDataElements

      public DataElement[][] getAllDataElements()
      Retrieves all elements of the table in an array of DataElement arrays.
      Returns:
      null if table is empty
    • getAllData

      public Object[][] getAllData()
      Retrieves all elements of the table in an array of Object arrays.
      Returns:
      null if table is empty
    • getIndexNames

      public String[] getIndexNames()
      Returns an array of the index names used to construct this table
    • getColumnNames

      public String[] getColumnNames()
      Returns an array of the column names used to construct this table
    • getColumnTypes

      public String[] getColumnTypes()
      An array of strings representing the types of the data objects in each column. The type names in this array correspond to the the columns identified in the array returned by getColumnNames() at the same array index.

      A null element in this array indicates that that column contained only null values and thus the intended type, assuming it wasn't null, could not be determined. A value such as "java.lang.String" indicates that that column contains values that are either of type "java.lang.String" or null.