Package org.somox.gast2seff.visitors
Class AbstractJaMoPPStatementVisitor
java.lang.Object
org.eclipse.emf.ecore.util.Switch<T>
org.eclipse.emf.ecore.util.ComposedSwitch<Object>
org.somox.gast2seff.visitors.AbstractJaMoPPStatementVisitor
- Direct Known Subclasses:
JaMoPPStatementVisitor
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Can be used to force the shouldSkip method to not skip the next statement, which eventually results in a new SEFF element for the next statement.Map which contains for each statement in the GAST model the type of the statement classified according toFunctionCallClassificationVisitor.FunctionCallType
.protected BitSet
Classification annotation of the last visited statement.protected MethodCallFinder
The method call finder -
Constructor Summary
ConstructorDescriptionAbstractJaMoPPStatementVisitor
(Map<tools.mdsd.jamopp.model.java.commons.Commentable, List<BitSet>> functionClassificationAnnotations, MethodCallFinder methodCallFinder) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
containsExternalCall
(tools.mdsd.jamopp.model.java.statements.Statement object) Returns true if the statement or one of its child statements (e.g., for loops or branches) is an external service calldefaultCase
(EObject object) protected void
foundEmitEventAction
(tools.mdsd.jamopp.model.java.statements.Statement object, tools.mdsd.jamopp.model.java.members.Method calledMethod, BitSet statementAnnotation) The method is if an emit event action has been found.protected abstract void
foundExternalCall
(tools.mdsd.jamopp.model.java.statements.Statement object, tools.mdsd.jamopp.model.java.members.Method calledMethod, BitSet statementAnnotation) protected abstract void
foundInternalAction
(tools.mdsd.jamopp.model.java.statements.Statement object) protected abstract Object
handleClassMethod
(tools.mdsd.jamopp.model.java.members.ClassMethod classMethod, tools.mdsd.jamopp.model.java.statements.Statement callStatement) protected abstract Object
handleCondition
(tools.mdsd.jamopp.model.java.statements.Condition condition) protected Object
handleFormerSimpleStatement
(tools.mdsd.jamopp.model.java.statements.Statement object) protected abstract Object
handleLoopStatement
(tools.mdsd.jamopp.model.java.statements.Statement object, tools.mdsd.jamopp.model.java.statements.Statement statement) protected Object
handleStatementListContainer
(tools.mdsd.jamopp.model.java.statements.StatementListContainer object) handleStatementListContainer can be implemented in abstract class, cause it is similar in current implementing classes.protected abstract Object
handleSwitch
(tools.mdsd.jamopp.model.java.statements.Switch switchStatement) protected Object
handleSynchronizedBlock
(tools.mdsd.jamopp.model.java.statements.SynchronizedBlock synchronizedBlock) Per default we do not handle synchronized blocks.protected abstract Object
handleTryBlock
(tools.mdsd.jamopp.model.java.statements.TryBlock object) protected boolean
isEmitEventCall
(BitSet statementAnnotation) protected boolean
isExternalCall
(BitSet statementAnnotation) protected boolean
isInternalCall
(BitSet statementAnnotation) protected boolean
isInternalCallContainingExternalCall
(BitSet statementAnnotation) protected boolean
isLibraryCall
(BitSet statementAnnotation) protected boolean
isVisitedStatement
(BitSet statementAnnotation) protected String
positionToLineNumber
(tools.mdsd.jamopp.model.java.containers.CompilationUnit position) protected String
positionToString
(tools.mdsd.jamopp.model.java.commons.Commentable position) protected void
setVisited
(BitSet thisType) protected boolean
shouldSkip
(BitSet lastType, BitSet thisType) Returns true if the statement with thisType should not generate an action in the newly generated SEFF.Methods inherited from class org.eclipse.emf.ecore.util.ComposedSwitch
addSwitch, delegatedDoSwitch, doSwitch, findDelegate, isSwitchFor, removeSwitch
-
Field Details
-
functionClassificationAnnotation
protected final Map<tools.mdsd.jamopp.model.java.commons.Commentable,List<BitSet>> functionClassificationAnnotationMap which contains for each statement in the GAST model the type of the statement classified according toFunctionCallClassificationVisitor.FunctionCallType
. Nodes of control flow constructs like loops and branches carry the union of the annotations of their child statements -
lastType
Classification annotation of the last visited statement. Used to skip generating SEFF actions if they should be omitted because of the SEFFs abstraction rule -
doNotSkipNextStatement
protected boolean doNotSkipNextStatementCan be used to force the shouldSkip method to not skip the next statement, which eventually results in a new SEFF element for the next statement. -
methodCallFinder
The method call finder
-
-
Constructor Details
-
AbstractJaMoPPStatementVisitor
public AbstractJaMoPPStatementVisitor(Map<tools.mdsd.jamopp.model.java.commons.Commentable, List<BitSet>> functionClassificationAnnotations, MethodCallFinder methodCallFinder)
-
-
Method Details
-
handleLoopStatement
protected abstract Object handleLoopStatement(tools.mdsd.jamopp.model.java.statements.Statement object, tools.mdsd.jamopp.model.java.statements.Statement statement) -
handleCondition
protected abstract Object handleCondition(tools.mdsd.jamopp.model.java.statements.Condition condition) -
handleSwitch
protected abstract Object handleSwitch(tools.mdsd.jamopp.model.java.statements.Switch switchStatement) -
handleClassMethod
protected abstract Object handleClassMethod(tools.mdsd.jamopp.model.java.members.ClassMethod classMethod, tools.mdsd.jamopp.model.java.statements.Statement callStatement) -
handleTryBlock
-
handleSynchronizedBlock
protected Object handleSynchronizedBlock(tools.mdsd.jamopp.model.java.statements.SynchronizedBlock synchronizedBlock) Per default we do not handle synchronized blocks. Instead we treat the synchronized statement like any other statement. It is, however, up to subclasses to override this method and handle synchronized blocks. -
foundInternalAction
protected abstract void foundInternalAction(tools.mdsd.jamopp.model.java.statements.Statement object) -
foundExternalCall
protected abstract void foundExternalCall(tools.mdsd.jamopp.model.java.statements.Statement object, tools.mdsd.jamopp.model.java.members.Method calledMethod, BitSet statementAnnotation) -
foundEmitEventAction
protected void foundEmitEventAction(tools.mdsd.jamopp.model.java.statements.Statement object, tools.mdsd.jamopp.model.java.members.Method calledMethod, BitSet statementAnnotation) The method is if an emit event action has been found. As we are currently not able to deal with emit event actions and in order to achieve backwards compatibility, we provide a default implementation that treats the calls as library calls.- Parameters:
object
-calledMethod
-statementAnnotation
-
-
handleStatementListContainer
protected Object handleStatementListContainer(tools.mdsd.jamopp.model.java.statements.StatementListContainer object) handleStatementListContainer can be implemented in abstract class, cause it is similar in current implementing classes. If necessary, however, it can be overriden of course.- Parameters:
object
- the StatementListContainer (e.g. a Block or ClassMethod)- Returns:
- A Object to indicate that the Statement has been visited already
-
handleFormerSimpleStatement
protected Object handleFormerSimpleStatement(tools.mdsd.jamopp.model.java.statements.Statement object) -
defaultCase
- Overrides:
defaultCase
in classSwitch<Object>
-
containsExternalCall
protected boolean containsExternalCall(tools.mdsd.jamopp.model.java.statements.Statement object) Returns true if the statement or one of its child statements (e.g., for loops or branches) is an external service call- Parameters:
object
- The statement to check- Returns:
- true if the statement or one of its child statements is an external service call
-
isVisitedStatement
-
setVisited
-
positionToString
-
positionToLineNumber
protected String positionToLineNumber(tools.mdsd.jamopp.model.java.containers.CompilationUnit position) -
isExternalCall
-
isEmitEventCall
-
isInternalCall
-
isInternalCallContainingExternalCall
-
isLibraryCall
-
shouldSkip
Returns true if the statement with thisType should not generate an action in the newly generated SEFF.- Parameters:
lastType
- The type of the preceeding statementthisType
- The type of the statement to test- Returns:
- true if the current statement should not generate an element in the SEFF, i.e., it should be abstracted and thrown away
-