/** * * C O P Y R I G H T N O T I C E * Copyright (c) 2001 by: * * The MicroArray Gene Expression Database group (MGED) * * Rosetta Inpharmatics * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * * @author $Author: rhubley $ * @version $Revision: 1.6 $ * */ package org.biomage.tools.generate_classes; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import java.util.Vector; import org.biomage.tools.helpers.StringOutputHelpers; import org.w3c.dom.*; /** * Description: * Base Class for other classes to generate files. * */ abstract public class CreateFile { /** * Description: * The environment specific new line. */ final static protected String NEWLINE = (String) java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator")); /** * Description: * Variables to indicate whether class is abstract. */ protected boolean isAbstract = false; /** * Description: * Returns whether the class is abstract. * *

* @return returns baseClassName *

*/ public boolean isAbstract() { return isAbstract; } /** * Description: * Indicates whether this class is a base class. */ protected boolean isBaseClass = false; /** * Description: * Returns whether this is a base class. * *

* @return returns baseClassName *

*/ public boolean isBaseClass() { return isBaseClass; } /** * Description: * Is this class ultimately identifiable. */ protected boolean isIdentifiable = false; /** * Description: * Returns whether this class is identifiable. * *

* @return returns isIdentifiable *

*/ public boolean isIdentifiableClass() { return isIdentifiable; } /** * Description: * Will this class need a package list? */ protected boolean isIndependent = false; /** * Description: * Will this class need a package list? * *

* @return returns boolean true or false. *

*/ public boolean isIndependentClass() { return isIndependent; } /** * Description: * Allows the isIndependent Variable to be set in this class. * *

* @param isIndependent - will this class need to be in the package list *

*/ public void setIsIndependentClass( boolean isIndependent ) { this.isIndependent = isIndependent; } /** * 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. * *

* @param id2classFiles: map to look up the base class CreateFile *

*/ public void registerWithBaseClass( Map id2classFiles ) { if (null != getBaseClassID()) { ((CreateFile) id2classFiles.get(getBaseClassID())).registerSubClassName(this, id2classFiles, true); } } /** * Description: * Vector of the subclasses' names. */ protected Vector subClassNames = new Vector(); /** * Description: * Vector of the instantiable subclass names. */ protected Vector concreteSubClassNames = new Vector(); /** * Description: * Called to add a subclass name to the vector. Sets isBaseClass * to true. * *

* @param the subclass whose class name to add. *

*/ public void registerSubClassName( CreateFile subClass, Map id2classFiles, boolean immediate ) { isBaseClass = true; if (immediate) { subClassNames.add(subClass.getClassFileName()); } if (!subClass.isAbstract()) { concreteSubClassNames.add(subClass.getClassFileName()); } if (null != getBaseClassID()) { // Register with parent base class also ((CreateFile) id2classFiles.get(getBaseClassID())).registerSubClassName(subClass, id2classFiles, false); } // set the aggregation to match if the base class is aggregated (some subclasses are owned, // even if their base class isn't) if (XMIParseHelpers.NOT_AGGR != typeOwned) { subClass.typeOwned(typeOwned); } // if the base class is referenced, then so will the concrete subclasses if (isReferenced) { subClass.isReferenced(isReferenced); } // Now that the base class is certain to have been created, register with the subclass subClass.setBaseClassCreateFile(this); } /** * Description: * A vector of the instantiable subclass class names. * *

* @return the concrete subclass class names *

*/ public Vector getConcreteSubClassNames() { return concreteSubClassNames; } /** * Description: * Package this class belongs to. */ protected String packageName = "Common"; /** * Description: * Returns Set of packageImports. * *

* @return returns set of packageImports *

*/ public Set getImports() { return packageImports; } protected String packageDoc = "Package for classes used by all the other classes in the project"; /** * Description: * Returns Class name. * *

* @return returns className *

*/ public String getPackageName() { return packageName; } /** * Description: * List of Packages needed in the import list. */ protected Set packageImports = new TreeSet(); protected boolean importSerializable = true; /** * Description: * Returns whether the class needs to import Serializable. * *

* @return returns set of packageImports *

*/ public boolean importSerializable() { return importSerializable; } protected boolean importVector = false; /** * Description: * Returns whether the class needs to import Vector. * *

* @return returns value of importVector *

*/ public boolean importVector() { return importVector; } protected boolean importDate = false; /** * Description: * Returns whether the class needs to import Date. * *

* @return returns value of importDate *

*/ public boolean importDate() { return importDate; } /** * Description: * Class name. */ protected String className = null; /** * Description: * Returns Class name. * *

* @return returns className *

*/ public String getClassFileName() { return className; } /** * Description: * Visibility of the class. */ protected String visibility = "private"; /** * Description: * Returns the visibility. * *

* @return the visibility *

*/ public String getVisibility() { return visibility; } /** * Description: * Class, if any, that is the base class for this class. */ protected String baseClassName = null; /** * Description: * Returns the base class name. * *

* @return the baseClassName *

*/ public String getBaseClassFileName() { return baseClassName; } /** * Description: * Class, if any, that is the base class for this class. */ protected CreateFile baseClassCreateFile = null; /** * Description: * Returns the base class createFile. Handy for traversing the inheritence * hierarchy. * *

* @return the baseClassCreateFile *

*/ public CreateFile getBaseClassCreateFile() { return baseClassCreateFile; } /** * Description: * sets the base class createFile. Handy for traversing the inheritence * hierarchy. * *

* @param the baseClassCreateFile *

*/ public void setBaseClassCreateFile( CreateFile baseClassCreateFile ) { this.baseClassCreateFile = baseClassCreateFile; } /** * Description: * Interfaces, if any, that this class implements. */ protected Vector interfaceInfo = null; /** * Description: * Returns interfaceInfo. * *

* @return the interfaceInfo *

*/ public Vector getInterfaceInfo() { return interfaceInfo; } /** * Description: * The element node for the base class. */ protected String baseClassID = null; /** * Description: * Returns the base class name. * *

* @return the baseClassID *

*/ public String getBaseClassID() { return baseClassID; } /** * Description: * Documentation for this class. */ protected String classDoc = null; /** * Description: * Returns the documentation for the class. * *

* @return the classDoc *

*/ public String getClassDoc() { return classDoc; } /** * Description: * The information on the simple datatypes attributes for this class. */ protected Vector dataAttrInfo = null; /** * Description: * The information on the class association attributes for this class. */ protected Vector associationInfo = null; /** * Description: * Returns the Vector of association information. * *

* @return the associationInfo *

*/ public Vector getAssociationInfo() { return associationInfo; } /** * Description: * The information on the methods for this class. */ protected Vector methodInfo = null; /** * Description: * Returns the Vector of method information. * *

* @return the methodInfo *

*/ public Vector getMethodInfo() { return methodInfo; } /** * Description: * Whether any association needs a reference to this class. */ protected boolean isReferenced = false; /** * Description: * Whether this class is referenced by an association. * *

* @return isReferenced *

*/ public boolean isReferenced() { return isReferenced; } /** * Description: * Sets whether this class is referenced by an association. * *

* @return isReferenced *

*/ protected void isReferenced( boolean isReferenced ) { this.isReferenced = isReferenced; } /** * Description: * Returns the Vector of attribute information. * *

* @return the dataAttrInfo *

*/ public Vector getAttrInfo() { return dataAttrInfo; } /** * Description: * The information on whether this class's lifetime is owned by * some other class. */ protected int typeOwned = XMIParseHelpers.NOT_AGGR; /** * Description: * Returns how the class is owned. * *

* @return returns type of aggregation *

*/ public int typeOwned() { return typeOwned; } /** * Description: * Sets how the class is owned. Called by the base class * to pass on aggregation. * *

* @param sets the typeOwned to the parameter value *

*/ public void typeOwned( int typeOwned ) { this.typeOwned = typeOwned; } /** * Description: * The information on whether this is an interface. */ protected boolean isInterface = false; /* * Description: * Simple inner class to hold the information on roles for this class. */ public class RoleInformation { /* * Description: * C'tor for RoleInformation. */ protected RoleInformation( int card, int typeRole ) { this.card = card; this.typeRole = typeRole; } /* * Description: * Variable for whether role name adorned with "list". */ protected int card; /* * Description: * Returns the back cardinality of the association. *

* @return the back cardinality of the association *

*/ public int getCard() { return card; } /* * Description: * Variable for whether role name adorned with "ref". */ protected int typeRole; /* * Description: * Returns the type of aggregation of the role. *

* @return the type of aggregation of the role. *

*/ public int getTypeRole() { return typeRole; } /* * Description: * Overwrites base class equals. *

* @return whether the class is RoleInformation and, if so, if the * member variables are the same. *

*/ public boolean equals( Object object ) { if ( this == object ) { return true; } else if ( object == null || getClass() != object.getClass() ) { return false; } RoleInformation other = (RoleInformation) object; return (card == other.card && typeRole == other.typeRole); } } /** * Description: * The information on the rolenames to create for this class's associstions. */ protected Map roleNames = new TreeMap(); /** * Description: * Returns whether the role names for this class. * *

* @return the roleNames *

*/ public Map getRoleNames() { return roleNames; } /** * Description: * Adds the role name to the tree. * *

* @param newRoleName: the role name to add. * @param card: the max cardinality of the role. *

*/ public void addRoleName( String newRoleName, int card, int typeRole ) { roleNames.put(newRoleName, new RoleInformation(card, typeRole)); } /** * Description: * Obtains the ID of a package from a class node. * *

* @param classNode: node representing the class with the information * that can be used to find the attributes and associations. *

* *

* @return a string which is the class name. *

* */ protected static String getPackageID( Element classNode ) throws Exception { String packageID = null; NodeList nameSpaceNode = classNode.getElementsByTagName("Foundation.Core.ModelElement.namespace"); NodeList packageNode = (null == nameSpaceNode || null == nameSpaceNode.item(0)? null : ((Element) nameSpaceNode.item(0)).getElementsByTagName("Foundation.Core.Namespace")); if ( !(null == packageNode || null == packageNode.item(0)) ) { packageID = ((Element) packageNode.item(0)).getAttribute("xmi.idref"); } return packageID; } /** * Description: * Obtains the documentation for the given id. * *

* @param id2extInfo: map where documentation for the class can be * found * @param id: id to use as the lookup. *

* *

* @return a string which is the documentation. *

* */ protected static String getDocumentation( Map id2extInfo, String id ) throws Exception { String documentation = null; Vector extMechs_list = (Vector) id2extInfo.get(id); if (null != extMechs_list) { for (int i = 0; i < extMechs_list.size(); i++) { CreateMageClassFileList.ExtensionMechanisms extMechs = (CreateMageClassFileList.ExtensionMechanisms) extMechs_list.elementAt(i); if(extMechs.tag.equals("documentation")) { documentation = extMechs.value; break; } } } return documentation; } /** * Description: * Inner class to hold attribute information. Checks to see if * the data type is an enum and adjusts the information * accordingly. * */ abstract public class AttrInformation { String name = null; String scope = null; String datatype = null; String comment = null; boolean isEnum = false; Vector enumValues = new Vector(); /** * Description: * C'tor for class. *

* @param name: name of the attribute. * @param scope: visibility of the attribute. * @param datatype: datatype or enumeration values. * @param comment: optional comment. *

*/ protected AttrInformation( String name, String scope, String datatype, String comment ) throws Exception { initialize(name, scope, datatype, comment); } /** * Description: * C'tor for class. *

* @param name: name of the attribute. * @param scope: visibility of the attribute. * @param datatype: datatype or enumeration values. * @param comment: optional comment. *

*/ protected void initialize( String name, String scope, String datatype, String comment ) throws Exception { if (null != name) { this.name = name.trim(); } if (null != scope) { this.scope = scope.trim(); } if (null != datatype) { this.datatype = datatype.trim(); // Check for special types if (datatype.trim().equalsIgnoreCase("date")) { importDate = true; } } this.comment = comment; } /** * Description: * Get method for name. * *

* @return name. *

*/ public String getName() throws Exception { return name; } /** * Description: * Get method for scope. * *

* @return scope. *

*/ public String getScope() throws Exception { return scope; } /** * Description: * Get method for datatype. * *

* @return datatype. *

*/ public String getDatatype() throws Exception { return datatype; } /** * Description: * Get method for comment. * *

* @return comment. *

*/ public String getComment() throws Exception { return comment; } /** * Description: * Get method for whether the datatype is an enumeration. * *

* @return true if the datype is an enumeration, false otherwise. *

*/ public boolean isEnum() throws Exception { return isEnum; } /** * Description: * Get method for whether the datatype is an enumeration. * *

* @return true if the datype is an enumeration, false otherwise. *

*/ public Vector getEnumValues() throws Exception { return enumValues; } } // Moved this here so both package and MAGE classes can use it. // --mm 5/22/02 /** * Description: * Inner class to hold association attribute information. * Checks to see if the association is a multivalued and adjusts * the information accordingly. Since this is for the * Identifier lists, names are munged slightly differently * than the base class case. * */ public class IdentifierAttrInformation extends AssociationAttrInformation { CreateFile classFile = null; /** * Description: * C'tor for class. *

* @param classFile: for Packages, this holds the information for its association. *

*/ protected IdentifierAttrInformation( CreateFile classFile, boolean isList ) throws Exception { ////////////////////added 0, -1 for this card/////////////////////////////////////////// super(classFile.getClassFileName(), "public", classFile.getClassFileName(), classFile.getClassDoc(), 0, (isList? -1 : 1), 0, (isList? -1 : 1), XMIParseHelpers.NOT_AGGR, false, null, false, false, false, false); /////////////////////////////////////////////////////////////// this.classFile = classFile; } /** * Description: * Method that returns whether the role's class is abstract. * *

* @return true if the classFile is abstract, false otherwise. *

*/ public boolean isAbstract() throws Exception { return classFile.isAbstract(); } /** * Description: * Method to return the underlying CreateFile the association is based on. * *

* @return the classFile. *

*/ public CreateFile getCreateFile() throws Exception { return classFile; } } /** * Description: * Creates an association from the input association, using as rank the passed in parameter. * *

* @param assn: the association to use to create a new association * @param rank: the rank to assign the association. *

* * */ public void addAssociation( AssociationAttrInformation assn, Integer rank ) throws Exception { if (null == associationInfo) { associationInfo = new Vector(); } associationInfo.add(new AssociationAttrInformation(assn, rank)); } /** * Description: * Creates an association from the input association, using as rank, minCard and * maxCard the passed in parameters. * *

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

* * */ public void addAssociation( AssociationAttrInformation assn, Integer rank, int minCard, int maxCard, int thisMinCard, /////////////////////////// int thisMaxCard, /////////////////////////// boolean thisNav,///////////////////////////// boolean otherNav //////////////////////////// ) throws Exception { if (null == associationInfo) { associationInfo = new Vector(); } //////////////////////////////////////////////////////////////////////////// associationInfo.add(new AssociationAttrInformation(assn, rank, minCard, maxCard, thisMinCard, thisMaxCard, thisNav, otherNav)); } /** * Description: * Creates an association from the input parameters. * *

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

* * */ public void addAssociation( String name, String scope, String datatype, String comment, int minCard, int maxCard, int thisMinCard,/////////////////////////////////// int thisMaxCard,/////////////////////////////////// int typeAggregate, boolean isOrdered, Integer rank, boolean isOwner, boolean pointsToIdentifiable, boolean thisNav, /////////////////////////////// boolean otherNav ////////////////////////////// ) throws Exception { if (null == associationInfo) { associationInfo = new Vector(); } ////////////////////////////////////////////////////////////////// associationInfo.add(new AssociationAttrInformation(name, scope, datatype, comment, minCard, maxCard, thisMinCard, thisMaxCard, typeAggregate, isOrdered, rank, isOwner, pointsToIdentifiable, thisNav, otherNav)); /////////////////////////////////////////////////////////////////// } /////////////////////////////////////////////////////////////////////// /** * Description: * Inner class to hold association attribute information. * Checks to see if the association is a multivalued and adjusts * the information accordingly. * */ /////////////////////////////////////////////////////////////////////////////////////// public class AssociationAttrInformation extends AttrInformation { protected int minCard = 0; protected int maxCard = 0; protected int thisMinCard = 0; ////////////////////////////////// protected int thisMaxCard = 0; ////////////////////////////////// protected boolean thisNav = false; //////////////////////////// protected boolean otherNav = false; /////////////////////////// protected int typeAggregate = XMIParseHelpers.NOT_AGGR; protected boolean isOrdered = false; // Used when multi-valued protected String originalType = null; protected Integer rank = null; protected boolean isOwner = false; protected boolean pointsToIdentifiable = false; /** * Description: * C'tor for class. *

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

*/ protected AssociationAttrInformation( String name, String scope, String datatype, String comment, int minCard, int maxCard, int thisMinCard, ////////////////////////////////////////// int thisMaxCard, ////////////////////////////////////////// int typeAggregate, boolean isOrdered, Integer rank, boolean isOwner, boolean pointsToIdentifiable, boolean thisNav, /////////////////////////////////// boolean otherNav /////////////////////////////////// ) throws Exception { super(name, scope, datatype, comment); ////////////////////////////////////////////////////////////// initialize(minCard, maxCard, thisMinCard, thisMaxCard, typeAggregate, isOrdered, rank, isOwner, pointsToIdentifiable, thisNav, otherNav); /////////////////////////////////////////////////////////////// } /** * Description: * C'tor for class. *

* @param assn: association to use as the basis of this association. * @param rank: the place this association fits in assocaition order. *

*/ public AssociationAttrInformation( AssociationAttrInformation assn, Integer rank ) throws Exception { // In essence, clone the association with a potential change in rank super(assn.name, assn.scope, assn.datatype, assn.comment); ////////////////////////////////////////////////////////////////// initialize(assn.minCard, assn.maxCard, assn.thisMinCard, assn.thisMaxCard, assn.typeAggregate, assn.isOrdered, rank, assn.isOwner, assn.pointsToIdentifiable, assn.thisNav, assn.otherNav); /////////////////////////////////////////////////////////////// } /** * Description: * C'tor for class. *

* @param assn: association to use as the basis of this association. * @param rank: the place this association fits in assocaition order. * @param minCard: the minimum number of objects for this association * allowed for it to be valid. * @param maxCard: the maximum number of objects for this association * allowed for it to be valid. * @param thisMinCard: the minimum number of objects for this association * allowed for it to be valid. * @param thisMaxCard: the maximum number of objects for this association * allowed for it to be valid. *

*/ public AssociationAttrInformation( AssociationAttrInformation assn, Integer rank, int minCard, int maxCard, int thisMinCard,///////////////////////// int thisMaxCard, ///////////////////// boolean thisNav, ////////////////////////// boolean otherNav ////////////////////////// ) throws Exception { // In essence, clone the association with a potential change in rank super(assn.name, assn.scope, assn.datatype, assn.comment); initialize(minCard, maxCard, thisMinCard, thisMaxCard, assn.typeAggregate, assn.isOrdered, rank, assn.isOwner, assn.pointsToIdentifiable, assn.thisNav, assn.otherNav); } /** * Description: * Initializer for class. *

* @param minCard: the minimum number of objects for this association * allowed for it to be valid. * @param maxCard: the maximum number of objects for this association * allowed for it to be valid. * @param thisMinCard: the minimum number of objects for this association * allowed for it to be valid. * @param thisMaxCard: the maximum number of objects for this association * allowed for it to be valid. * @param typeAggregate: type of the aggregation. * @param isOrdered: true if order is important. * @param rank: the place this association fits in assocaition order. * @param isOwner: whether the association end class owns this class. *

*/ protected void initialize( int minCard, int maxCard, int thisMinCard, //////////////////////////// int thisMaxCard, /////////////////////////////// int typeAggregate, boolean isOrdered, Integer rank, boolean isOwner, boolean pointsToIdentifiable, boolean thisNav, ////////////////////////// boolean otherNav ////////////////////////// ) throws Exception { this.minCard = minCard; this.maxCard = maxCard; this.thisMinCard = thisMinCard; ////////////////////////// this.thisMaxCard = thisMaxCard; ////////////////////////// this.typeAggregate = typeAggregate; this.isOrdered = isOrdered; this.originalType = datatype; this.rank = rank; this.isOwner = isOwner; this.thisNav = thisNav; //////////////////////////////// this.otherNav = otherNav; ////////////////////////////// if (-1 == maxCard || 1 < maxCard) { importVector = true; // Switch the datatype to be the list name datatype = StringOutputHelpers.initialCap(name) + "_list"; } this.pointsToIdentifiable = pointsToIdentifiable; } /** * Description: * Get method for minCard. * *

* @return minCard. *

*/ public int getMinCard() throws Exception { return minCard; } /** * Description: * Get method for maxCard. * *

* @return maxCard. *

*/ public int getMaxCard() throws Exception { return maxCard; } /** * Description: * Get method for thisMinCard. * *

* @return thisMinCard. *

*/ public int getThisMinCard() throws Exception { return thisMinCard; } /** * Description: * Get method for thisMaxCard. * *

* @return thisMaxCard. *

*/ public int getThisMaxCard() throws Exception { return thisMaxCard; } /** * Description: * Get method for thisNav. * *

* @return thisNav. *

*/ public boolean getThisNav() throws Exception { return thisNav; } /** * Description: * Get method for otherNav. * *

* @return otherNav. *

*/ public boolean getOtherNav() throws Exception { return otherNav; } /////////////////////////////////////// /** * Description: * Get method for type of aggregated. * *

* @return typeAggregate. *

*/ public int getTypeAggregated() throws Exception { return typeAggregate; } /** * Description: * Get method for isOrdered. * *

* @return isOrdered. *

*/ public boolean getIsOrdered() throws Exception { return isOrdered; } /** * Description: * Get method for originalType. * *

* @return originalType. *

*/ public String getOriginalType() throws Exception { return originalType; } /** * Description: * Get rank of this assocaition to the others. * *

* @return the rank. *

*/ public Integer getRank() throws Exception { return rank; } /** * Description: * Returns whether this associations end class owns this * class. Used for DTD generation to ignore this association * in the content list. * *

* @return isOwner. *

*/ public boolean isOwner() throws Exception { return isOwner; } /** * Description: * Does this association point to an Identifiable class? This is a necessary question * for the cPP code generation as that changes the container used underneath. * *

* @return pointsToIdentifiable. *

*/ public boolean pointsToIdentifiableClass() { return pointsToIdentifiable; } /** * Description: * Writes the name of the association role, capitulized. * *

* @return the name of the association role capitulized. *

* */ public String toString() { return StringOutputHelpers.initialCap(name); } // Added this for Transform to change an associations minCard // --mm 05/22/02 /** * Description: * Writes the name of the association role, capitulized. * *

* @return the name of the association role capitulized. *

* */ public void makeOptional() { minCard = 0; } } /** * Description: * Enumeration to represent the different model elements. */ final public static int UML_MODEL = 0; final public static int UML_PACKAGE = 1; final public static int UML_CLASS = 2; final public static int JAVA_INTERFACE = 3; /** * Description: * Returns what kind of model element this class is based on. * * @return returns an enumerated int to indicate the class */ abstract public int getFileType(); }