uk.ac.ic.doc.automed.templates.wrapper
Class DefaultTemplate

java.lang.Object
  extended by uk.ac.ic.doc.automed.templates.wrapper.TemplateCompilerSimulator
      extended by uk.ac.ic.doc.automed.templates.wrapper.DefaultTemplate

public class DefaultTemplate
extends TemplateCompilerSimulator

The DefaultTemplate class enables the definition of template transformations at run-time.

An example of using the DefaultTemplate class follows:
  DefaultTemplate template = new DefaultTemplate(model, name, description);
  template.INPUTS();
     //definition of template's inputs, e.g.
     TemplateCompilerSimulator.OBJECT existingEntity = template.askForObject("Existing entity", entity);
  template.START();
     //template program definition, e.g.
     existingEntity.DELETE(function);
  template.END();


Nested Class Summary
 
Nested classes/interfaces inherited from class uk.ac.ic.doc.automed.templates.wrapper.TemplateCompilerSimulator
TemplateCompilerSimulator.CONSTRAINTS, TemplateCompilerSimulator.CONSTRAINTSLIST, TemplateCompilerSimulator.CONSTRUCT, TemplateCompilerSimulator.FUNCTION, TemplateCompilerSimulator.FUNCTIONLIST, TemplateCompilerSimulator.ITEM, TemplateCompilerSimulator.LIST, TemplateCompilerSimulator.NAME, TemplateCompilerSimulator.NAMELIST, TemplateCompilerSimulator.OBJECT, TemplateCompilerSimulator.OBJECTLIST, TemplateCompilerSimulator.SCHEME, TemplateCompilerSimulator.STRING, TemplateCompilerSimulator.STRINGLIST
 
Field Summary
 
Fields inherited from class uk.ac.ic.doc.automed.templates.wrapper.TemplateCompilerSimulator
aliases, awf, COLLECTING, CONSTRUCT, currentForeachVariables, currentKey, currentScopeStack, defaultModel, DEFINING_FOREACH_VARIABLES, DEFINING_IF_VALRIABLES, DEFINING_INPUT_VARIABLES, FINISHED, foreachStack, ifStack, initialSchemaKey, inputVariables, lastSchema, loopStatementsStack, mainTemplate, METHOD_PREFIX, outerMostVariables, STARTED, state, templateStatements, temporaryForeachOutputVariables, TypeConstraints, TypeConstraintsList, TypeFunction, TypeFunctionList, TypeItem, TypeList, TypeName, TypeNameList, TypeObject, TypeObjectList, TypeString, TypeStringList, VARIABLE_PREFIX, WRITTING_CODE
 
Constructor Summary
DefaultTemplate()
          Instantiates a template transformation.
DefaultTemplate(Model model, java.lang.String name, java.lang.String description)
          Instantiates a template transformation.
 
Method Summary
 java.lang.String defaultModel()
          Return the AutoMed Model that the template transformation will generate or delete SchemaObjects in
protected  void defineTemplate()
           
 java.lang.String getDescription()
          Returns the description of the template transformation
 Model getModel()
          Returns the model of the template transformation
 java.lang.String getName()
          Returns the name of the template transformation
 void INPUTS()
           
 void setDescription(java.lang.String d)
          Sets the description of the template transformation.
 void setModel(Model m)
          Sets the model of the template transformation.
 void setName(java.lang.String name)
          Sets the name of the template transformation.
 void START()
           
protected  java.lang.String templateDescription()
           
 java.lang.String templateName()
          Return the name used to identify the template transformation that will be compiled by an implementation of this class.
 
