org.eclipse.ocl.examples.debug.evaluator
Class OCLVMEvaluationVisitor

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.util.AbstractVisitor<R,C>
      extended by org.eclipse.ocl.examples.pivot.util.AbstractWrappingVisitor<java.lang.Object,java.lang.Object,IOCLVMEvaluationVisitor,Element>
          extended by org.eclipse.ocl.examples.debug.evaluator.OCLVMEvaluationVisitor
All Implemented Interfaces:
IOCLVMEvaluationVisitor, IVMEvaluationVisitor<ExpressionInOCL>, DomainEvaluator, EvaluationVisitor, Visitor<java.lang.Object>
Direct Known Subclasses:
OCLVMNestedEvaluationVisitor, OCLVMRootEvaluationVisitor

public abstract class OCLVMEvaluationVisitor
extends AbstractWrappingVisitor<java.lang.Object,java.lang.Object,IOCLVMEvaluationVisitor,Element>
implements IOCLVMEvaluationVisitor


Field Summary
 
Fields inherited from class org.eclipse.ocl.examples.pivot.util.AbstractWrappingVisitor
delegate
 
Fields inherited from class org.eclipse.ocl.examples.pivot.util.AbstractVisitor
context
 
Constructor Summary
protected OCLVMEvaluationVisitor(IOCLVMEvaluationVisitor nestedEvaluationVisitor)
           
 
Method Summary
protected abstract  java.lang.Object badVisit(IVMEvaluationEnvironment<?> evalEnv, Element element, java.lang.Object preState, java.lang.Throwable e)
           
protected  java.lang.Object badVisit(Visitable visitable, Element preState, java.lang.Throwable e)
          Intercept an exception thrown by the delegated visit to perform some post-functionality that may use the visitable object, the result of preVisit and the thrown exception to determine the overall wrapped result.
 IOCLVMEvaluationVisitor createNestedEvaluator()
           
 java.lang.Object evaluate(DomainExpression body)
           
 java.lang.Object evaluate(ExpressionInOCL expressionInOCL)
           
 EvaluationVisitor getClonedEvaluator()
           
abstract  int getDepth()
           
 OCLVMEnvironment getEnvironment()
          Obtains the environment that provides the metamodel semantics for the expression to be evaluated.
 IOCLVMEvaluationEnvironment getEvaluationEnvironment()
          Obtains the evaluation environment that keeps track of variable values and knows how to call operations, navigate properties, etc.
 EvaluationVisitor getEvaluator()
           
 IdResolver getIdResolver()
           
 DomainLogger getLogger()
          Return the logger handling oclLog() invocations or null for none.
 MetaModelManager getMetaModelManager()
           
 DomainModelManager getModelManager()
          Obtains the mapping of model classes to their extents.
 org.eclipse.emf.common.util.Monitor getMonitor()
           
 java.lang.String getPluginId()
           
 java.util.regex.Pattern getRegexPattern(java.lang.String regex)
          Return a cached matcher for a give regular expression.
abstract  OCLVMRootEvaluationVisitor getRootEvaluationVisitor()
           
 DomainStandardLibrary getStandardLibrary()
           
 DomainType getStaticTypeOf(java.lang.Object value)
           
 DomainType getStaticTypeOf(java.lang.Object value, java.lang.Iterable<?> values)
           
 DomainType getStaticTypeOf(java.lang.Object value, java.lang.Object... values)
           
 boolean isCanceled()
          Return true if the evaluation has been canceled.
protected abstract  void postVisit(IVMEvaluationEnvironment<?> evalEnv, Element element, java.lang.Object result)
           
protected  java.lang.Object postVisit(Visitable visitable, Element prologue, java.lang.Object result)
          Intercept the result of the delegated visit to perform some post-functionality that may use the visitable object, the result of preVisit and the result of the delegated visit to determine the overall wrapped result.
