org.biomage.tools.generate_classes
Class CreateFile

java.lang.Object
  extended by org.biomage.tools.generate_classes.CreateFile
Direct Known Subclasses:
CreateClassFile, CreateInterfaceFile, CreateMAGEFile, CreatePackageFile, CreateTransformedInterfaceFile

public abstract class CreateFile
extends java.lang.Object

Description: Base Class for other classes to generate files.


Nested Class Summary
 class CreateFile.AssociationAttrInformation
          Description: Inner class to hold association attribute information.
 class CreateFile.AttrInformation
          Description: Inner class to hold attribute information.
 class CreateFile.IdentifierAttrInformation
          Description: Inner class to hold association attribute information.
 class CreateFile.RoleInformation
           
 
Field Summary
protected  java.util.Vector associationInfo
          Description: The information on the class association attributes for this class.
protected  CreateFile baseClassCreateFile
          Description: Class, if any, that is the base class for this class.
protected  java.lang.String baseClassID
          Description: The element node for the base class.
protected  java.lang.String baseClassName
          Description: Class, if any, that is the base class for this class.
protected  java.lang.String classDoc
          Description: Documentation for this class.
protected  java.lang.String className
          Description: Class name.
protected  java.util.Vector concreteSubClassNames
          Description: Vector of the instantiable subclass names.
protected  java.util.Vector dataAttrInfo
          Description: The information on the simple datatypes attributes for this class.
protected  boolean importDate
           
protected  boolean importSerializable
           
protected  boolean importVector
           
protected  java.util.Vector interfaceInfo
          Description: Interfaces, if any, that this class implements.
protected  boolean isAbstract
          Description: Variables to indicate whether class is abstract.
protected  boolean isBaseClass
          Description: Indicates whether this class is a base class.
protected  boolean isIdentifiable
          Description: Is this class ultimately identifiable.
protected  boolean isIndependent
          Description: Will this class need a package list?
protected  boolean isInterface
          Description: The information on whether this is an interface.
protected  boolean isReferenced
          Description: Whether any association needs a reference to this class.
static int JAVA_INTERFACE
           
protected  java.util.Vector methodInfo
          Description: The information on the methods for this class.
protected static java.lang.String NEWLINE
          Description: The environment specific new line.
protected  java.lang.String packageDoc
           
protected  java.util.Set packageImports
          Description: List of Packages needed in the import list.
protected  java.lang.String packageName
          Description: Package this class belongs to.
protected  java.util.Map roleNames
          Description: The information on the rolenames to create for this class's associstions.
protected  java.util.Vector subClassNames
          Description: Vector of the subclasses' names.
protected  int typeOwned
          Description: The information on whether this class's lifetime is owned by some other class.
static int UML_CLASS
           
static int UML_MODEL
          Description: Enumeration to represent the different model elements.
static int UML_PACKAGE
           
protected  java.lang.String visibility
          Description: Visibility of the class.
 
Constructor Summary
CreateFile()
           
 
Method Summary
 void addAssociation(CreateFile.AssociationAttrInformation assn, java.lang.Integer rank)
          Description: Creates an association from the input association, using as rank the passed in parameter.
 void addAssociation(CreateFile.AssociationAttrInformation assn, java.lang.Integer rank, int minCard, int maxCard, int thisMinCard, int thisMaxCard, boolean thisNav, boolean otherNav)
          Description: Creates an association from the input association, using as rank, minCard and maxCard the passed in parameters.
 void addAssociation(java.lang.String name, java.lang.String scope, java.lang.String datatype, java.lang.String comment, int minCard, int maxCard, int thisMinCard, int thisMaxCard, int typeAggregate, boolean isOrdered, java.lang.Integer rank, boolean isOwner, boolean pointsToIdentifiable, boolean thisNav, boolean otherNav)
          Description: Creates an association from the input parameters.
 void addRoleName(java.lang.String newRoleName, int card, int typeRole)
          Description: Adds the role name to the tree.
 java.util.Vector getAssociationInfo()
          Description: Returns the Vector of association information.
 java.util.Vector getAttrInfo()
          Description: Returns the Vector of attribute information.
 CreateFile getBaseClassCreateFile()
          Description: Returns the base class createFile.
 java.lang.String getBaseClassFileName()
          Description: Returns the base class name.
 java.lang.String getBaseClassID()
          Description: Returns the base class name.
 java.lang.String getClassDoc()
          Description: Returns the documentation for the class.
 java.lang.String getClassFileName()
          Description: Returns Class name.
 java.util.Vector getConcreteSubClassNames()
          Description: A vector of the instantiable subclass class names.
protected static java.lang.String getDocumentation(java.util.Map id2extInfo, java.lang.String id)
          Description: Obtains the documentation for the given id.
abstract  int getFileType()
          Description: Returns what kind of model element this class is based on.
 java.util.Set getImports()
          Description: Returns Set of packageImports.
 java.util.Vector getInterfaceInfo()
          Description: Returns interfaceInfo.
 java.util.Vector getMethodInfo()
          Description: Returns the Vector of method information.
protected static java.lang.String getPackageID(org.w3c.dom.Element classNode)
          Description: Obtains the ID of a package from a class node.
 java.lang.String getPackageName()
          Description: Returns Class name.
 java.util.Map getRoleNames()
          Description: Returns whether the role names for this class.
 java.lang.String getVisibility()
          Description: Returns the visibility.
 boolean importDate()
          Description: Returns whether the class needs to import Date.
 boolean importSerializable()
          Description: Returns whether the class needs to import Serializable.
 boolean importVector()
          Description: Returns whether the class needs to import Vector.
 boolean isAbstract()
          Description: Returns whether the class is abstract.
 boolean isBaseClass()
          Description: Returns whether this is a base class.
 boolean isIdentifiableClass()
          Description: Returns whether this class is identifiable.
 boolean isIndependentClass()
          Description: Will this class need a package list?
 boolean isReferenced()
          Description: Whether this class is referenced by an association.
protected  void isReferenced(boolean isReferenced)
          Description: Sets whether this class is referenced by an association.
 void registerSubClassName(CreateFile subClass, java.util.Map id2classFiles, boolean immediate)
          Description: Called to add a subclass name to the vector.
 void registerWithBaseClass(java.util.Map id2classFiles)
          Description: If the class is a subclass, registers with its base class.
 void setBaseClassCreateFile(CreateFile baseClassCreateFile)
          Description: sets the base class createFile.
 void setIsIndependentClass(boolean isIndependent)
          Description: Allows the isIndependent Variable to be set in this class.
 void setVisibility(java.lang.String vis)
          Description: Sets the visibility.
 int typeOwned()
          Description: Returns how the class is owned.
 void typeOwned(int typeOwned)
          Description: Sets how the class is owned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEWLINE

protected static final java.lang.String NEWLINE
Description: The environment specific new line.


isAbstract

protected boolean isAbstract
Description: Variables to indicate whether class is abstract.


isBaseClass

protected boolean isBaseClass
Description: Indicates whether this class is a base class.


isIdentifiable

protected boolean isIdentifiable
Description: Is this class ultimately identifiable.


isIndependent

protected boolean isIndependent
Description: Will this class need a package list?


subClassNames

protected java.util.Vector subClassNames
Description: Vector of the subclasses' names.


concreteSubClassNames

protected java.util.Vector concreteSubClassNames
Description: Vector of the instantiable subclass names.


packageName

protected java.lang.String packageName
Description: Package this class belongs to.


packageDoc

protected java.lang.String packageDoc

packageImports

protected java.util.Set packageImports
Description: List of Packages needed in the import list.


importSerializable

protected boolean importSerializable

importVector

protected boolean importVector

importDate

protected boolean importDate

className

protected java.lang.String className
Description: Class name.


visibility

protected java.lang.String visibility
Description: Visibility of the class.


baseClassName

protected java.lang.String baseClassName
Description: Class, if any, that is the base class for this class.


baseClassCreateFile

protected CreateFile baseClassCreateFile
Description: Class, if any, that is the base class for this class.


interfaceInfo

protected java.util.Vector interfaceInfo
Description: Interfaces, if any, that this class implements.


baseClassID

protected java.lang.String baseClassID
Description: The element node for the base class.


classDoc

protected java.lang.String classDoc
Description: Documentation for this class.


dataAttrInfo

protected java.util.Vector dataAttrInfo
Description: The information on the simple datatypes attributes for this class.


associationInfo

protected java.util.Vector associationInfo
Description: The information on the class association attributes for this class.


methodInfo

protected java.util.Vector methodInfo
Description: The information on the methods for this class.


isReferenced

protected boolean isReferenced
Description: Whether any association needs a reference to this class.


typeOwned

protected int typeOwned
Description: The information on whether this class's lifetime is owned by some other class.


isInterface

protected boolean isInterface
Description: The information on whether this is an interface.


roleNames

protected java.util.Map roleNames
Description: The information on the rolenames to create for this class's associstions.


UML_MODEL

public static final int UML_MODEL
Description: Enumeration to represent the different model elements.

See Also:
Constant Field Values

UML_PACKAGE

public static final int UML_PACKAGE
See Also:
Constant Field Values

UML_CLASS

public static final int UML_CLASS
See Also:
Constant Field Values

JAVA_INTERFACE

public static final int JAVA_INTERFACE
See Also:
Constant Field Values
Constructor Detail

CreateFile

public CreateFile()
Method Detail

isAbstract

public boolean isAbstract()
Description: Returns whether the class is abstract.

Returns:
returns baseClassName


isBaseClass

public boolean isBaseClass()
Description: Returns whether this is a base class.

Returns:
returns baseClassName


isIdentifiableClass

public boolean isIdentifiableClass()
Description: Returns whether this class is identifiable.

Returns:
returns isIdentifiable


isIndependentClass

public boolean isIndependentClass()
Description: Will this class need a package list?

Returns:
returns boolean true or false.


setIsIndependentClass

public void setIsIndependentClass(boolean isIndependent)
Description: Allows the isIndependent Variable to be set in this class.

Parameters:
isIndependent - - will this class need to be in the package list


registerWithBaseClass

public void registerWithBaseClass(java.util.Map id2classFiles)
Description: If the class is a subclass, registers with its base class. If the base class is aggregated, it then calls back to set its subclass as an aggregate also.

Parameters:
id2classFiles: - map to look up the base class CreateFile


registerSubClassName

public void registerSubClassName(CreateFile subClass,
                                 java.util.Map id2classFiles,
                                 boolean immediate)
Description: Called to add a subclass name to the vector. Sets isBaseClass to true.

Parameters:
the - subclass whose class name to add.


getConcreteSubClassNames

public java.util.Vector getConcreteSubClassNames()
Description: A vector of the instantiable subclass class names.

Returns:
the concrete subclass class names


getImports

public java.util.Set getImports()
Description: Returns Set of packageImports.

Returns:
returns set of packageImports


getPackageName

public java.lang.String getPackageName()
Description: Returns Class name.

Returns:
returns className


importSerializable

public boolean importSerializable()
Description: Returns whether the class needs to import Serializable.

Returns:
returns set of packageImports


importVector

public boolean importVector()
Description: Returns whether the class needs to import Vector.

Returns:
returns value of importVector


importDate

public boolean importDate()
Description: Returns whether the class needs to import Date.

Returns:
returns value of importDate


getClassFileName

public java.lang.String getClassFileName()
Description: Returns Class name.

Returns:
returns className


getVisibility

public java.lang.String getVisibility()
Description: Returns the visibility.

Returns:
the visibility


setVisibility

public void setVisibility(java.lang.String vis)
Description: Sets the visibility.


getBaseClassFileName

public java.lang.String getBaseClassFileName()
Description: Returns the base class name.

Returns:
the baseClassName


getBaseClassCreateFile

public CreateFile getBaseClassCreateFile()
Description: Returns the base class createFile. Handy for traversing the inheritence hierarchy.

Returns:
the baseClassCreateFile


setBaseClassCreateFile

public void setBaseClassCreateFile(CreateFile baseClassCreateFile)
Description: sets the base class createFile. Handy for traversing the inheritence hierarchy.

Parameters:
the - baseClassCreateFile


getInterfaceInfo

public java.util.Vector getInterfaceInfo()
Description: Returns interfaceInfo.

Returns:
the interfaceInfo


getBaseClassID

public java.lang.String getBaseClassID()
Description: Returns the base class name.

Returns:
the baseClassID


getClassDoc

public java.lang.String getClassDoc()
Description: Returns the documentation for the class.

Returns:
the classDoc


getAssociationInfo

public java.util.Vector getAssociationInfo()
Description: Returns the Vector of association information.

Returns:
the associationInfo


getMethodInfo

public java.util.Vector getMethodInfo()
Description: Returns the Vector of method information.

Returns:
the methodInfo


isReferenced

public boolean isReferenced()
Description: Whether this class is referenced by an association.

Returns:
isReferenced


isReferenced

protected void isReferenced(boolean isReferenced)
Description: Sets whether this class is referenced by an association.


getAttrInfo

public java.util.Vector getAttrInfo()
Description: Returns the Vector of attribute information.

Returns:
the dataAttrInfo


typeOwned

public int typeOwned()
Description: Returns how the class is owned.

Returns:
returns type of aggregation


typeOwned

public void typeOwned(int typeOwned)
Description: Sets how the class is owned. Called by the base class to pass on aggregation.

Parameters:
sets - the typeOwned to the parameter value


getRoleNames

public java.util.Map getRoleNames()
Description: Returns whether the role names for this class.

Returns:
the roleNames


addRoleName

public void addRoleName(java.lang.String newRoleName,
                        int card,
                        int typeRole)
Description: Adds the role name to the tree.

Parameters:
newRoleName: - the role name to add.
card: - the max cardinality of the role.


getPackageID

protected static java.lang.String getPackageID(org.w3c.dom.Element classNode)
                                        throws java.lang.Exception
Description: Obtains the ID of a package from a class node.

Parameters:
classNode: - node representing the class with the information that can be used to find the attributes and associations.

Returns:
a string which is the class name.

Throws:
java.lang.Exception

getDocumentation

protected static java.lang.String getDocumentation(java.util.Map id2extInfo,
                                                   java.lang.String id)
                                            throws java.lang.Exception
Description: Obtains the documentation for the given id.

Parameters:
id2extInfo: - map where documentation for the class can be found
id: - id to use as the lookup.

Returns:
a string which is the documentation.

Throws:
java.lang.Exception

addAssociation

public void addAssociation(CreateFile.AssociationAttrInformation assn,
                           java.lang.Integer rank)
                    throws java.lang.Exception
Description: Creates an association from the input association, using as rank the passed in parameter.

Parameters:
assn: - the association to use to create a new association
rank: - the rank to assign the association.

Throws:
java.lang.Exception

addAssociation

public void addAssociation(CreateFile.AssociationAttrInformation assn,
                           java.lang.Integer rank,
                           int minCard,
                           int maxCard,
                           int thisMinCard,
                           int thisMaxCard,
                           boolean thisNav,
                           boolean otherNav)
                    throws java.lang.Exception
Description: Creates an association from the input association, using as rank, minCard and maxCard the passed in parameters.

Parameters:
assn: - the association to use to create a new association
rank: - the rank to assign the association.
minCard: - the minimum number of objects for this association allowed for it to be valid.
maxCard: - the maximum number of objects for this association allowed for it to be valid.
thisMinCard: - the minimum number of objects for this association allowed for it to be valid.
thisMaxCard: - the maximum number of objects for this association allowed for it to be valid.

Throws:
java.lang.Exception

addAssociation

public void addAssociation(java.lang.String name,
                           java.lang.String scope,
                           java.lang.String datatype,
                           java.lang.String comment,
                           int minCard,
                           int maxCard,
                           int thisMinCard,
                           int thisMaxCard,
                           int typeAggregate,
                           boolean isOrdered,
                           java.lang.Integer rank,
                           boolean isOwner,
                           boolean pointsToIdentifiable,
                           boolean thisNav,
                           boolean otherNav)
                    throws java.lang.Exception
Description: Creates an association from the input parameters.

Parameters:
name: - name of the attribute.
scope: - visibility of the attribute.
datatype: - datatype or enumeration values.
comment: - optional comment.
minCard: - the minimum number of objects for this association allowed for it to be valid.
maxCard: - the maximum number of objects for this association allowed for it to be valid.
thisMinCard: - the minimum number of objects for this association allowed for it to be valid.
thisMaxCard: - the maximum number of objects for this association allowed for it to be valid.
typeAggregate: - type of the aggregation.
isOrdered: - true if order is important.
rank: - the place this association fits in assocaition order.
isOwner: - whether the association end class owns this class.

Throws:
java.lang.Exception

getFileType

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

Returns:
returns an enumerated int to indicate the class