org.cesta.trans
Interface Transformation

All Known Implementing Classes:
AbstractRewriteTransformation, AbstractTransformation, CheckTransactions, IfSwitchReplacement, ShadowVariables, ValidateStateTransitions

public interface Transformation

Interface for all transformations. Before the transformation is executed, one or multiple file pairs (input and output file) are specified. Optionally, an user can specify some parameters. Main transformation's logic is executed after calling execute(). The framework doesn't know how or if the files are transformed and written to destination files. It only provides convinient interface, which should fit to any general transformation on set of files. The transformation itself can therefore contain many phases (analysis, some computations) before destination files are generated. The only problem with interface is, that it can't specify constructor. Each transformation should have constructor without any parameters, otherwise it won't be instanciated by framework. Programmers can use ANTLR in their transformations, but this is not forced.


Method Summary
 void addMappedFile(MappedFile mappedFile)
          Adds one mapped fileswhich should be transformed
 void clearParams()
          Clears all parameters
 void execute()
          Executes main logic of transformation
 java.util.List<MappedFile> getMappedFiles()
          Returns list of mapped files, which should be transformed
 java.lang.Object getParam(java.lang.String name)
          Gets one single parameter
 java.lang.Object getParam(java.lang.String name, java.lang.Object defaultValue)
          Gets one single parameter
 java.util.Map<java.lang.String,java.lang.Object> getParams()
          Returns map of parameters, which were passed to transformation
 void setMappedFiles(java.util.List<MappedFile> mappedFiles)
          Sets list of mapped files, which should be transformed
 void setParam(java.lang.String name, java.lang.Object value)
          Sets one single parameter
 void setParams(java.util.Map<java.lang.String,java.lang.Object> params)
          Sets set of parameters
 

Method Detail

getMappedFiles

java.util.List<MappedFile> getMappedFiles()
Returns list of mapped files, which should be transformed

Returns:
List of mapped files

setMappedFiles

void setMappedFiles(java.util.List<MappedFile> mappedFiles)
Sets list of mapped files, which should be transformed

Parameters:
mappedFiles - mapped files

addMappedFile

void addMappedFile(MappedFile mappedFile)
Adds one mapped fileswhich should be transformed

Parameters:
mappedFile - mapped file

getParams

java.util.Map<java.lang.String,java.lang.Object> getParams()
Returns map of parameters, which were passed to transformation

Returns:
map of parameters

setParams

void setParams(java.util.Map<java.lang.String,java.lang.Object> params)
Sets set of parameters

Parameters:
params - set of parameters

setParam

void setParam(java.lang.String name,
              java.lang.Object value)
Sets one single parameter

Parameters:
name - name of parameter
value - value of parameter

getParam

java.lang.Object getParam(java.lang.String name)
Gets one single parameter

Parameters:
name - name of parameter
Returns:
value of parameter or null if not found

getParam

java.lang.Object getParam(java.lang.String name,
                          java.lang.Object defaultValue)
Gets one single parameter

Parameters:
name - name of parameter
defaultValue - default value
Returns:
param value or default value if param not set

clearParams

void clearParams()
Clears all parameters


execute

void execute()
             throws TransformationException
Executes main logic of transformation

Throws:
TransformationException - if transformation has failed