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<org.emftext.language.java.commons.Commentable, List<BitSet>> functionClassificationAnnotations, MethodCallFinder methodCallFinder) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
containsExternalCall
(org.emftext.language.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
(org.emftext.language.java.statements.Statement object, org.emftext.language.java.members.Method calledMethod, BitSet statementAnnotation) The method is if an emit event action has been found.protected abstract void
foundExternalCall
(org.emftext.language.java.statements.Statement object, org.emftext.language.java.members.Method calledMethod, BitSet statementAnnotation) protected abstract void
foundInternalAction
(org.emftext.language.java.statements.Statement object) protected abstract Object
handleClassMethod
(org.emftext.language.java.members.ClassMethod classMethod, org.emftext.language.java.statements.Statement callStatement) protected abstract Object
handleCondition
(org.emftext.language.java.statements.Condition condition) protected Object
handleFormerSimpleStatement
(org.emftext.language.java.statements.Statement object) protected abstract Object
handleLoopStatement
(org.emftext.language.java.statements.Statement object, org.emftext.language.java.statements.Statement statement) protected Object
handleStatementListContainer
(org.emftext.language.java.statements.StatementListContainer object) handleStatementListContainer can be implemented in abstract class, cause it is similar in current implementing classes.protected abstract Object
handleSwitch
(org.emftext.language.java.statements.Switch switchStatement) protected Object
handleSynchronizedBlock
(org.emftext.language.java.statements.SynchronizedBlock synchronizedBlock) Per default we do not handle synchronized blocks.protected abstract Object
handleTryBlock
(org.emftext.language.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
(org.emftext.language.java.containers.CompilationUnit position) protected String
positionToString
(org.emftext.language.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<org.emftext.language.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<org.emftext.language.java.commons.Commentable, List<BitSet>> functionClassificationAnnotations, MethodCallFinder methodCallFinder)
-
-
Method Details
-
handleLoopStatement
protected abstract Object handleLoopStatement(org.emftext.language.java.statements.Statement object, org.emftext.language.java.statements.Statement statement) -
handleCondition
-
handleSwitch
-
handleClassMethod
protected abstract Object handleClassMethod(org.emftext.language.java.members.ClassMethod classMethod, org.emftext.language.java.statements.Statement callStatement) -
handleTryBlock
-
handleSynchronizedBlock
protected Object handleSynchronizedBlock(org.emftext.language.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(org.emftext.language.java.statements.Statement object) -
foundExternalCall
protected abstract void foundExternalCall(org.emftext.language.java.statements.Statement object, org.emftext.language.java.members.Method calledMethod, BitSet statementAnnotation) -
foundEmitEventAction
protected void foundEmitEventAction(org.emftext.language.java.statements.Statement object, org.emftext.language.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(org.emftext.language.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
-
defaultCase
- Overrides:
defaultCase
in classSwitch<Object>
-
containsExternalCall
protected boolean containsExternalCall(org.emftext.language.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(org.emftext.language.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
-