org.biomage.tools.generate_classes
Class CreateClassFile

java.lang.Object
  extended by org.biomage.tools.generate_classes.CreateFile
      extended by org.biomage.tools.generate_classes.CreateClassFile
Direct Known Subclasses:
CreateTransformedClassFile

public class CreateClassFile
extends CreateFile

Description: Class that is resposible for generating a java file for the class represented by the class node passed into the constructor.


Nested Class Summary
 class CreateClassFile.DataTypeAttrInformation
          Description: Inner class to hold datatype attribute information.
 class CreateClassFile.MethodInformation
          Description: Inner class to hold method information.
 
Nested classes/interfaces inherited from class org.biomage.tools.generate_classes.CreateFile
CreateFile.AssociationAttrInformation, CreateFile.AttrInformation, CreateFile.IdentifierAttrInformation, CreateFile.RoleInformation
 
Field Summary
 
Fields inherited from class org.biomage.tools.generate_classes.CreateFile
associationInfo, baseClassCreateFile, baseClassID, baseClassName, classDoc, className, concreteSubClassNames, dataAttrInfo, importDate, importSerializable, importVector, interfaceInfo, isAbstract, isBaseClass, isIdentifiable, isIndependent, isInterface, isReferenced, JAVA_INTERFACE, methodInfo, NEWLINE, packageDoc, packageImports, packageName, roleNames, subClassNames, typeOwned, UML_CLASS, UML_MODEL, UML_PACKAGE, visibility
 
Constructor Summary
  CreateClassFile()
          Description: Default Constructor for the class file generator.
protected CreateClassFile(org.w3c.dom.Element xmiNode, org.w3c.dom.Element classNode, java.util.Map id2classes, java.util.Map id2extInfo, java.util.Map id2packages, java.util.Map id2dataType, java.util.Map id2associations, java.util.Map id2constraint)
          Description: Constructor for the class file generator.
  CreateClassFile(java.lang.String name, java.lang.String packageName, java.lang.String comment, int typeOwned)
          Description: Constructor for the class file generator.
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.String scope, java.lang.String datatype, java.lang.String comment, java.lang.String initialValue, boolean isRequired)
          Description: Adds an attribute to this create file.
protected  java.util.Vector associationInformation(org.w3c.dom.Element classNode, java.util.Map id2classes, java.util.Map id2packages, java.util.Map id2extInfo, java.util.Map id2associations, java.util.Map id2constraint)
          Description: Puts together the information on the class associations.
protected  java.util.Vector dataAttributeInformation(org.w3c.dom.Element classNode, java.util.Map id2extInfo, java.util.Map id2dataType)
          Description: Puts together the information on the simple datatypes.
 int getFileType()
          Description: Returns what kind of model element this class is based on.
 java.lang.String getID()
          Description: Obtains the XMI id.
protected  void headerInformation(org.w3c.dom.Element xmiNode, org.w3c.dom.Element classNode, java.util.Map id2classes, java.util.Map id2extInfo, java.util.Map id2packages)
          Description: Obtains the information to generate the information for the package and the declaration of the class.
protected  java.util.Vector methodInformation(org.w3c.dom.Element classNode, java.util.Map id2classes, java.util.Map id2dataType, java.util.Map id2packages, java.util.Map id2extInfo)
          Description: Puts together the information on the class methods.
protected  int typeAggregated(org.w3c.dom.Element endNode)
          Description: returns the type of aggregation.
 
Methods inherited from class org.biomage.tools.generate_classes.CreateFile
addAssociation, addAssociation, addAssociation, addRoleName, getAssociationInfo, getAttrInfo, getBaseClassCreateFile, getBaseClassFileName, getBaseClassID, getClassDoc, getClassFileName, getConcreteSubClassNames, getDocumentation, getImports, getInterfaceInfo, getMethodInfo, getPackageID, getPackageName, getRoleNames, getVisibility, importDate, importSerializable, importVector, isAbstract, isBaseClass, isIdentifiableClass, isIndependentClass, isReferenced, isReferenced, registerSubClassName, registerWithBaseClass, setBaseClassCreateFile, setIsIndependentClass, setVisibility, typeOwned, typeOwned
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateClassFile

protected CreateClassFile(org.w3c.dom.Element xmiNode,
                          org.w3c.dom.Element classNode,
                          java.util.Map id2classes,
                          java.util.Map id2extInfo,
                          java.util.Map id2packages,
                          java.util.Map id2dataType,
                          java.util.Map id2associations,
                          java.util.Map id2constraint)
                   throws java.lang.Exception
Description: Constructor for the class file generator.

