com.infoviz.datamodel.table
Class IVTableDefinition

java.lang.Object
  extended bycom.infoviz.datamodel.table.IVTableDefinition

public class IVTableDefinition
extends java.lang.Object

This class contains the metadata for a table like the column types and primary keys. This class is thread-safe

$Id$ $Revision$ $Author$


Constructor Summary
IVTableDefinition(IVColumnDefinition[] columnDef)
          constructs a table with the specified coulumns
IVTableDefinition(java.lang.String[] columnNames, java.lang.Class[] columnTypes)
          constructs a table with the specified column attributes.
 
Method Summary
 void addColumn(IVColumnDefinition columnDef)
          add a new column to the table
 boolean containsColumn(java.lang.String columnName)
          checks if a column with the given name exists
 IVColumnDefinition getColumnAtIndex(int index)
          finds column at a given index
 int getColumnCount()
          returns the no.
 IVColumnDefinition[] getColumnDefinitions()
          get all the columns
 int getColumnIndex(java.lang.String name)
          finds index of the column with the given name.
 IVColumnDefinition getColumnWithName(java.lang.String name)
          finds a column with the given name
 void removeColumn(IVColumnDefinition columnDef)
          remove a column from the definition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IVTableDefinition

public IVTableDefinition(java.lang.String[] columnNames,
                         java.lang.Class[] columnTypes)
constructs a table with the specified column attributes. The arrays passed as parameters must be of the same size.

Parameters:
columnNames - name of the columns, this name will also be used as column display name. 2 columns cannot have the same name
columnTypes - the data type for the column whose name is specified in the corresponding array element in columnNames

IVTableDefinition

public IVTableDefinition(IVColumnDefinition[] columnDef)
constructs a table with the specified coulumns

Parameters:
columnDef - columns
Method Detail

getColumnCount

public int getColumnCount()
returns the no. of columns

Returns:
no. of columns

getColumnIndex

public int getColumnIndex(java.lang.String name)
finds index of the column with the given name. Index is determined by the order in which columns are added

Parameters:
name - column name
Returns:
column index

getColumnWithName

public IVColumnDefinition getColumnWithName(java.lang.String name)
finds a column with the given name

Parameters:
name -
Returns:

getColumnAtIndex

public IVColumnDefinition getColumnAtIndex(int index)
finds column at a given index

Parameters:
index -
Returns:

getColumnDefinitions

public IVColumnDefinition[] getColumnDefinitions()
get all the columns

Returns:
column definition

addColumn

public void addColumn(IVColumnDefinition columnDef)
add a new column to the table

Parameters:
columnDef - the new column definition. Column names should be unique.

removeColumn

public void removeColumn(IVColumnDefinition columnDef)
remove a column from the definition

Parameters:
columnDef -

containsColumn

public boolean containsColumn(java.lang.String columnName)
checks if a column with the given name exists

Parameters:
columnName -
Returns: