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

public abstract class AbstractJaMoPPStatementVisitor extends ComposedSwitch<Object>
  • Field Details

    • functionClassificationAnnotation

      protected final Map<tools.mdsd.jamopp.model.java.commons.Commentable,List<BitSet>> functionClassificationAnnotation
      Map which contains for each statement in the GAST model the type of the statement classified according to FunctionCallClassificationVisitor.FunctionCallType. Nodes of control flow constructs like loops and branches carry the union of the annotations of their child statements
    • lastType

      protected BitSet 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 doNotSkipNextStatement
      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.
    • methodCallFinder

      protected MethodCallFinder 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

      protected abstract Object handleTryBlock(tools.mdsd.jamopp.model.java.statements.TryBlock object)
    • 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

      public Object defaultCase(EObject object)
      Overrides:
      defaultCase in class Switch<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

      protected boolean isVisitedStatement(BitSet statementAnnotation)
    • setVisited

      protected void setVisited(BitSet thisType)
    • positionToString

      protected String positionToString(tools.mdsd.jamopp.model.java.commons.Commentable position)
    • positionToLineNumber

      protected String positionToLineNumber(tools.mdsd.jamopp.model.java.containers.CompilationUnit position)
    • isExternalCall

      protected boolean isExternalCall(BitSet statementAnnotation)
    • isEmitEventCall

      protected boolean isEmitEventCall(BitSet statementAnnotation)
    • isInternalCall

      protected boolean isInternalCall(BitSet statementAnnotation)
    • isInternalCallContainingExternalCall

      protected boolean isInternalCallContainingExternalCall(BitSet statementAnnotation)
    • isLibraryCall

      protected boolean isLibraryCall(BitSet statementAnnotation)
    • shouldSkip

      protected boolean shouldSkip(BitSet lastType, BitSet thisType)
      Returns true if the statement with thisType should not generate an action in the newly generated SEFF.
      Parameters:
      lastType - The type of the preceeding statement
      thisType - 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