org.eclipse.ocl
Interface EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

All Superinterfaces:
Visitor<Object,C,O,P,EL,PM,S,COA,SSA,CT>
All Known Implementing Classes:
AbstractEvaluationVisitor, EvaluationVisitorDecorator

public interface EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
extends Visitor<Object,C,O,P,EL,PM,S,COA,SSA,CT>

A specialized visitor that is used for evaluation an OCL expression by walking its AST.

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


Method Summary
 Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getEnvironment()
          Obtains the environment that provides the metamodel semantics for the expression to be evaluated.
 EvaluationEnvironment<C,O,P,CLS,E> getEvaluationEnvironment()
          Obtains the evaluation environment that keeps track of variable values and knows how to call operations, navigate properties, etc.
 Map<? extends CLS,? extends Set<? extends E>> getExtentMap()
          Obtains the mapping of model classes to their extends.
 Object visitConstraint(CT constraint)
          Checks that the specified constraint is satisfied by the current "self" context object or, in the case of an operation body condition, evaluates the body expression.
 Object visitExpression(OCLExpression<C> expression)
          Evaluates the specified expression on the current "self" context object.
 
Methods inherited from interface org.eclipse.ocl.utilities.Visitor
visitAssociationClassCallExp, visitBooleanLiteralExp, visitCollectionItem, visitCollectionLiteralExp, visitCollectionRange, visitEnumLiteralExp, visitExpressionInOCL, visitIfExp, visitIntegerLiteralExp, visitInvalidLiteralExp, visitIterateExp, visitIteratorExp, visitLetExp, visitMessageExp, visitNullLiteralExp, visitOperationCallExp, visitPropertyCallExp, visitRealLiteralExp, visitStateExp, visitStringLiteralExp, visitTupleLiteralExp, visitTupleLiteralPart, visitTypeExp, visitUnlimitedNaturalLiteralExp, visitUnspecifiedValueExp, visitVariable, visitVariableExp
 

Method Detail

getEnvironment

Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getEnvironment()
Obtains the environment that provides the metamodel semantics for the expression to be evaluated.

Returns:
the environment

getEvaluationEnvironment

EvaluationEnvironment<C,O,P,CLS,E> getEvaluationEnvironment()
Obtains the evaluation environment that keeps track of variable values and knows how to call operations, navigate properties, etc.

Returns:
the evaluation environment

getExtentMap

Map<? extends CLS,? extends Set<? extends E>> getExtentMap()
Obtains the mapping of model classes to their extends.

Returns:
the extent map

visitExpression

Object visitExpression(OCLExpression<C> expression)
Evaluates the specified expression on the current "self" context object. This result type of this expression may be any type. An implementation will typically just call Visitable.accept(Visitor) on the expression, but is free to elaborate on that. Thus, clients should not simply ask the expression to accept this visitor.

Parameters:
expression - the expression to evaluate
Returns:
the value of the expression

visitConstraint

Object visitConstraint(CT constraint)
Checks that the specified constraint is satisfied by the current "self" context object or, in the case of an operation body condition, evaluates the body expression.

Specified by:
visitConstraint in interface Visitor<Object,C,O,P,EL,PM,S,COA,SSA,CT>
Returns:
for boolean-valued constraints (invariant, precondition, postcondition) Boolean.TRUE if the constraint holds and Boolean.FALSE if it is violated (including evaluations that result in OclInvalid). For operation body conditions, the value of the operation result
Throws:
IllegalArgumentException - if the constraint is one that must be boolean-valued but the computed result is not of boolean type (or OclInvalid)

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.