org.sintef.mofscript.runtime
Class TransformationProxy

java.lang.Object
  extended by org.sintef.mofscript.runtime.TransformationProxy

public class TransformationProxy
extends java.lang.Object

Author:
jol

Constructor Summary
TransformationProxy(MOFScriptSpecification trSpec)
           
TransformationProxy(MOFScriptTransformation realTrans)
           
 
Method Summary
 void addImportedTransformation(java.lang.String importName, java.lang.String importUri, MOFScriptTransformation importedTransformation)
          Adds imported transformations to a collection
 java.lang.Object[] checkImportedRules(java.lang.String ruleName)
          Checks imported rules agains a rule name.
 java.util.Collection getAllImportedTransformationRules()
          Gets all teh imported transformation rules
 java.util.List getAllImportedVariables()
          Gets all the imported variables.
 java.util.Collection getAllTransformationRules(java.lang.String name)
          Gets all the transformation rules with the given "name"
 MOFScriptTransformation getClosestSuperWithRule(TransformationRule rule)
           
protected  java.util.Hashtable getCompleteRuleCache(java.lang.String ruleName)
          Gets the complete rule cache
 TransformationRule getEntryPoint()
          Traverses the rules and checks if entrypoint
 MOFScriptTransformation getImportedTransformation(java.lang.String name)
          Gets an imported transfromation with name == parameter name
 java.util.Collection getImportedTransformationRule(java.lang.String name)
          Gets all the importet transformation rules with a given name
 TransformationRule getImportedTransformationRule(java.lang.String name, java.lang.String possibleScoping, java.lang.String ownerTransformation)
          Gets a transformation rule according to the parameters
 java.util.Collection getImportedTransformations()
          Gets the imported transfromations
 java.lang.String getName()
           
protected  TransformationRule getNearestTransformation(java.util.Collection importedRules)
          Gets the nearest transfromation
 MOFScriptTransformation getTransformation()
           
 TransformationRule getTransformationRule(java.lang.String name)
          Gets the transformation rules based on "name"
 TransformationRule getTransformationRuleForType(FunctionCall f, java.lang.String name, java.lang.String ownerTransformation, java.lang.String possibleScope, java.lang.Object contextObject)
          Gets the transformation rule according to the parameters given
 java.util.Collection getTransformationRules()
          Gets the transformation rules
 MOFScriptSpecification getTransformationSpecification()
           
 boolean hasOtherRuleWithName(TransformationRule rule)
           
 boolean hasRuleWithName(java.lang.String ruleName)
          Checks if the rule cache has a rule with a given ruleName
 boolean isSuperTransformation(MOFScriptTransformation transformation)
          Checks whether a transformation is a super transformation
protected  boolean isSuperTypeOf(MOFScriptTransformation potentialSuper, MOFScriptTransformation potentialSub)
          Checs whether a transformation is the super type of another
protected  boolean ownedByThisOrSuper(java.lang.String ownerTransformation)
          Returns whether the transfromation is owned by this or the super
 void setTransformationSpecification(MOFScriptSpecification trSpec)
          Sets the transformation specification
 boolean superHasRule(java.lang.String ruleName)
          Checks whether a super transfromation has a rule with a given name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformationProxy

public TransformationProxy(MOFScriptTransformation realTrans)
Parameters:
realTrans -

TransformationProxy

public TransformationProxy(MOFScriptSpecification trSpec)
Parameters:
trSpec -
Method Detail

getTransformation

public MOFScriptTransformation getTransformation()
Returns:
the transformation

getTransformationSpecification

public MOFScriptSpecification getTransformationSpecification()
Returns:
the transformation specification

getName

public java.lang.String getName()
Returns:
the transformation's name

getEntryPoint

public TransformationRule getEntryPoint()
Traverses the rules and checks if entrypoint

Returns:
the transformation rule that is entry point

getCompleteRuleCache

protected java.util.Hashtable getCompleteRuleCache(java.lang.String ruleName)
Gets the complete rule cache

Parameters:
ruleName -
Returns:

setTransformationSpecification

public void setTransformationSpecification(MOFScriptSpecification trSpec)
Sets the transformation specification

