Dresden OCL Toolkit

tudresden.ocl.normalize
Class VariableClarification

java.lang.Object
  extended bytudresden.ocl.parser.analysis.AnalysisAdapter
      extended bytudresden.ocl.parser.analysis.DepthFirstAdapter
          extended bytudresden.ocl.normalize.VariableClarification
All Implemented Interfaces:
Analysis, Switch, TreeNormalizer

public class VariableClarification
extends DepthFirstAdapter
implements TreeNormalizer

make variable names unique

Author:
Frank Finger

Field Summary
(package private)  boolean isChanged
           
(package private)  HashMap replacements
          maps variable names to null if they can remain unchanged or to the variable name they are replaced by
(package private)  OclTree tree
           
(package private)  HashSet usedVariables
          contains a superset of the key set of replacements
 
Fields inherited from class tudresden.ocl.parser.analysis.AnalysisAdapter
 
Constructor Summary
VariableClarification()
           
 
Method Summary
 void caseAExpression(AExpression e)
           
 void caseAFeatureCallParameters(AFeatureCallParameters fcp)
           
 void inAConstraint(AConstraint c)
           
 void inAFeaturePrimaryExpression(AFeaturePrimaryExpression fpe)
           
 void normalize(OclTree tree)
          normalize an abstract syntax tree, given by its root node
 void outAConstraint(AConstraint c)
           
 
Methods inherited from class tudresden.ocl.parser.analysis.DepthFirstAdapter
caseAActualParameterList, caseAActualParameterListTail, caseAAdditiveExpression, caseAAdditiveExpressionTail, caseAAndLogicalOperator, caseAArrowPostfixExpressionTailBegin, caseABagCollectionKind, caseABagCollectionType, caseABarFcpHelper, caseABooleanLiteral, caseAClassifierContext, caseAClassifierContextBody, caseAClassifierHead, caseACollectionCollectionKind, caseACollectionCollectionType, caseACollectionTypeName, caseAColonFcpHelper, caseACommaFcpHelper, caseAConcreteFeatureCallParameters, caseAConstraint, caseAConstraintBody, caseAContextDeclaration, caseADeclaratorTail, caseADeclaratorTypeDeclaration, caseADivMultiplyOperator, caseADotPostfixExpressionTailBegin, caseAEmptyFeatureCallParameters, caseAEnumerationType, caseAEnumerationTypeTail, caseAEnumLiteral, caseAEnumSimpleTypeSpecifier, caseAEqualRelationalOperator, caseAExpressionListOrRange, caseAExpressionListTail, caseAFeatureCall, caseAFeaturePrimaryExpression, caseAFormalParameter, caseAFormalParameterList, caseAFormalParameterListTail, caseAGteqRelationalOperator, caseAGtRelationalOperator, caseAIfExpression, caseAIfPrimaryExpression, caseAImpliesLogicalOperator, caseAIntegerLiteral, caseAInvStereotype, caseAIterateDeclarator, caseAIterateFcpHelper, caseALetExpression, caseALetExpressionTypeDeclaration, caseAListExpressionListOrRangeTail, caseALitColPrimaryExpression, caseALiteralCollection, caseALiteralPrimaryExpression, caseALogicalExpression, caseALogicalExpressionTail, caseALteqRelationalOperator, caseALtRelationalOperator, caseAMinusAddOperator, caseAMinusUnaryOperator, caseAMultiplicativeExpression, caseAMultiplicativeExpressionTail, caseAMultMultiplyOperator, caseANamePathNameBegin, caseANamePathNameEnd, caseANEqualRelationalOperator, caseANonCollectionTypeName, caseANotUnaryOperator, caseAOperationContext, caseAOperationContextBody, caseAOrLogicalOperator, caseAParenthesesPrimaryExpression, caseAPathName, caseAPathNameTail, caseAPathSimpleTypeSpecifier, caseAPathTypeName, caseAPathTypeNameTail, caseAPlusAddOperator, caseAPostfixExpression, caseAPostfixExpressionTail, caseAPostfixUnaryExpression, caseAPostStereotype, caseAPreStereotype, caseAQualifiers, caseARangeExpressionListOrRangeTail, caseARealLiteral, caseARelationalExpression, caseARelationalExpressionTail, caseAReturnTypeDeclaration, caseASequenceCollectionKind, caseASequenceCollectionType, caseASetCollectionKind, caseASetCollectionType, caseAStandardDeclarator, caseAStringLiteral, caseATimeExpression, caseATypeNamePathNameBegin, caseATypeNamePathNameEnd, caseAUnaryUnaryExpression, caseAXorLogicalOperator, caseStart, defaultIn, defaultOut, inAActualParameterList, inAActualParameterListTail, inAAdditiveExpression, inAAdditiveExpressionTail, inAAndLogicalOperator, inAArrowPostfixExpressionTailBegin, inABagCollectionKind, inABagCollectionType, inABarFcpHelper, inABooleanLiteral, inAClassifierContext, inAClassifierContextBody, inAClassifierHead, inACollectionCollectionKind, inACollectionCollectionType, inACollectionTypeName, inAColonFcpHelper, inACommaFcpHelper, inAConcreteFeatureCallParameters, inAConstraintBody, inAContextDeclaration, inADeclaratorTail, inADeclaratorTypeDeclaration, inADivMultiplyOperator, inADotPostfixExpressionTailBegin, inAEmptyFeatureCallParameters, inAEnumerationType, inAEnumerationTypeTail, inAEnumLiteral, inAEnumSimpleTypeSpecifier, inAEqualRelationalOperator, inAExpression, inAExpressionListOrRange, inAExpressionListTail, inAFeatureCall, inAFeatureCallParameters, inAFormalParameter, inAFormalParameterList, inAFormalParameterListTail, inAGteqRelationalOperator, inAGtRelationalOperator, inAIfExpression, inAIfPrimaryExpression, inAImpliesLogicalOperator, inAIntegerLiteral, inAInvStereotype, inAIterateDeclarator, inAIterateFcpHelper, inALetExpression, inALetExpressionTypeDeclaration, inAListExpressionListOrRangeTail, inALitColPrimaryExpression, inALiteralCollection, inALiteralPrimaryExpression, inALogicalExpression, inALogicalExpressionTail, inALteqRelationalOperator, inALtRelationalOperator, inAMinusAddOperator, inAMinusUnaryOperator, inAMultiplicativeExpression, inAMultiplicativeExpressionTail, inAMultMultiplyOperator, inANamePathNameBegin, inANamePathNameEnd, inANEqualRelationalOperator, inANonCollectionTypeName, inANotUnaryOperator, inAOperationContext, inAOperationContextBody, inAOrLogicalOperator, inAParenthesesPrimaryExpression, inAPathName, inAPathNameTail, inAPathSimpleTypeSpecifier, inAPathTypeName, inAPathTypeNameTail, inAPlusAddOperator, inAPostfixExpression, inAPostfixExpressionTail, inAPostfixUnaryExpression, inAPostStereotype, inAPreStereotype, inAQualifiers, inARangeExpressionListOrRangeTail, inARealLiteral, inARelationalExpression, inARelationalExpressionTail, inAReturnTypeDeclaration, inASequenceCollectionKind, inASequenceCollectionType, inASetCollectionKind, inASetCollectionType, inAStandardDeclarator, inAStringLiteral, inATimeExpression, inATypeNamePathNameBegin, inATypeNamePathNameEnd, inAUnaryUnaryExpression, inAXorLogicalOperator, inStart, outAActualParameterList, outAActualParameterListTail, outAAdditiveExpression, outAAdditiveExpressionTail, outAAndLogicalOperator, outAArrowPostfixExpressionTailBegin, outABagCollectionKind, outABagCollectionType, outABarFcpHelper, outABooleanLiteral, outAClassifierContext, outAClassifierContextBody, outAClassifierHead, outACollectionCollectionKind, outACollectionCollectionType, outACollectionTypeName, outAColonFcpHelper, outACommaFcpHelper, outAConcreteFeatureCallParameters, outAConstraintBody, outAContextDeclaration, outADeclaratorTail, outADeclaratorTypeDeclaration, outADivMultiplyOperator, outADotPostfixExpressionTailBegin, outAEmptyFeatureCallParameters, outAEnumerationType, outAEnumerationTypeTail, outAEnumLiteral, outAEnumSimpleTypeSpecifier, outAEqualRelationalOperator, outAExpression, outAExpressionListOrRange, outAExpressionListTail, outAFeatureCall, outAFeatureCallParameters, outAFeaturePrimaryExpression, outAFormalParameter, outAFormalParameterList, outAFormalParameterListTail, outAGteqRelationalOperator, outAGtRelationalOperator, outAIfExpression, outAIfPrimaryExpression, outAImpliesLogicalOperator, outAIntegerLiteral, outAInvStereotype, outAIterateDeclarator, outAIterateFcpHelper, outALetExpression, outALetExpressionTypeDeclaration, outAListExpressionListOrRangeTail, outALitColPrimaryExpression, outALiteralCollection, outALiteralPrimaryExpression, outALogicalExpression, outALogicalExpressionTail, outALteqRelationalOperator, outALtRelationalOperator, outAMinusAddOperator, outAMinusUnaryOperator, outAMultiplicativeExpression, outAMultiplicativeExpressionTail, outAMultMultiplyOperator, outANamePathNameBegin, outANamePathNameEnd, outANEqualRelationalOperator, outANonCollectionTypeName, outANotUnaryOperator, outAOperationContext, outAOperationContextBody, outAOrLogicalOperator, outAParenthesesPrimaryExpression, outAPathName, outAPathNameTail, outAPathSimpleTypeSpecifier, outAPathTypeName, outAPathTypeNameTail, outAPlusAddOperator, outAPostfixExpression, outAPostfixExpressionTail, outAPostfixUnaryExpression, outAPostStereotype, outAPreStereotype, outAQualifiers, outARangeExpressionListOrRangeTail, outARealLiteral, outARelationalExpression, outARelationalExpressionTail, outAReturnTypeDeclaration, outASequenceCollectionKind, outASequenceCollectionType, outASetCollectionKind, outASetCollectionType, outAStandardDeclarator, outAStringLiteral, outATimeExpression, outATypeNamePathNameBegin, outATypeNamePathNameEnd, outAUnaryUnaryExpression, outAXorLogicalOperator, outStart
 