protected abstract  java.lang.Object preVisit(IVMEvaluationEnvironment<?> evalEnv, Element element)
           
protected  Element preVisit(Visitable visitable)
          Compute and return some value before performing the delegated visit.
protected  void processDeferredTasks()
           
 void setCanceled(boolean isCanceled)
          Request cancelation of the current the evaluation, or reset the request for a new evaluation.
protected  Element setCurrentEnvInstructionPointer(Element element)
           
 void setLogger(DomainLogger logger)
          Specify the logger to handle oclLog() invocations or null for none.
 void setMonitor(org.eclipse.emf.common.util.Monitor monitor)
           
 void setUndecoratedVisitor(EvaluationVisitor evaluationVisitor)
          Configures the specified decorated visitor to correctly handle the invocation of recursive visitXxx(...) calls.
protected  void superProcessDeferredTasks()
           
 java.lang.String toString()
           
 java.lang.Object visitVariable(Variable vd)
           
 
Methods inherited from class org.eclipse.ocl.examples.pivot.util.AbstractWrappingVisitor
getDelegate, visitAnnotation, visitAnyType, visitAssociationClass, visitAssociationClassCallExp, visitBagType, visitBehavior, visitBooleanLiteralExp, visitCallExp, visitCallOperationAction, visitClass, visitCollectionItem, visitCollectionLiteralExp, visitCollectionLiteralPart, visitCollectionRange, visitCollectionType, visitComment, visitConnectionPointReference, visitConstraint, visitConstructorExp, visitConstructorPart, visitDataType, visitDetail, visitDynamicElement, visitDynamicProperty, visitDynamicType, visitElement, visitElementExtension, visitEnumeration, visitEnumerationLiteral, visitEnumLiteralExp, visitExpressionInOCL, visitFeature, visitFeatureCallExp, visitFinalState, visitIfExp, visitImport, visiting, visitIntegerLiteralExp, visitInvalidLiteralExp, visitInvalidType, visitIterateExp, visitIteration, visitIteratorExp, visitLambdaType, visitLetExp, visitLibrary, visitLiteralExp, visitLoopExp, visitMessageExp, visitMessageType, visitMetaclass, visitNamedElement, visitNamespace, visitNavigationCallExp, visitNullLiteralExp, visitNumericLiteralExp, visitOCLExpression, visitOpaqueExpression, visitOperation, visitOperationCallExp, visitOperationTemplateParameter, visitOppositePropertyCallExp, visitOrderedSetType, visitPackage, visitPackageableElement, visitParameter, visitParameterableElement, visitPrecedence, visitPrimitiveLiteralExp, visitPrimitiveType, visitProfile, visitProfileApplication, visitProperty, visitPropertyCallExp, visitPseudostate, visitRealLiteralExp, visitRegion, visitRoot, visitSelfType, visitSendSignalAction, visitSequenceType, visitSetType, visitSignal, visitState, visitStateExp, visitStateMachine, visitStereotype, visitStringLiteralExp, visitTemplateableElement, visitTemplateBinding, visitTemplateParameter, visitTemplateParameterSubstitution, visitTemplateParameterType, visitTemplateSignature, visitTransition, visitTrigger, visitTupleLiteralExp, visitTupleLiteralPart, visitTupleType, visitType, visitTypedElement, visitTypedMultiplicityElement, visitTypeExp, visitTypeExtension, visitTypeTemplateParameter, visitUnlimitedNaturalLiteralExp, visitUnspecifiedType, visitUnspecifiedValueExp, visitValueSpecification, visitVariableDeclaration, visitVariableExp, visitVertex, visitVoidType
 
Methods inherited from class org.eclipse.ocl.examples.pivot.util.AbstractVisitor
getAdapter, safeVisit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.debug.evaluator.IOCLVMEvaluationVisitor
dispose, safeVisit
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.util.Visitor
getAdapter, visitAnnotation, visitAnyType, visitAssociationClass, visitAssociationClassCallExp, visitBagType, visitBehavior, visitBooleanLiteralExp, visitCallExp, visitCallOperationAction, visitClass, visitCollectionItem, visitCollectionLiteralExp, visitCollectionLiteralPart, visitCollectionRange, visitCollectionType, visitComment, visitConnectionPointReference, visitConstraint, visitConstructorExp, visitConstructorPart, visitDataType, visitDetail, visitDynamicElement, visitDynamicProperty, visitDynamicType, visitElement, visitElementExtension, visitEnumeration, visitEnumerationLiteral, visitEnumLiteralExp, visitExpressionInOCL, visitFeature, visitFeatureCallExp, visitFinalState, visitIfExp, visitImport, visiting, visitIntegerLiteralExp, visitInvalidLiteralExp, visitInvalidType, visitIterateExp, visitIteration, visitIteratorExp, visitLambdaType, visitLetExp, visitLibrary, visitLiteralExp, visitLoopExp, visitMessageExp, visitMessageType, visitMetaclass, visitNamedElement, visitNamespace, visitNavigationCallExp, visitNullLiteralExp, visitNumericLiteralExp, visitOCLExpression, visitOpaqueExpression, visitOperation, visitOperationCallExp, visitOperationTemplateParameter, visitOppositePropertyCallExp, visitOrderedSetType, visitPackage, visitPackageableElement, visitParameter, visitParameterableElement, visitPrecedence, visitPrimitiveLiteralExp, visitPrimitiveType, visitProfile, visitProfileApplication, visitProperty, visitPropertyCallExp, visitPseudostate, visitRealLiteralExp, visitRegion, visitRoot, visitSelfType, visitSendSignalAction, visitSequenceType, visitSetType, visitSignal, visitState, visitStateExp, visitStateMachine, visitStereotype, visitStringLiteralExp, visitTemplateableElement, visitTemplateBinding, visitTemplateParameter, visitTemplateParameterSubstitution, visitTemplateParameterType, visitTemplateSignature, visitTransition, visitTrigger, visitTupleLiteralExp, visitTupleLiteralPart, visitTupleType, visitType, visitTypedElement, visitTypedMultiplicityElement, visitTypeExp, visitTypeExtension, visitTypeTemplateParameter, visitUnlimitedNaturalLiteralExp, visitUnspecifiedType, visitUnspecifiedValueExp, visitValueSpecification, visitVariableDeclaration, visitVariableExp, visitVertex, visitVoidType
 

Constructor Detail

OCLVMEvaluationVisitor

protected OCLVMEvaluationVisitor(@NonNull
                                 IOCLVMEvaluationVisitor nestedEvaluationVisitor)
Method Detail

getClonedEvaluator

@NonNull
public EvaluationVisitor getClonedEvaluator()
Specified by:
getClonedEvaluator in interface IVMEvaluationVisitor<ExpressionInOCL>

getDepth

public abstract int getDepth()

getEnvironment

@NonNull
public OCLVMEnvironment getEnvironment()
Description copied from interface: EvaluationVisitor
Obtains the environment that provides the metamodel semantics for the expression to be evaluated.

Specified by:
getEnvironment in interface EvaluationVisitor
Returns:
the environment

getEvaluationEnvironment

@NonNull
public IOCLVMEvaluationEnvironment getEvaluationEnvironment()
Description copied from interface: EvaluationVisitor
Obtains the evaluation environment that keeps track of variable values and knows how to call operations, navigate properties, etc.

Specified by:
getEvaluationEnvironment in interface DomainEvaluator
Specified by:
getEvaluationEnvironment in interface EvaluationVisitor
Returns:
the evaluation environment

getPluginId

@NonNull
public java.lang.String getPluginId()
Specified by:
getPluginId in interface IVMEvaluationVisitor<ExpressionInOCL>

processDeferredTasks

protected void processDeferredTasks()

badVisit

@Nullable
protected java.lang.Object badVisit(@NonNull
                                             Visitable visitable,
                                             @Nullable
                                             Element preState,
                                             @NonNull
                                             java.lang.Throwable e)
                             throws java.lang.RuntimeException
Description copied from class: AbstractWrappingVisitor
Intercept an exception thrown by the delegated visit to perform some post-functionality that may use the visitable object, the result of preVisit and the thrown exception to determine the overall wrapped result.

Overrides:
badVisit in class AbstractWrappingVisitor<java.lang.Object,java.lang.Object,IOCLVMEvaluationVisitor,Element>
Returns:
a rethrown RuntimeException or a RuntimeException-wrapped non-RuntimeException.
Throws:
java.lang.RuntimeException

badVisit

@Nullable
protected abstract java.lang.Object badVisit(@NonNull
                                                      IVMEvaluationEnvironment<?> evalEnv,
                                                      @NonNull
                                                      Element element,
                                                      java.lang.Object preState,
                                                      @NonNull
                                                      java.lang.Throwable e)

superProcessDeferredTasks

protected void superProcessDeferredTasks()

postVisit

protected java.lang.Object postVisit(@NonNull
                                     Visitable visitable,
                                     @Nullable
                                     Element prologue,
                                     @Nullable
                                     java.lang.Object result)
Description copied from class: AbstractWrappingVisitor
Intercept the result of the delegated visit to perform some post-functionality that may use the visitable object, the result of preVisit and the result of the delegated visit to determine the overall wrapped result.

Overrides:
postVisit in class AbstractWrappingVisitor<java.lang.Object,java.lang.Object,IOCLVMEvaluationVisitor,Element>
Returns:
the epilogue result, which defaults to the delegated result.

postVisit

protected abstract void postVisit(@NonNull
                                  IVMEvaluationEnvironment<?> evalEnv,
                                  @NonNull
                                  Element element,
                                  @Nullable
                                  java.lang.Object result)

preVisit

@Nullable
protected Element preVisit(@NonNull
                                    Visitable visitable)
Description copied from class: AbstractWrappingVisitor
Compute and return some value before performing the delegated visit.

Overrides:
preVisit in class AbstractWrappingVisitor<java.lang.Object,java.lang.Object,IOCLVMEvaluationVisitor,Element>
Returns:
the prologue result, which defauilts to null.

preVisit

protected abstract java.lang.Object preVisit(@NonNull
                                             IVMEvaluationEnvironment<?> evalEnv,
                                             @NonNull
                                             Element element)

setCurrentEnvInstructionPointer

protected Element setCurrentEnvInstructionPointer(Element element)

visitVariable

public java.lang.Object visitVariable(@NonNull
                                      Variable vd)
Specified by:
visitVariable in interface Visitor<java.lang.Object>
Overrides:
visitVariable in class AbstractWrappingVisitor<java.lang.Object,java.lang.Object,IOCLVMEvaluationVisitor,Element>

createNestedEvaluator

@NonNull
public IOCLVMEvaluationVisitor createNestedEvaluator()
Specified by:
createNestedEvaluator in interface IOCLVMEvaluationVisitor
Specified by:
createNestedEvaluator in interface DomainEvaluator
Specified by:
createNestedEvaluator in interface EvaluationVisitor

evaluate

@Nullable
public java.lang.Object evaluate(@NonNull
                                          DomainExpression body)
Specified by:
evaluate in interface DomainEvaluator
Specified by:
evaluate in interface EvaluationVisitor

evaluate

@Nullable
public java.lang.Object evaluate(@NonNull
                                          ExpressionInOCL expressionInOCL)
Specified by:
evaluate in interface EvaluationVisitor

getEvaluator

@NonNull
public EvaluationVisitor getEvaluator()
Specified by:
getEvaluator in interface EvaluationVisitor

getModelManager

