com.jgpruitt.datamodeler.core
Class Schema

java.lang.Object
  extended by com.jgpruitt.datamodeler.core.Schema
All Implemented Interfaces:
java.lang.Iterable<Table>

public class Schema
extends java.lang.Object
implements java.lang.Iterable<Table>

A Schema is a collection of database Tables.

Author:
John Pruitt

Field Summary
protected  java.lang.String comment
           
protected  java.util.List<Table> list
           
protected  java.util.Map<java.lang.String,Table> map
           
protected  Model model
           
protected  java.lang.String name
           
 
Constructor Summary
Schema(java.lang.String name)
          Constructor.
 
Method Summary
 Table add(Table tbl)
          Adds a Table to the Schema
 boolean contains(java.lang.String name)
          Tests whether the Schema contains a Table by the name given
 boolean contains(Table tbl)
          Tests whether the Schema contains the table given
 Table get(int index)
          Gets a Table from the Schema by the index
 Table get(java.lang.String name)
          Gets a Table from the Schema by the Table's name
 java.lang.String getComment()
          Gets the comment describing the Schema
 Model getModel()
          Gets the Model to which this Schema belongs
 java.lang.String getName()
          Gets the name of the Schema.
 boolean isEmpty()
          Tests whether the Schema contains any Tables
 java.util.Iterator<Table> iterator()
          Gets a read-only Iterator over the Table in the Schema
 void setComment(java.lang.String comment)
          Sets the comment describing the Schema
 void setModel(Model model)
          Sets the Model to which this Schema belongs
 int size()
          Gets the number of Tables in the Schema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name

model

protected Model model

map

protected final java.util.Map<java.lang.String,Table> map

list

protected final java.util.List<Table> list

comment

protected java.lang.String comment
Constructor Detail

Schema

public Schema(java.lang.String name)
Constructor.

Parameters:
name - the name of the Schema
Method Detail

getName

public java.lang.String getName()
Gets the name of the Schema.

Returns:
the name

getModel

public Model getModel()
Gets the Model to which this Schema belongs

Returns:
the model

setModel

public void setModel(Model model)
Sets the Model to which this Schema belongs

Parameters:
model - the Model

add

public Table add(Table tbl)
Adds a Table to the Schema

Parameters:
tbl - the Table to add
Returns:
the Table that was added
See Also:
Table

get

public Table get(int index)
Gets a Table from the Schema by the index

Parameters:
index - the index
Returns:
the Table

get

public Table get(java.lang.String name)
Gets a Table from the Schema by the Table's name

Parameters:
name - the name of the Table to get
Returns:
the Table

contains

public boolean contains(java.lang.String name)
Tests whether the Schema contains a Table by the name given

Parameters:
name - the name of the Table to get
Returns:
the Table

contains

public boolean contains(Table tbl)
Tests whether the Schema contains the table given

Parameters:
tbl - the Table
Returns:
true if the Schema contains the Table

iterator

public java.util.Iterator<Table> iterator()
Gets a read-only Iterator over the Table in the Schema

Specified by:
iterator in interface java.lang.Iterable<Table>
Returns:
the iterator

isEmpty

public boolean isEmpty()
Tests whether the Schema contains any Tables

Returns:
true if the Schema has no Tables

size

public int size()
Gets the number of Tables in the Schema

Returns:
the number of Tables in the Schema

getComment

public java.lang.String getComment()
Gets the comment describing the Schema

Returns:
the comment

setComment

public void setComment(java.lang.String comment)
Sets the comment describing the Schema

Parameters:
comment - the comment