Parameters:
xmiNode: - top node beneath which information for the class can be found.
classNode: - node representing the class with the information that can be used to find the attributes and associations.
id2classes: - map to class nodes for import, base class, and other info.
id2extInfo: - map where documentation for the class can be found.
id2packages: - map where the package for the class can be found.
id2dataType: - map where the datatypes for the attributes can be found.
id2associations: - map where the associations for a class can be found.
id2constraint: - map where the constraints for an association end can be found.

Throws:
java.lang.Exception

CreateClassFile

public CreateClassFile(java.lang.String name,
                       java.lang.String packageName,
                       java.lang.String comment,
                       int typeOwned)
                throws java.lang.Exception
Description: Constructor for the class file generator.

Parameters:
name: - name to give the class.
comment: - documentation for this class.

Throws:
java.lang.Exception

CreateClassFile

public CreateClassFile()
                throws java.lang.Exception
Description: Default Constructor for the class file generator.

Throws:
java.lang.Exception
Method Detail

getID

public java.lang.String getID()
                       throws java.lang.Exception
Description: Obtains the XMI id.

Returns:
the id obtained from the XMI file

Throws:
java.lang.Exception

headerInformation

protected void headerInformation(org.w3c.dom.Element xmiNode,
                                 org.w3c.dom.Element classNode,
                                 java.util.Map id2classes,
                                 java.util.Map id2extInfo,
                                 java.util.Map id2packages)
                          throws java.lang.Exception
Description: Obtains the information to generate the information for the package and the declaration of the class.

Parameters:
xmiNode: - top node beneath which information for the class can be found
classNode: - node representing the class with the information that can be used to find the attributes and associations.
id2classes: - map to class nodes for import, base class, and other info.
id2extInfo: - map where documentation for the class can be found
id2packages: - map where the package for the class can be found

Throws:
java.lang.Exception

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String scope,
                         java.lang.String datatype,
                         java.lang.String comment,
                         java.lang.String initialValue,
                         boolean isRequired)
                  throws java.lang.Exception
Description: Adds an attribute to this create file.

Parameters:
name: - name of the attribute.
scope: - visibility of the attribute.
datatype: - datatype or enumeration values.
comment: - optional comment.
initialValue: - initial value, if any, for this attribute.
isRequired: - true if the attribute is required.

Throws:
java.lang.Exception

dataAttributeInformation

protected java.util.Vector dataAttributeInformation(org.w3c.dom.Element classNode,
                                                    java.util.Map id2extInfo,
                                                    java.util.Map id2dataType)
                                             throws java.lang.Exception
Description: Puts together the information on the simple datatypes.

Parameters:
xmiNode: - top node beneath which information for the class can be found
classNode: - node representing the class with the information that can be used to find the attributes and associations.
id2extInfo: - map where documentation for the class can be found

Returns:
Vector of AttrInformations

Throws:
java.lang.Exception

typeAggregated

protected int typeAggregated(org.w3c.dom.Element endNode)
                      throws java.lang.Exception
Description: returns the type of aggregation.

Parameters:
endNode: - other end association node to check the aggregation attibute.

Returns:
true if aggregated, false otherwise

Throws:
java.lang.Exception

associationInformation

protected java.util.Vector associationInformation(org.w3c.dom.Element classNode,
                                                  java.util.Map id2classes,
                                                  java.util.Map id2packages,
                                                  java.util.Map id2extInfo,
                                                  java.util.Map id2associations,
                                                  java.util.Map id2constraint)
                                           throws java.lang.Exception
Description: Puts together the information on the class associations. Overwrites base class to handle multi-valued assocaitions

Parameters:
classNode: - node representing this class.
id2classes: - map to the classes for information for association.
id2packages: - map to the packages for import information.
id2extInfo: - map to the comments.
id2associations: - map to the comments.
id2constraint: - map to the constraints.

Returns:
Vector of ClassAttrInformations

Throws:
java.lang.Exception

methodInformation

protected java.util.Vector methodInformation(org.w3c.dom.Element classNode,
                                             java.util.Map id2classes,
                                             java.util.Map id2dataType,
                                             java.util.Map id2packages,
                                             java.util.Map id2extInfo)
                                      throws java.lang.Exception
Description: Puts together the information on the class methods.

Parameters:
classNode: - node representing this class.
id2classes: - map to the classes for information for parameters.
id2dataType: - map to the datatypes for parameters.
id2packages: - map to the packages for import information.
id2extInfo: - map to the comments.

Returns:
Vector of ClassAttrInformations

Throws:
java.lang.Exception

getFileType

public int getFileType()
Description: Returns what kind of model element this class is based on.

Specified by:
getFileType in class CreateFile
Returns:
returns that this represents the model itself