@NonNull
public DomainModelManager getModelManager()
Description copied from interface: EvaluationVisitor
Obtains the mapping of model classes to their extents.

Specified by:
getModelManager in interface DomainEvaluator
Specified by:
getModelManager in interface EvaluationVisitor
Returns:
the model manager

getMetaModelManager

@NonNull
public MetaModelManager getMetaModelManager()
Specified by:
getMetaModelManager in interface EvaluationVisitor

getStandardLibrary

@NonNull
public DomainStandardLibrary getStandardLibrary()
Specified by:
getStandardLibrary in interface DomainEvaluator
Specified by:
getStandardLibrary in interface EvaluationVisitor

setUndecoratedVisitor

public void setUndecoratedVisitor(@NonNull
                                  EvaluationVisitor evaluationVisitor)
Description copied from interface: EvaluationVisitor
Configures the specified decorated visitor to correctly handle the invocation of recursive visitXxx(...) calls. In particular, the tail of a chain of decorators is informed (if it is an AbstractEvaluationVisitor of the head decorator of the chain, so that recursive visitation follows the entire decorator chain at every step.

Specified by:
setUndecoratedVisitor in interface EvaluationVisitor
Parameters:
evaluationVisitor - the evaluationVisitor that is not decorated/

getIdResolver

@NonNull
public IdResolver getIdResolver()
Specified by:
getIdResolver in interface DomainEvaluator

getLogger

@Nullable
public DomainLogger getLogger()
Description copied from interface: DomainEvaluator
Return the logger handling oclLog() invocations or null for none.

Specified by:
getLogger in interface DomainEvaluator

getMonitor

@Nullable
public org.eclipse.emf.common.util.Monitor getMonitor()
Specified by:
getMonitor in interface EvaluationVisitor

getRegexPattern

@NonNull
public java.util.regex.Pattern getRegexPattern(@NonNull
                                                       java.lang.String regex)
Description copied from interface: DomainEvaluator
Return a cached matcher for a give regular expression.

Specified by:
getRegexPattern in interface DomainEvaluator

getRootEvaluationVisitor

@NonNull
public abstract OCLVMRootEvaluationVisitor getRootEvaluationVisitor()

getStaticTypeOf

@NonNull
public DomainType getStaticTypeOf(@Nullable
                                          java.lang.Object value)
Specified by:
getStaticTypeOf in interface DomainEvaluator

getStaticTypeOf

@NonNull
public DomainType getStaticTypeOf(@Nullable
                                          java.lang.Object value,
                                          @NonNull
                                          java.lang.Object... values)
Specified by:
getStaticTypeOf in interface DomainEvaluator

getStaticTypeOf

@NonNull
public DomainType getStaticTypeOf(@Nullable
                                          java.lang.Object value,
                                          @NonNull
                                          java.lang.Iterable<?> values)
Specified by:
getStaticTypeOf in interface DomainEvaluator

isCanceled

public boolean isCanceled()
Description copied from interface: DomainEvaluator
Return true if the evaluation has been canceled.

Specified by:
isCanceled in interface DomainEvaluator
Specified by:
isCanceled in interface EvaluationVisitor

setCanceled

public void setCanceled(boolean isCanceled)
Description copied from interface: DomainEvaluator
Request cancelation of the current the evaluation, or reset the request for a new evaluation. Cancelation occurs by throwing an EvaluationHaltedException when an expression, operation or iteration is next invoked.

Specified by:
setCanceled in interface DomainEvaluator
Specified by:
setCanceled in interface EvaluationVisitor

setLogger

public void setLogger(@Nullable
                      DomainLogger logger)
Description copied from interface: DomainEvaluator
Specify the logger to handle oclLog() invocations or null for none.

Specified by:
setLogger in interface DomainEvaluator

setMonitor

public void setMonitor(@Nullable
                       org.eclipse.emf.common.util.Monitor monitor)
Specified by:
setMonitor in interface EvaluationVisitor

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object