Methods inherited from class tudresden.ocl.parser.analysis.AnalysisAdapter
caseEOF, caseTAnd, caseTApostroph, caseTArrow, caseTAt, caseTBar, caseTBlank, caseTBool, caseTChannel, caseTColon, caseTComma, caseTComment, caseTContext, caseTDcolon, caseTDdot, caseTDiv, caseTDot, caseTEndif, caseTEnum, caseTEqual, caseTGt, caseTGteq, caseTImplies, caseTInt, caseTLBrace, caseTLBracket, caseTLPar, caseTLt, caseTLteq, caseTMinus, caseTMult, caseTName, caseTNEqual, caseTNewLine, caseTNot, caseTOr, caseTPlus, caseTRBrace, caseTRBracket, caseTReal, caseTRPar, caseTSemicolon, caseTSimpleTypeName, caseTStringLit, caseTTab, caseTTBag, caseTTCollection, caseTTElse, caseTTIf, caseTTIn, caseTTInv, caseTTLet, caseTTPost, caseTTPre, caseTTSequence, caseTTSet, caseTTThen, caseTXor, defaultCase, getIn, getOut, setIn, setOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tree

OclTree tree

isChanged

boolean isChanged

replacements

HashMap replacements
maps variable names to null if they can remain unchanged or to the variable name they are replaced by


usedVariables

HashSet usedVariables
contains a superset of the key set of replacements

Constructor Detail

VariableClarification

public VariableClarification()
Method Detail

normalize

public void normalize(OclTree tree)
Description copied from interface: TreeNormalizer
normalize an abstract syntax tree, given by its root node

Specified by:
normalize in interface TreeNormalizer

inAConstraint

public void inAConstraint(AConstraint c)
Overrides:
inAConstraint in class DepthFirstAdapter

outAConstraint

public void outAConstraint(AConstraint c)
Overrides:
outAConstraint in class DepthFirstAdapter

caseAExpression

public void caseAExpression(AExpression e)
Specified by:
caseAExpression in interface Analysis
Overrides:
caseAExpression in class DepthFirstAdapter

caseAFeatureCallParameters

public void caseAFeatureCallParameters(AFeatureCallParameters fcp)
Specified by:
caseAFeatureCallParameters in interface Analysis
Overrides:
caseAFeatureCallParameters in class DepthFirstAdapter

inAFeaturePrimaryExpression

public void inAFeaturePrimaryExpression(AFeaturePrimaryExpression fpe)
Overrides:
inAFeaturePrimaryExpression in class DepthFirstAdapter

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.