pl.kernelpanic.dbmonster.schema
Class Table

java.lang.Object
  extended bypl.kernelpanic.dbmonster.schema.Table
All Implemented Interfaces:
Comparable

public class Table
extends Object
implements Comparable

The table.

Version:
$Id: Table.html,v 1.1 2007/06/21 08:38:14 sbahloul Exp $
Author:
Piotr Maj <piotr.maj@kernelpanic.pl>

Constructor Summary
Table()
           
 
Method Summary
 void addColumn(Column column)
          Adds a column to the schema.
 Iterator columnIterator()
          Returns a column iterator.
 int compareTo(Object o)
           
 boolean containsColumn(String name)
           
 Column findColumn(String name)
           
 void generate()
          Generates the table.
 List getColumns()
          Returns list of columns.
 Key getKey()
          Returns a key.
 String getName()
          Returns the name of the table.
 int getRows()
          Returns the number of rows we want to generate for this table.
 Schema getSchema()
          Returns schema.
 void initialize(DBMonsterContext ctx)
          Initializes the table.
 boolean isGenerated()
          Checks if the table is already generated.
 void removeColumn(Column column)
          Removes column from table.
 void reset()
          Resets the entire table and mark it as if it was not generated.
 void resetColumns()
          Resets key and all columns.
 void setKey(Key k)
          Sets the key.
 void setName(String s)
          Sets the name of the table.
 void setRows(int i)
          Sets the number of rows.
 void setSchema(Schema s)
          Sets the schema - it cannot be null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table()
Method Detail

getName

public final String getName()
Returns the name of the table.

Returns:
the name of the table.

setName

public final void setName(String s)
Sets the name of the table.

Parameters:
s - the name of the table.

getSchema

public final Schema getSchema()
Returns schema.

Returns:
the schema

setSchema

public final void setSchema(Schema s)
Sets the schema - it cannot be null.

Parameters:
s - a schema

addColumn

public final void addColumn(Column column)
                     throws SchemaException
Adds a column to the schema.

Parameters:
column - the column to add
Throws:
SchemaException - on schema error.

setKey

public final void setKey(Key k)
Sets the key.

Parameters:
k - key

getKey

public final Key getKey()
Returns a key.

Returns:
a key

initialize

public final void initialize(DBMonsterContext ctx)
                      throws Exception
Initializes the table.

Parameters:
ctx - dbmonster context.
Throws:
Exception - if initialization fails

generate

public final void generate()
                    throws Exception
Generates the table.

Throws:
Exception - if table generation fails

resetColumns

public final void resetColumns()
Resets key and all columns.


reset

public final void reset()
Resets the entire table and mark it as if it was not generated.


getRows

public final int getRows()
Returns the number of rows we want to generate for this table.

Returns:
number of rows

setRows

public final void setRows(int i)
Sets the number of rows.

Parameters:
i - number of rows

isGenerated

public final boolean isGenerated()
Checks if the table is already generated.

Returns:
true if the table is already generated.

columnIterator

public final Iterator columnIterator()
Returns a column iterator.

Returns:
iterator over columns

getColumns

public final List getColumns()
Returns list of columns.

Returns:
list of columns

compareTo

public final int compareTo(Object o)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

removeColumn

public final void removeColumn(Column column)
Removes column from table.

Parameters:
column - column to remove

containsColumn

public boolean containsColumn(String name)

findColumn

public Column findColumn(String name)


Copyright © 2003-2005 .:. kernelpanic.pl .:.. All Rights Reserved.