Methods inherited from class uk.ac.ic.doc.automed.templates.wrapper.TemplateCompilerSimulator
ADD, ADD, ADD, ADD, ADD, ALIAS, askForConstraints, askForConstraintsList, askForConstraintsList, askForFunction, askForFunctionList, askForFunctionList, askForName, askForNameList, askForNameList, askForObject, askForObject, askForObjectList, askForObjectList, askForObjectList, askForObjectList, buildTemplate, COLLECTS, CONTRACT, CONTRACT, CONTRACT, CONTRACT, CONTRACT, CREATE_LIST, DEFINE_CONSTRAINTS, DEFINE_CONSTRAINTS, DEFINE_CONSTRAINTS, DEFINE_CONSTRAINTS, DEFINE_FUNCTION, DEFINE_FUNCTION, DEFINE_FUNCTION, DEFINE_FUNCTION, DEFINE_NAME, DEFINE_NAME, DEFINE_NAME, DEFINE_NAME, DEFINE_STRING, DEFINE_STRING, DEFINE_STRING, DEFINE_STRING, DEFINE_STRING, DEFINE_STRING, DELETE, DELETE, DELETE, DELETE, DELETE, DO, END, ENDFOREACH, EXTEND, EXTEND, EXTEND, EXTEND, EXTEND, FOREACH, getNextKey, IN, IN, IN, IN, IN, IN, initialise, my, newInput, removeFromScope, SCHEME_LIST, setDefaultModel, setForeachTemplateSchema, SIZEOF, VARIES_WITH, VARIES_WITH, VARIES_WITH
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTemplate

public DefaultTemplate(Model model,
                       java.lang.String name,
                       java.lang.String description)
                throws java.lang.Exception
Instantiates a template transformation.

Parameters:
model - the model of the transformation
name - the name of the transformation
description - the description of the transformation
Throws:
java.lang.Exception

DefaultTemplate

public DefaultTemplate()
                throws java.lang.Exception
Instantiates a template transformation. The template doesn't have a model, a name nor a description.

Throws:
java.lang.Exception
Method Detail

templateName

public java.lang.String templateName()
Description copied from class: TemplateCompilerSimulator
Return the name used to identify the template transformation that will be compiled by an implementation of this class.

Specified by:
templateName in class TemplateCompilerSimulator

templateDescription

protected java.lang.String templateDescription()
Specified by:
templateDescription in class TemplateCompilerSimulator

defaultModel

public java.lang.String defaultModel()
Description copied from class: TemplateCompilerSimulator
Return the AutoMed Model that the template transformation will generate or delete SchemaObjects in

Specified by:
defaultModel in class TemplateCompilerSimulator

defineTemplate

protected void defineTemplate()
                       throws java.lang.Exception
Specified by:
defineTemplate in class TemplateCompilerSimulator
Throws:
java.lang.Exception

INPUTS

public void INPUTS()
Overrides:
INPUTS in class TemplateCompilerSimulator

START

public void START()
Overrides:
START in class TemplateCompilerSimulator

setName

public void setName(java.lang.String name)
             throws java.lang.Exception
Sets the name of the template transformation.

Parameters:
name - the name of the transformation
Throws:
java.lang.Exception - if the definition of this template has already started, i.e. the name of the transformation cannot be set if the input (INPUT()) or the program (START()) definition has started

getName

public java.lang.String getName()
Returns the name of the template transformation

Returns:
the name of the template transformation

setModel

public void setModel(Model m)
              throws java.lang.Exception
Sets the model of the template transformation.

Parameters:
model - the model of the transformation
Throws:
java.lang.Exception - if the definition of this template has already started, i.e. the model of the transformation cannot be set if the input (INPUT()) or the program (START()) definition has started

getModel

public Model getModel()
Returns the model of the template transformation

Returns:
the model of the template transformation

setDescription

public void setDescription(java.lang.String d)
                    throws java.lang.Exception
Sets the description of the template transformation.

Parameters:
description - the description of the transformation
Throws:
java.lang.Exception - if the definition of this template has already started, i.e. the description of the transformation cannot be set if the input (INPUT()) or the program (START()) definition has started

getDescription

public java.lang.String getDescription()
Returns the description of the template transformation

Returns:
the description of the template transformation