com.steptools.stdev
Class Model

java.lang.Object
  extended by com.steptools.stdev.Model

public class Model
extends java.lang.Object

A unit of persistence for STEP data. A model is the in-memory representation for the data in a STEP File. A model holds the EntityInstances, as well some management data.

The instances are contained in population objects. In addition, the model may contain properties which are used to annotate the in-memory representation of the data.


Constructor Summary
Model()
           
Model(SchemaBase sch)
          Create a model with the specified schema as the default schema
 
Method Summary
 void addProperty(java.lang.Object key, java.lang.Object value)
          Adds a property to the model.
 PopulationBase getPopulation()
          Gets the default population in model.
 PopulationBase getPopulation(java.lang.Object id)
          Gets the requested population be identifier.
 java.util.Collection getPopulations()
          Gets all the populations in model
 java.lang.Object getProperty(java.lang.Object key)
          Gets the property for the specified key
 PopulationBase newPopulation(SchemaBase sch, java.lang.Object id)
          Creates a new population in the model.
 java.util.Set propertyKeys()
          Gets all the property keys
 void removePopulation(java.lang.Object id)
          Removes a population from the model
 void removePopulation(PopulationBase sect)
          Removes a population from the model
 void removeProperty(java.lang.Object key)
          Removed the property for the specified key
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Model

public Model(SchemaBase sch)
Create a model with the specified schema as the default schema

Parameters:
sch - The schema

Model

public Model()
Method Detail

newPopulation

public PopulationBase newPopulation(SchemaBase sch,
                                    java.lang.Object id)
                             throws DuplicatePopulationIDException
Creates a new population in the model. The population is identified by the specified object. Generally, the identifier is a String, but it does not need to be.

Parameters:
sch - The schema for which to create a population.
id - The identifier for the newly created section.
Returns:
The newly created population.
Throws:
DuplicateSectionIDException - - When a population already exists with the given identifier
DuplicatePopulationIDException

removePopulation

public void removePopulation(PopulationBase sect)
Removes a population from the model

Parameters:
pop - The population to remove.

removePopulation

public void removePopulation(java.lang.Object id)
Removes a population from the model

Parameters:
id - The identifier for the population to remove.

getPopulations

public java.util.Collection getPopulations()
Gets all the populations in model

Returns:
A collection of the populations in this Model.

getPopulation

public PopulationBase getPopulation()
Gets the default population in model. The default population is the one whose identifier is null. If the default population does not exist, one is created, is a default schema has been set.

Returns:
The default population.

getPopulation

public PopulationBase getPopulation(java.lang.Object id)
Gets the requested population be identifier.

Parameters:
id - The identifier of the population to retreive.
Returns:
The requested population.

addProperty

public void addProperty(java.lang.Object key,
                        java.lang.Object value)
Adds a property to the model. Properties may have implement the RemoveListener interface, in which case, they will be notified when an instance is removed from any population in the model.

Parameters:
key - The identifier for the property.
value - The object that acts as the property.

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Gets the property for the specified key

Parameters:
key - The identifier for the property.
Returns:
The requested population.

removeProperty

public void removeProperty(java.lang.Object key)
Removed the property for the specified key

Parameters:
key - The identifier for the property.

propertyKeys

public java.util.Set propertyKeys()
Gets all the property keys

Returns:
the set of keys.