org.biomage.tools.generate_dtd
Class WriteDTDClassElement

java.lang.Object
  extended by org.biomage.tools.generate_dtd.WriteDTDElement
      extended by org.biomage.tools.generate_dtd.WriteDTDClassElement

public class WriteDTDClassElement
extends WriteDTDElement

Description: Class that is resposible for generating the DTD entities, if base class, and element and attribute if not abstract for the CreateClassFile passed into the c'tor.


Field Summary
protected  java.lang.String entityPrefix
          Description: String to use as prefix for the entities for this class.
protected static java.lang.String NEWLINE
           
 
Constructor Summary
protected WriteDTDClassElement(CreateFile createFile)
          Description: Constructor for classes for the DTD file generator.
 
Method Summary
protected  void addAttributeComments(java.util.Vector attrInfos, java.lang.StringBuffer commentsBuffer, java.lang.String typeAttr)
          Description: Adds the documentation for the attributes passed in.
protected  void createAttrs(java.lang.StringBuffer buffer)
          Description: Creates the attribute entity for the class.
protected  void createAttrsEntity(java.lang.StringBuffer entitiesBuffer)
          Description: Creates the attribute entity for the class.
protected  void createChoices(java.lang.StringBuffer buffer, java.util.Vector choices, java.lang.String offset)
          Description: Creates all the possibilities of ordering the vector of choices.
protected  void createClassesEntity(java.lang.StringBuffer entitiesBuffer)
          Description: Creates the classes entity and, if not owned, the ref entity.
protected  void createClassesOrRefEntity(java.lang.StringBuffer entitiesBuffer, java.lang.String adornment)
          Description: Creates either classes entity or the ref entity, depending on adornment parameter.
protected  java.lang.String createComment()
          Description: Creates the documentation for the class.
protected  java.lang.String createContainer(CreateFile.AssociationAttrInformation assnInfo)
          Description: Creates the name of the container for the association passed in.
protected  void createContent(java.lang.StringBuffer buffer)
          Description: Creates the content entity for the class.
protected  void createContentEntity(java.lang.StringBuffer entitiesBuffer)
          Description: Creates the content entity for the class.
protected  void createElementAndAttlist(java.lang.StringBuffer elementBuffer)
          Description: If not owned, creates the *_ref element and attlist then creates the element and attlist declarations for the class.
protected  java.lang.String createElementAndAttlists()
          Description: Creates the different element and attlist declarations for the class.
protected  java.lang.String createEntities()
          Description: Creates the different entities for the class.
protected  void createReference(java.lang.StringBuffer elementBuffer)
          Description: If not owned, creates the *_ref element and attlist then creates the element and attlist declarations for the class.
protected  void createRoleDeclarations(java.lang.StringBuffer elementBuffer)
          Description: Creates the element and attlist declarations for the role names of the class.
protected  void createXMLStrings()
          Description: Creates the different entities, elements and attlists for the class.
protected  void writeBody(java.io.FileWriter writer)
          Description: Method to write out entities.
protected  void writeEntities(java.io.FileWriter writer)
          Description: Method to write out entities.
 
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

entityPrefix

protected final java.lang.String entityPrefix
Description: String to use as prefix for the entities for this class.

Constructor Detail

WriteDTDClassElement

protected WriteDTDClassElement(CreateFile createFile)
                        throws java.lang.Exception
Description: Constructor for classes for the DTD file generator.

Parameters:
createFile: - the class to write to the DTD.

Throws:
java.lang.Exception
Method Detail

createXMLStrings

protected void createXMLStrings()
                         throws java.lang.Exception
Description: Creates the different entities, elements and attlists for the class.

Specified by:
createXMLStrings in class WriteDTDElement
Parameters:
packageOrdering: - the XML configuration element for package ordering information. Not used by this subclass.

Throws:
java.lang.Exception

createComment

protected java.lang.String createComment()
                                  throws java.lang.Exception
Description: Creates the documentation for the class.

Returns:
the completed string with the appropriate attributes and association documentation.

Throws:
java.lang.Exception

addAttributeComments

protected void addAttributeComments(java.util.Vector attrInfos,
                                    java.lang.StringBuffer commentsBuffer,
                                    java.lang.String typeAttr)
                             throws java.lang.Exception
Description: Adds the documentation for the attributes passed in.

Parameters:
attrInfos: - the vector of attributes to add documentation.
commentsBuffer: - buffer to fill with the comments for the attributes of this class.
typeAttr: - will be either "attributes" or "associations".

