com.jgpruitt.datamodeler.core
Class Model

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

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

A Model is a collection of associated Schemas.

Author:
John Pruitt
See Also:
Schema

Field Summary
protected  java.util.List<Schema> list
           
protected  java.util.Map<java.lang.String,Schema> map
           
protected  java.lang.String name
           
 
Constructor Summary
Model()
          Constructor.
 
Method Summary
 Schema add(Schema schema)
          Adds a Schema to the Model.
 boolean contains(Schema schema)
          Tests whether the Model contains the Schema given
 boolean contains(java.lang.String name)
          Tests whether the Model contains a Schema by the name given
 Schema get(int index)
          Gets a Schema from the Model by the index.
 Schema get(java.lang.String name)
          Gets a Schema by the Schema's name
 java.lang.String getName()
          Gets the name of the Model.
 boolean isEmpty()
          Returns true if the Model does not contain any Schemas
 java.util.Iterator<Schema> iterator()
          Gets an iterator over the Schemas in the Model
 void setName(java.lang.String name)
          Sets the name of the Model.
 int size()
          Gets the number of Schemas in the Model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

map

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

list

protected final java.util.List<Schema> list
Constructor Detail

Model

public Model()
Constructor.

Method Detail

getName

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

Returns:
the name

setName

public void setName(java.lang.String name)
Sets the name of the Model.

Parameters:
name - the name of the Model.

add

public Schema add(Schema schema)
Adds a Schema to the Model.

Parameters:
schema - the Schema to add to the Model
Returns:
the Schema that was added

get

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

Parameters:
index - the index of the Schema
Returns:
the Schema

get

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

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

contains

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

Parameters:
name - the name of the Schema
Returns:
true if the Model contains a Schema by the name

contains

public boolean contains(Schema schema)
Tests whether the Model contains the Schema given

Parameters:
schema - the Schema
Returns:
true if the Model contains the Schema

isEmpty

public boolean isEmpty()
Returns true if the Model does not contain any Schemas

Returns:
true if the Model is empty

size

public int size()
Gets the number of Schemas in the Model

Returns:
the number of Schemas in the Model

iterator

public java.util.Iterator<Schema> iterator()
Gets an iterator over the Schemas in the Model

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