|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.hedgehog.HObject
com.hedgehog.model.Model
public class Model
Title: Model - a model of objects.
Description: Represents a model of ModelObject objects.
Copyright: Copyright (c) Hedgehog Software.
Company: Hedgehog Software.
| Field Summary | |
|---|---|
protected IDManager |
mIDManager
Model ID manager. |
protected IDSetManager |
mIDSetManager
Model ID set manager. |
protected MaterialManager |
mMaterialManager
Model material manager |
protected ModelDatabaseManager |
mModelDatabaseManager
Model database manager. |
protected java.lang.String |
mModelDescription
A brief description of this model. |
protected ModelObjectAttributeManager |
mModelObjectAttributeManager
Model object attribute manager. |
protected java.util.Hashtable<ID,ModelObject> |
mModelObjects
Hash map of model objects. |
protected ModelState |
mModelState
Model state object. |
protected UnitManager |
mUnitManager
Model units manager |
| Fields inherited from class com.hedgehog.HObject |
|---|
mID, mName |
| Constructor Summary | |
|---|---|
Model()
Default constructor. |
|
Model(java.util.Hashtable<ID,ModelObject> modelObjects)
Constructor. |
|
Model(ID id)
Constructor. |
|
Model(Model object)
Copy constructor. |
|
Model(java.lang.String name)
Default constructor. |
|
Model(java.lang.String name,
ID id)
Default constructor. |
|
| Method Summary | |
|---|---|
boolean |
addModelObjectAttribute(ID modelObjectID,
Attribute attribute)
Adds the specified (ID,attribute) association to this model's attribute manager. |
boolean |
addModelObjectAttributes(ID modelObjectID,
Attributes attributes)
Adds the specified vector of attribute, associating them the specified ID. |
boolean |
addObject(ID id,
ModelObject object)
Adds an object to this model. |
boolean |
addObject(ModelObject object)
Same as addObject(ID id,ModelObject object) except that the ID is extracted from the specified ModelObject. |
boolean |
addObjectOnly(ID id,
ModelObject object)
As addObject() except that adds only the specified object and no child objects of the specified object. |
boolean |
addObjectOnly(ModelObject object)
As addObject() except that adds only the specified object and no child objects of the specified object. |
java.util.Vector<AttributeType> |
attributeType(ID modelObjectID)
Returns the vector of attribute types for the specified object ID. |
void |
clear()
Flushes this model. |
static PairPQ<DatabaseImport,Model> |
fromDatabase(java.sql.Connection connection,
int modelID)
Imports a model from the specified database. |
static PairPQ<XMLImport,Model> |
fromXML(java.io.File file)
Imports a model from the specified file in xml file. |
ID |
generateID()
Generates a new unique minimum available ID. |
java.util.Hashtable<java.lang.String,ModelObject> |
getAllDatabaseModelObjects()
Internally used for storing the IDs of all model objects and child objects when loading a model from a database. |
IntHashtable |
getAllModelObjects()
Internally used for storing the IDs of all model objects and child objects when loading a model from an xml file. |
AttributeManager |
getAttributeManager()
Returns the model object attribute manager. |
IDManager |
getIDManager()
Returns the ID manager. |
IDSetManager |
getIDSetManager()
Returns the ID set manager. |
MaterialManager |
getMaterialManager()
Returns the material manager. |
ModelDatabaseManager |
getModelDatabaseManager()
Returns the database manager. |
java.lang.String |
getModelDescription()
Returns the model description. |
ModelObject |
getModelObject(ID id)
Returns the model object associated with the specified ID. |
Attributes |
getModelObjectAttributes(ID modelObjectID)
Returns the Attributes object associated with the specified ID. |
java.util.Hashtable<ID,ModelObject> |
getModelObjects()
Returns the hash map of model objects. |
ModelObjectAttributeManager |
getModelObjectsAttributeManager()
Returns the model object attribute manager. |
ModelState |
getModelState()
Returns the model state object. |
UnitManager |
getUnitManager()
Returns the unit manager. |
boolean |
hasModelObjectAttributes()
Tests whether or not this model has any attributes. |
boolean |
hasModelObjects()
Tests whether or not this model has any model objects. |
boolean |
isChildObjectID(ID id)
Tests whether or not the specified ID is an ID of a child object of this model's mModelObjects map. |
boolean |
isModelObject(ModelObject object)
Tests whether or not the specified object is managed by this manager. |
boolean |
isModelObjectAttribute(ID modelObjectID)
Tests whether or not the specified ID is managed by this model's attribute manager. |
boolean |
isModelObjectID(ID id)
Tests whether or not the specified ID is an object ID managed by this manager. |
java.util.Vector<java.lang.String> |
modelObjectClassNames()
Returns a vector of model object simple class names. |
int |
numberOfModelObjects()
Returns the number of model objects. |
boolean |
objectInModel(ModelObject object)
Tests whether or not the specified object is in this model. |
boolean |
removeObject(java.lang.Object object)
Removes the specified object from this model, if present. |
void |
setAttributeManager(AttributeManager attributeManager)
Sets the model object attribute manager. |
void |
setIDManager(IDManager idManager)
Sets the ID manager. |
void |
setIDSetManager(IDSetManager idSetManager)
Sets the ID set manager. |
void |
setMaterialManager(MaterialManager materialManager)
Sets the material manager. |
void |
setModelDatabaseManager(ModelDatabaseManager modelDatabaseManager)
Sets the database manager. |
void |
setModelDescription(java.lang.String description)
Sets the model description. |
boolean |
setModelObjectIDs()
Sets the IDs of all model objects and child nodes (if any) if their ID is equal to the default ID. |
void |
setModelObjects(java.util.Hashtable<ID,ModelObject> newModelObjects)
Sets the model map of objects. |
void |
setModelObjectsAttributeManager(ModelObjectAttributeManager modelObjectAttributeManager)
Sets the model object attribute manager. |
void |
setModelState(ModelState modelState)
Sets the model state object. |
void |
setUnitManager(UnitManager unitManager)
Sets the unit manager. |
DatabaseExport |
toDatabase(java.sql.Connection connection,
boolean updateObjectIDs)
Exports this model's objects to the specified database. |
java.lang.String |
toString()
Returns a String representation of this Model object. |
X3DExport |
toX3D(java.io.File file,
ProfileType profileType,
X3DObject x3dObject)
Exports this model to the specified file in X3D format. |
XMLExport |
toXML(java.io.File file)
Exports this model's objects and object attributes to the specified file in xml format. |
| Methods inherited from class com.hedgehog.HObject |
|---|
clone, compare, compareTo, copy, equals, getID, getName, hashCode, hasID, hasName, setID, setName |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable<ID,ModelObject> mModelObjects
protected IDManager mIDManager
protected IDSetManager mIDSetManager
protected UnitManager mUnitManager
protected MaterialManager mMaterialManager
protected ModelObjectAttributeManager mModelObjectAttributeManager
protected ModelDatabaseManager mModelDatabaseManager
protected ModelState mModelState
protected java.lang.String mModelDescription
| Constructor Detail |
|---|
public Model()
public Model(ID id)
id - Model ID.public Model(java.lang.String name)
name - Model name.
public Model(java.lang.String name,
ID id)
name - Model name.id - Model ID.
public Model(java.util.Hashtable<ID,ModelObject> modelObjects)
throws java.lang.IllegalArgumentException
modelObjects - Hahs map of model objects.
java.lang.IllegalArgumentException - Thrown if a null argument of one of the objects in modelObjects does not implement the ModelObject interface.public Model(Model object)
object - Object to copy.| Method Detail |
|---|
public boolean isModelObjectID(ID id)
id - ID to test.
public boolean isModelObject(ModelObject object)
object - Object to test.
public boolean isChildObjectID(ID id)
id - ID to search for.
public boolean isModelObjectAttribute(ID modelObjectID)
modelObjectID - Model object ID to test.
public java.util.Vector<AttributeType> attributeType(ID modelObjectID)
modelObjectID - Object ID.
public void clear()
public boolean addObject(ModelObject object)
throws java.lang.IllegalArgumentException
object - Object to add.
java.lang.IllegalArgumentException - Thrown if null argument.
public boolean addObject(ID id,
ModelObject object)
throws java.lang.IllegalArgumentException
id - Object ID. If equal to the default ID of -1 then a new and unique ID is generated by the ID manager and the object's ID
is set to this new ID and used to add the object to the model.object - Object to add.
java.lang.IllegalArgumentException - Thrown if null argument or if the specified object does not implement ModelObject or if the specified ID is currently being used by another object.
public boolean addObjectOnly(ModelObject object)
throws java.lang.IllegalArgumentException
object - Object to add.
java.lang.IllegalArgumentException
public boolean addObjectOnly(ID id,
ModelObject object)
throws java.lang.IllegalArgumentException
id - Object ID. If equal to the default ID of -1 then a new and unique ID is generated by the ID manager and the object's ID
is set to this new ID and used to add the object to the model.object - Object to add.
java.lang.IllegalArgumentException
public boolean addModelObjectAttribute(ID modelObjectID,
Attribute attribute)
modelObjectID - ID.attribute - Attribute.
public boolean addModelObjectAttributes(ID modelObjectID,
Attributes attributes)
modelObjectID - ID.attributes - Attributes.
public ID generateID()
public IDManager getIDManager()
public void setIDManager(IDManager idManager)
idManager - New ID manager.public IDSetManager getIDSetManager()
public void setIDSetManager(IDSetManager idSetManager)
idSetManager - New ID set manager.public UnitManager getUnitManager()
public void setUnitManager(UnitManager unitManager)
unitManager - New unit manager.public MaterialManager getMaterialManager()
public void setMaterialManager(MaterialManager materialManager)
materialManager - New material manager.public AttributeManager getAttributeManager()
public void setAttributeManager(AttributeManager attributeManager)
attributeManager - New model object attribute manager.public ModelObjectAttributeManager getModelObjectsAttributeManager()
public void setModelObjectsAttributeManager(ModelObjectAttributeManager modelObjectAttributeManager)
modelObjectAttributeManager - New model object attribute manager.public ModelDatabaseManager getModelDatabaseManager()
public void setModelDatabaseManager(ModelDatabaseManager modelDatabaseManager)
modelDatabaseManager - New database manager.public java.lang.String getModelDescription()
public void setModelDescription(java.lang.String description)
description - New model description.public ModelState getModelState()
public void setModelState(ModelState modelState)
modelState - New model state obejct.public java.util.Hashtable<ID,ModelObject> getModelObjects()
public ModelObject getModelObject(ID id)
id - ID.
public Attributes getModelObjectAttributes(ID modelObjectID)
modelObjectID - Attribute ID.
public int numberOfModelObjects()
public boolean hasModelObjects()
public boolean hasModelObjectAttributes()
public boolean objectInModel(ModelObject object)
throws java.lang.IllegalArgumentException
object - Object to test.
java.lang.IllegalArgumentException - Thrown if object is null.
public boolean removeObject(java.lang.Object object)
throws java.lang.IllegalArgumentException
object - Object to remove.
java.lang.IllegalArgumentException - Thrown if object is null.
public void setModelObjects(java.util.Hashtable<ID,ModelObject> newModelObjects)
throws java.lang.IllegalArgumentException
newModelObjects - New map of model objects.
java.lang.IllegalArgumentException - Thrown if newModelObjects is null.public boolean setModelObjectIDs()
public java.lang.String toString()
toString in class java.lang.Object
public XMLExport toXML(java.io.File file)
throws InvalidObjectException
file - Export file object.
InvalidObjectException - Thrown if an error writing this model.
public static PairPQ<XMLImport,Model> fromXML(java.io.File file)
throws InvalidObjectException,
java.lang.IllegalArgumentException
file - Import file object.
InvalidObjectException - Thrown if an error occurred building the model from the specified xml file.
java.lang.IllegalArgumentException - Thrown if the specified model ID is not found in the specified file.
public DatabaseExport toDatabase(java.sql.Connection connection,
boolean updateObjectIDs)
throws java.sql.SQLException,
InvalidObjectException
connection - Database connection.updateObjectIDs - Specifies whether or not model object IDs are to be updated to match those of the database.
java.sql.SQLException - Thrown if an SQL exception occurs.
InvalidObjectException - Thrown if this object is invalid.
public static PairPQ<DatabaseImport,Model> fromDatabase(java.sql.Connection connection,
int modelID)
throws java.sql.SQLException,
java.lang.IllegalArgumentException
connection - Database connection.modelID - Model ID.
java.sql.SQLException - Thrown if an SQL exception occurs.
java.lang.IllegalArgumentException - Thrown if connection is null or if modelID is not a Models table ID.
public X3DExport toX3D(java.io.File file,
ProfileType profileType,
X3DObject x3dObject)
throws InvalidObjectException
file - File object.profileType - Profile type.x3dObject - X3D governing object.
InvalidObjectException - Thrown if an invalid object is encountered.public java.util.Vector<java.lang.String> modelObjectClassNames()
public IntHashtable getAllModelObjects()
public java.util.Hashtable<java.lang.String,ModelObject> getAllDatabaseModelObjects()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||