Throws:
java.lang.Exception

createEntities

protected java.lang.String createEntities()
                                   throws java.lang.Exception
Description: Creates the different entities for the class.

Returns:
the completed string with the appropriate entity declarations for this class.

Throws:
java.lang.Exception

createClassesEntity

protected void createClassesEntity(java.lang.StringBuffer entitiesBuffer)
                            throws java.lang.Exception
Description: Creates the classes entity and, if not owned, the ref entity.

Parameters:
entitiesBuffer: - buffer to fill with the appropriate entities for this class.

Throws:
java.lang.Exception

createClassesOrRefEntity

protected void createClassesOrRefEntity(java.lang.StringBuffer entitiesBuffer,
                                        java.lang.String adornment)
                                 throws java.lang.Exception
Description: Creates either classes entity or the ref entity, depending on adornment parameter.

Parameters:
entitiesBuffer: - buffer to fill with the appropriate entities for this class.
adornment: - suffix for the entity, either "_classes" or "_ref".

Throws:
java.lang.Exception

createContentEntity

protected void createContentEntity(java.lang.StringBuffer entitiesBuffer)
                            throws java.lang.Exception
Description: Creates the content entity for the class.

Parameters:
entitiesBuffer: - buffer to fill with the content entity for this class.

Throws:
java.lang.Exception

createAttrsEntity

protected void createAttrsEntity(java.lang.StringBuffer entitiesBuffer)
                          throws java.lang.Exception
Description: Creates the attribute entity for the class.

Parameters:
entitiesBuffer: - buffer to fill with the attrs entity for this class.

Throws:
java.lang.Exception

createElementAndAttlists

protected java.lang.String createElementAndAttlists()
                                             throws java.lang.Exception
Description: Creates the different element and attlist declarations for the class.

Returns:
the completed string with the appropriate declarations.

Throws:
java.lang.Exception

createRoleDeclarations

protected void createRoleDeclarations(java.lang.StringBuffer elementBuffer)
                               throws java.lang.Exception
Description: Creates the element and attlist declarations for the role names of the class.

Throws:
java.lang.Exception

createReference

protected void createReference(java.lang.StringBuffer elementBuffer)
                        throws java.lang.Exception
Description: If not owned, creates the *_ref element and attlist then creates the element and attlist declarations for the class.

Parameters:
elementBuffer: - buffer to use to create the declarations.

Throws:
java.lang.Exception

createElementAndAttlist

protected void createElementAndAttlist(java.lang.StringBuffer elementBuffer)
                                throws java.lang.Exception
Description: If not owned, creates the *_ref element and attlist then creates the element and attlist declarations for the class.

Parameters:
elementBuffer: - buffer to use to create the declarations.

Throws:
java.lang.Exception

createContent

protected void createContent(java.lang.StringBuffer buffer)
                      throws java.lang.Exception
Description: Creates the content entity for the class.

Parameters:
buffer: - buffer to fill with the content for this class.

Throws:
java.lang.Exception

createChoices

protected void createChoices(java.lang.StringBuffer buffer,
                             java.util.Vector choices,
                             java.lang.String offset)
                      throws java.lang.Exception
Description: Creates all the possibilities of ordering the vector of choices. Special case has been removed so this code isn't called. Left here in case it is needed in the future.

Parameters:
buffer: - buffer to fill with the choices from the Vector.
choices: - names of the differenct choices.

Throws:
java.lang.Exception

createContainer

protected java.lang.String createContainer(CreateFile.AssociationAttrInformation assnInfo)
                                    throws java.lang.Exception
Description: Creates the name of the container for the association passed in.

Parameters:
assnInfo: - the association to create the container name for.

Throws:
java.lang.Exception

createAttrs

protected void createAttrs(java.lang.StringBuffer buffer)
                    throws java.lang.Exception
Description: Creates the attribute entity for the class.

Parameters:
buffer: - buffer to fill with the attrs for this class.

Throws:
java.lang.Exception

writeEntities

protected void writeEntities(java.io.FileWriter writer)
                      throws java.lang.Exception
Description: Method to write out entities.

Overrides:
writeEntities in class WriteDTDElement
Parameters:
write: - the writer to use.

Throws:
java.lang.Exception

writeBody

protected void writeBody(java.io.FileWriter writer)
                  throws java.lang.Exception
Description: Method to write out entities.

Overrides:
writeBody in class WriteDTDElement
Parameters:
write: - the writer to use.

Throws:
java.lang.Exception