Parameters:
trSpec -

hasRuleWithName

public boolean hasRuleWithName(java.lang.String ruleName)
Checks if the rule cache has a rule with a given ruleName

Parameters:
ruleName -
Returns:
true if rule exists in cache

hasOtherRuleWithName

public boolean hasOtherRuleWithName(TransformationRule rule)
Parameters:
rule -
Returns:

getClosestSuperWithRule

public MOFScriptTransformation getClosestSuperWithRule(TransformationRule rule)
Parameters:
transformation -
rule -
Returns:
the first match of supertypes that contains the rule in question

getTransformationRules

public java.util.Collection getTransformationRules()
Gets the transformation rules

Returns:
collection of rules

getTransformationRule

public TransformationRule getTransformationRule(java.lang.String name)
Gets the transformation rules based on "name"

Parameters:
name -
Returns:
a transformation rule with matching name or null

getAllTransformationRules

public java.util.Collection getAllTransformationRules(java.lang.String name)
Gets all the transformation rules with the given "name"

Parameters:
name -
Returns:
a collection of rules or empty ArrayList

getAllImportedTransformationRules

public java.util.Collection getAllImportedTransformationRules()
Gets all teh imported transformation rules

Returns:
ArrayList of rules or empty

getImportedTransformationRule

public java.util.Collection getImportedTransformationRule(java.lang.String name)
Gets all the importet transformation rules with a given name

Parameters:
name -
Returns:
ArrayList containing rules or empty

getImportedTransformationRule

public TransformationRule getImportedTransformationRule(java.lang.String name,
                                                        java.lang.String possibleScoping,
                                                        java.lang.String ownerTransformation)
Gets a transformation rule according to the parameters

Parameters:
name -
possibleScoping -
ownerTransformation -
Returns:
a transfromation rule in accordanse to the parameters provided

getImportedTransformation

public MOFScriptTransformation getImportedTransformation(java.lang.String name)
Gets an imported transfromation with name == parameter name

Parameters:
name -
Returns:
an imported transfromation with name == parameter name

getImportedTransformations

public java.util.Collection getImportedTransformations()
Gets the imported transfromations

Returns:

getAllImportedVariables

public java.util.List getAllImportedVariables()
Gets all the imported variables. Removes duplicate vars.

Returns:

checkImportedRules

public java.lang.Object[] checkImportedRules(java.lang.String ruleName)
Checks imported rules agains a rule name. If the rule name matches, a value is returned containing the name of the rule and the rule itself

Parameters:
ruleName -
Returns:

getTransformationRuleForType

public TransformationRule getTransformationRuleForType(FunctionCall f,
                                                       java.lang.String name,
                                                       java.lang.String ownerTransformation,
                                                       java.lang.String possibleScope,
                                                       java.lang.Object contextObject)
Gets the transformation rule according to the parameters given

Parameters:
name -
ownerTransformation -
possibleScope -
contextObject -
Returns:

ownedByThisOrSuper

protected boolean ownedByThisOrSuper(java.lang.String ownerTransformation)
Returns whether the transfromation is owned by this or the super

Parameters:
ownerTransformation -
Returns:

getNearestTransformation

protected TransformationRule getNearestTransformation(java.util.Collection importedRules)
Gets the nearest transfromation

Parameters:
importedRules -
Returns:

isSuperTypeOf

protected boolean isSuperTypeOf(MOFScriptTransformation potentialSuper,
                                MOFScriptTransformation potentialSub)
Checs whether a transformation is the super type of another

Parameters:
potentialSuper -
potentialSub -
Returns:
true if it is super

isSuperTransformation

public boolean isSuperTransformation(MOFScriptTransformation transformation)
Checks whether a transformation is a super transformation

Parameters:
transformation -
Returns:

superHasRule

public boolean superHasRule(java.lang.String ruleName)
Checks whether a super transfromation has a rule with a given name

Parameters:
ruleName -
Returns:

addImportedTransformation

public void addImportedTransformation(java.lang.String importName,
                                      java.lang.String importUri,
                                      MOFScriptTransformation importedTransformation)
Adds imported transformations to a collection

Parameters:
importName -
importUri -
importedTransformation -