org.eclipse.ocl.examples.pivot.evaluation
Class AbstractEvaluationVisitor

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.util.AbstractVisitor<R,C>
      extended by org.eclipse.ocl.examples.pivot.util.AbstractExtendingVisitor<java.lang.Object,java.lang.Object>
          extended by org.eclipse.ocl.examples.pivot.evaluation.AbstractEvaluationVisitor
All Implemented Interfaces:
DomainEvaluator, EvaluationVisitor, Visitor<java.lang.Object>
Direct Known Subclasses:
EvaluationVisitorImpl

public abstract class AbstractEvaluationVisitor
extends AbstractExtendingVisitor<java.lang.Object,java.lang.Object>
implements EvaluationVisitor

An evaluation visitor implementation for OCL expressions.

Note that this class is not intended to be used or extended by clients. Use the EvaluationVisitor interface, instead.

See the Environment class for a description of the generic type parameters of this class.


Field Summary
protected  Environment environment
           
protected  EvaluationEnvironment evaluationEnvironment
           
protected  MetaModelManager metaModelManager
           
protected  DomainModelManager modelManager
           
 
Fields inherited from class org.eclipse.ocl.examples.pivot.util.AbstractVisitor
context
 
Constructor Summary
protected AbstractEvaluationVisitor(Environment env, EvaluationEnvironment evalEnv, DomainModelManager modelManager)
          Initializes me.
 
Method Summary
 Environment getEnvironment()
          Obtains the environment that provides the metamodel semantics for the expression to be evaluated.
 EvaluationEnvironment getEvaluationEnvironment()
          Obtains the evaluation environment that keeps track of variable values and knows how to call operations, navigate properties, etc.
 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.
 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)
           
protected  EvaluationVisitor getUndecoratedVisitor()
          Obtains the visitor on which I perform nested Visitable#accept(org.eclipse.ocl.utilities.Visitor) calls.
protected  EvaluationVisitor getVisitor()
          Deprecated. use getUndecoratedVisitor()
 boolean isCanceled()
          Return true if the evaluation has been canceled.
 void setCanceled(boolean isCanceled)
          Request cancelation of the current the evaluation, or reset the request for a new evaluation.
 void setLogger(DomainLogger logger)
          Specify the logger to handle oclLog() invocations or null for none.
 void setUndecoratedVisitor(EvaluationVisitor evaluationVisitor)
          Sets the visitor on which I perform nested Visitable#accept(org.eclipse.ocl.utilities.Visitor) calls.
 java.lang.String toString()
           
 java.lang.Object visitConstraint(Constraint constraint)
          This default implementation asserts that the constraint is boolean-valued if it is an invariant, pre-condition, or post-condition constraint and returns the value of its body expression by delegation to #visitExpression(OCLExpression).
 
Methods inherited from class org.eclipse.ocl.examples.pivot.util.AbstractExtendingVisitor
visitAnnotation, visitAnyType, visitAssociationClass, visitAssociationClassCallExp, visitBagType, visitBehavior, visitBooleanLiteralExp, visitCallExp, visitCallOperationAction, visitClass, visitCollectionItem, visitCollectionLiteralExp, visitCollectionLiteralPart, visitCollectionRange, visitCollectionType, visitComment, visitConnectionPointReference, visitConstructorExp, visitConstructorPart, visitDataType, visitDetail, visitDynamicElement, visitDynamicProperty, visitDynamicType, visitElement, visitElementExtension, visitEnumeration, visitEnumerationLiteral, visitEnumLiteralExp, visitExpressionInOCL, visitFeature, visitFeatureCallExp, visitFinalState, visitIfExp, visitImport, visitIntegerLiteralExp, visitInvalidLiteralExp, visitInvalidType, visitIterateExp, visitIteration, visitIteratorExp, visitLambdaType, visitLetExp, visitLibrary, visitLiteralExp, visitLoopExp, visitMessageExp, visitMessageType, visitMetaclass, visitNamedElement, visitNamespace, visitNavigationCallExp, visitNullLiteralExp, visitNumericLiteralExp, visitOCLExpression, visitOpaqueExpression, visitOperation, visitOperationCallExp, visitOperationTemplateParameter, visitOrderedSetType, visitPackage, visitPackageableElement, visitParameter, visitParameterableElement, visitPrecedence, visitPrimitiveLiteralExp, visitPrimitiveType, visitProfile, 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, visitTypeTemplateParameter, visitUnlimitedNaturalLiteralExp, visitUnspecifiedType, visitUnspecifiedValueExp, visitValueSpecification, visitVariable, 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.pivot.evaluation.EvaluationVisitor
createNestedEvaluator, evaluate, evaluate, getEvaluator
 
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, 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, visitOrderedSetType, visitPackage, visitPackageableElement, visitParameter, visitParameterableElement, visitPrecedence, visitPrimitiveLiteralExp, visitPrimitiveType, visitProfile, 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, visitTypeTemplateParameter, visitUnlimitedNaturalLiteralExp, visitUnspecifiedType, visitUnspecifiedValueExp, visitValueSpecification, visitVariable, visitVariableDeclaration, visitVariableExp, visitVertex, visitVoidType
 

Field Detail

evaluationEnvironment

@NonNull
protected final EvaluationEnvironment evaluationEnvironment

environment

@NonNull
protected final Environment environment

metaModelManager

@NonNull
protected final MetaModelManager metaModelManager

modelManager

@NonNull
protected final DomainModelManager modelManager
Constructor Detail

AbstractEvaluationVisitor

protected AbstractEvaluationVisitor(@NonNull
                                    Environment env,
                                    @NonNull
                                    EvaluationEnvironment evalEnv,
                                    @NonNull
                                    DomainModelManager modelManager)
Initializes me.

Parameters:
env - the current environment
evalEnv - an evaluation environment (map of variable names to values)
modelManager - a map of classes to their instance sets
Method Detail

getEnvironment

@NonNull
public Environment 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 EvaluationEnvironment 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

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

getMetaModelManager

@NonNull
public MetaModelManager getMetaModelManager()
Specified by:
getMetaModelManager 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

getStandardLibrary

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

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

getUndecoratedVisitor

@NonNull
protected final EvaluationVisitor getUndecoratedVisitor()
Obtains the visitor on which I perform nested Visitable#accept(org.eclipse.ocl.utilities.Visitor) calls. This handles the case in which I am decorated by another visitor that must intercept every visitXxx() method. If I internally just recursively visit myself, then this decorator is cut out of the picture.

Returns:
my delegate visitor, which may be my own self or some other

getVisitor

@Deprecated
protected final EvaluationVisitor getVisitor()
Deprecated. use getUndecoratedVisitor()

Obtains the visitor on which I perform nested Visitable#accept(org.eclipse.ocl.utilities.Visitor) calls. This handles the case in which I am decorated by another visitor that must intercept every visitXxx() method. If I internally just recursively visit myself, then this decorator is cut out of the picture.

Returns:
my delegate visitor, which may be my own self or some other

isCanceled

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

Specified by:
isCanceled in interface DomainEvaluator

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 #getValuefactory() is next invoked.

Specified by:
setCanceled in interface DomainEvaluator

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

setUndecoratedVisitor

public void setUndecoratedVisitor(@NonNull
                                  EvaluationVisitor evaluationVisitor)
Sets the visitor on which I perform nested Visitable#accept(org.eclipse.ocl.utilities.Visitor) calls.

Specified by:
setUndecoratedVisitor in interface EvaluationVisitor
Parameters:
visitor - my delegate visitor
See Also:
getUndecoratedVisitor()

toString

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

visitConstraint

public java.lang.Object visitConstraint(@NonNull
                                        Constraint constraint)
This default implementation asserts that the constraint is boolean-valued if it is an invariant, pre-condition, or post-condition constraint and returns the value of its body expression by delegation to #visitExpression(OCLExpression).

Specified by:
visitConstraint in interface Visitor<java.lang.Object>
Overrides:
visitConstraint in class AbstractExtendingVisitor<java.lang.Object,java.lang.Object>