org.eclipse.emf.ocl.expressions.impl
Class EvaluationVisitorImpl
java.lang.Object
org.eclipse.emf.ocl.expressions.util.AbstractVisitor
org.eclipse.emf.ocl.expressions.impl.EvaluationVisitorImpl
- All Implemented Interfaces:
- EvaluationVisitor, Visitor
public class EvaluationVisitorImpl
- extends AbstractVisitor
- 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.
Method Summary |
Object |
evaluateAnyIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateClosure(IteratorExp ie,
Collection coll)
|
Object |
evaluateCollectIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateCollectNestedIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateExistsIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateForAllIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateIsUnique(IteratorExp ie,
Collection coll)
|
Object |
evaluateOneIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateRejectIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateSelectIterator(IteratorExp ie,
Collection coll)
|
Object |
evaluateSortedByIterator(IteratorExp ie,
Collection coll)
|
EvaluationEnvironment |
getEvalEnvironment()
|
Map |
getExtentMap()
|
static EvaluationVisitor |
getInstance(EvaluationEnvironment env,
Map extentMap)
|
static Method |
getJavaMethodFor(EOperation oper)
Returns the java method that corresponds to the supplied
EOperation |
protected Boolean |
oclIsKindOf(Object value,
Object typeArg)
Checks whether the supplied value is an instance of the supplied type or
one of its super types. |
protected Boolean |
oclIsTypeOf(Object value,
Object typeArg)
Checks whether the supplied object is an instance of the supplied type |
void |
setEvalEnvironment(EvaluationEnvironment newEnv)
Sets the environment to the supplied value. |
void |
setExtentMap(Map extentMap)
Sets the extent map to the supplied value. |
String |
toString()
Returns a string representation of this visitor |
Object |
visitAssociationClassCallExp(AssociationClassCallExp ae)
Callback for an AssociationClassCallExp visit. |
Object |
visitBooleanLiteralExp(BooleanLiteralExp bl)
Callback for a BooleanLiteralExp visit. |
Object |
visitCollectionLiteralExp(CollectionLiteralExp cl)
Callback for a CollectionLiteralExp visit. |
Object |
visitEnumLiteralExp(EnumLiteralExp el)
Callback for an EnumLiteralExp visit. |
Object |
visitIfExp(IfExp ie)
Callback for an IfExp visit. |
Object |
visitIntegerLiteralExp(IntegerLiteralExp il)
Callback for an IntegerLiteralExp visit. |
Object |
visitInvalidLiteralExp(InvalidLiteralExp il)
|
Object |
visitIterateExp(IterateExp ie)
Callback for an IterateExp visit. |
Object |
visitIteratorExp(IteratorExp ie)
Callback for an IteratorExp visit. |
Object |
visitLetExp(LetExp l)
Callback for LetExp visit. |
Object |
visitMessageExp(MessageExp m)
|
Object |
visitNullLiteralExp(NullLiteralExp il)
|
Object |
visitOperationCallExp(OperationCallExp oc)
Callback for an OperationCallExp visit. |
Object |
visitPropertyCallExp(PropertyCallExp pc)
Callback for a PropertyCallExp visit. |
Object |
visitRealLiteralExp(RealLiteralExp rl)
Callback for a RealLiteralExp visit. |
Object |
visitStateExp(StateExp s)
|
Object |
visitStringLiteralExp(StringLiteralExp sl)
Callback for a StringLiteralExp visit. |
Object |
visitTupleLiteralExp(TupleLiteralExp tl)
Callback for a TupleLiteralExp visit. |
Object |
visitTupleLiteralPart(TupleLiteralPart tp)
|
Object |
visitTypeExp(TypeExp t)
Callback for a TypeExp visiy. |
Object |
visitUnspecifiedValueExp(UnspecifiedValueExp uv)
Callback for an UnspecifiedValueExp visit. |
Object |
visitVariable(Variable vd)
Callback for a VariableDeclaration visit. |
Object |
visitVariableExp(VariableExp v)
Callback for a VariableExp visit. |
getInstance
public static EvaluationVisitor getInstance(EvaluationEnvironment env,
Map extentMap)
getEvalEnvironment
public EvaluationEnvironment getEvalEnvironment()
- Specified by:
getEvalEnvironment
in interface EvaluationVisitor
- Returns:
- the environment
getExtentMap
public Map getExtentMap()
- Specified by:
getExtentMap
in interface EvaluationVisitor
- Returns:
- the extent map
setEvalEnvironment
public void setEvalEnvironment(EvaluationEnvironment newEnv)
- Sets the environment to the supplied value.
- Specified by:
setEvalEnvironment
in interface EvaluationVisitor
- Parameters:
newEnv
- the new environment for this visitor.
setExtentMap
public void setExtentMap(Map extentMap)
- Sets the extent map to the supplied value.
- Specified by:
setExtentMap
in interface EvaluationVisitor
- Parameters:
extentMap
- the new extent map
toString
public String toString()
- Returns a string representation of this visitor
- Overrides:
toString
in class Object
visitOperationCallExp
public Object visitOperationCallExp(OperationCallExp oc)
- Callback for an OperationCallExp visit.
- Specified by:
visitOperationCallExp
in interface Visitor
- Overrides:
visitOperationCallExp
in class AbstractVisitor
getJavaMethodFor
public static Method getJavaMethodFor(EOperation oper)
- Returns the java method that corresponds to the supplied
EOperation
- Parameters:
oper
- the operation
- Returns:
- a java method
visitIterateExp
public Object visitIterateExp(IterateExp ie)
- Callback for an IterateExp visit.
- Specified by:
visitIterateExp
in interface Visitor
- Overrides:
visitIterateExp
in class AbstractVisitor
visitIteratorExp
public Object visitIteratorExp(IteratorExp ie)
- Callback for an IteratorExp visit.
- Specified by:
visitIteratorExp
in interface Visitor
- Overrides:
visitIteratorExp
in class AbstractVisitor
evaluateExistsIterator
public Object evaluateExistsIterator(IteratorExp ie,
Collection coll)
evaluateForAllIterator
public Object evaluateForAllIterator(IteratorExp ie,
Collection coll)
evaluateCollectNestedIterator
public Object evaluateCollectNestedIterator(IteratorExp ie,
Collection coll)
evaluateCollectIterator
public Object evaluateCollectIterator(IteratorExp ie,
Collection coll)
evaluateSelectIterator
public Object evaluateSelectIterator(IteratorExp ie,
Collection coll)
evaluateRejectIterator
public Object evaluateRejectIterator(IteratorExp ie,
Collection coll)
evaluateOneIterator
public Object evaluateOneIterator(IteratorExp ie,
Collection coll)
evaluateAnyIterator
public Object evaluateAnyIterator(IteratorExp ie,
Collection coll)
evaluateSortedByIterator
public Object evaluateSortedByIterator(IteratorExp ie,
Collection coll)
evaluateIsUnique
public Object evaluateIsUnique(IteratorExp ie,
Collection coll)
evaluateClosure
public Object evaluateClosure(IteratorExp ie,
Collection coll)
visitEnumLiteralExp
public Object visitEnumLiteralExp(EnumLiteralExp el)
- Callback for an EnumLiteralExp visit. Get the referred enum literal and
return it as an Integer.
- Specified by:
visitEnumLiteralExp
in interface Visitor
- Overrides:
visitEnumLiteralExp
in class AbstractVisitor
- Parameters:
el
- the enumeration literal expresion
- Returns:
- the enumeration literal as an Integer
visitVariableExp
public Object visitVariableExp(VariableExp v)
- Callback for a VariableExp visit.
- Specified by:
visitVariableExp
in interface Visitor
- Overrides:
visitVariableExp
in class AbstractVisitor
- Parameters:
v
- the variable expression
- Returns:
- the value of the variable
visitPropertyCallExp
public Object visitPropertyCallExp(PropertyCallExp pc)
- Callback for a PropertyCallExp visit. Evaluates the source of the
expression and then reflectively gets the value of the property on the
result. For example, in "self.foo", "self" is the source and would be
evaluated first, then the value of the property "foo" would be accessed
on that object.
- Specified by:
visitPropertyCallExp
in interface Visitor
- Overrides:
visitPropertyCallExp
in class AbstractVisitor
visitAssociationClassCallExp
public Object visitAssociationClassCallExp(AssociationClassCallExp ae)
- Callback for an AssociationClassCallExp visit. Evaluates the source of the
expression and then reflectively gets the value of the reference on the
result. For example, in "self.foo", "self" is the source and would be
evaluated first, then the value of the reference "foo" would be derived
on that object.
- Specified by:
visitAssociationClassCallExp
in interface Visitor
- Overrides:
visitAssociationClassCallExp
in class AbstractVisitor
visitVariable
public Object visitVariable(Variable vd)
- Callback for a VariableDeclaration visit.
- Specified by:
visitVariable
in interface Visitor
- Overrides:
visitVariable
in class AbstractVisitor
visitIfExp
public Object visitIfExp(IfExp ie)
- Callback for an IfExp visit.
- Specified by:
visitIfExp
in interface Visitor
- Overrides:
visitIfExp
in class AbstractVisitor
visitTypeExp
public Object visitTypeExp(TypeExp t)
- Callback for a TypeExp visiy.
- Specified by:
visitTypeExp
in interface Visitor
- Overrides:
visitTypeExp
in class AbstractVisitor
visitStateExp
public Object visitStateExp(StateExp s)
- Specified by:
visitStateExp
in interface Visitor
- Overrides:
visitStateExp
in class AbstractVisitor
visitMessageExp
public Object visitMessageExp(MessageExp m)
- Specified by:
visitMessageExp
in interface Visitor
- Overrides:
visitMessageExp
in class AbstractVisitor
visitUnspecifiedValueExp
public Object visitUnspecifiedValueExp(UnspecifiedValueExp uv)
- Callback for an UnspecifiedValueExp visit.
- Specified by:
visitUnspecifiedValueExp
in interface Visitor
- Overrides:
visitUnspecifiedValueExp
in class AbstractVisitor
visitIntegerLiteralExp
public Object visitIntegerLiteralExp(IntegerLiteralExp il)
- Callback for an IntegerLiteralExp visit.
- Specified by:
visitIntegerLiteralExp
in interface Visitor
- Overrides:
visitIntegerLiteralExp
in class AbstractVisitor
- Returns:
- the value of the integer literal as a java.lang.Integer.
visitRealLiteralExp
public Object visitRealLiteralExp(RealLiteralExp rl)
- Callback for a RealLiteralExp visit.
- Specified by:
visitRealLiteralExp
in interface Visitor
- Overrides:
visitRealLiteralExp
in class AbstractVisitor
- Returns:
- the value of the real literal as a java.lang.Double.
visitStringLiteralExp
public Object visitStringLiteralExp(StringLiteralExp sl)
- Callback for a StringLiteralExp visit.
- Specified by:
visitStringLiteralExp
in interface Visitor
- Overrides:
visitStringLiteralExp
in class AbstractVisitor
- Returns:
- the value of the string literal as a java.lang.String.
visitBooleanLiteralExp
public Object visitBooleanLiteralExp(BooleanLiteralExp bl)
- Callback for a BooleanLiteralExp visit.
- Specified by:
visitBooleanLiteralExp
in interface Visitor
- Overrides:
visitBooleanLiteralExp
in class AbstractVisitor
- Returns:
- the value of the boolean literal as a java.lang.Boolean.
visitInvalidLiteralExp
public Object visitInvalidLiteralExp(InvalidLiteralExp il)
- Specified by:
visitInvalidLiteralExp
in interface Visitor
- Overrides:
visitInvalidLiteralExp
in class AbstractVisitor
visitNullLiteralExp
public Object visitNullLiteralExp(NullLiteralExp il)
- Specified by:
visitNullLiteralExp
in interface Visitor
- Overrides:
visitNullLiteralExp
in class AbstractVisitor
visitLetExp
public Object visitLetExp(LetExp l)
- Callback for LetExp visit.
- Specified by:
visitLetExp
in interface Visitor
- Overrides:
visitLetExp
in class AbstractVisitor
visitCollectionLiteralExp
public Object visitCollectionLiteralExp(CollectionLiteralExp cl)
- Callback for a CollectionLiteralExp visit.
- Specified by:
visitCollectionLiteralExp
in interface Visitor
- Overrides:
visitCollectionLiteralExp
in class AbstractVisitor
visitTupleLiteralExp
public Object visitTupleLiteralExp(TupleLiteralExp tl)
- Callback for a TupleLiteralExp visit.
- Specified by:
visitTupleLiteralExp
in interface Visitor
- Overrides:
visitTupleLiteralExp
in class AbstractVisitor
- Parameters:
tl
- tuple literal expression
- Returns:
- String
visitTupleLiteralPart
public Object visitTupleLiteralPart(TupleLiteralPart tp)
- Specified by:
visitTupleLiteralPart
in interface Visitor
- Overrides:
visitTupleLiteralPart
in class AbstractVisitor
oclIsTypeOf
protected Boolean oclIsTypeOf(Object value,
Object typeArg)
- Checks whether the supplied object is an instance of the supplied type
- Parameters:
value
- the value to checktypeArg
- the type to check
- Returns:
- true if the object is an instance of the type, false otherwise.
oclIsKindOf
protected Boolean oclIsKindOf(Object value,
Object typeArg)
- Checks whether the supplied value is an instance of the supplied type or
one of its super types.
- Parameters:
value
- the value to checktypeArg
- the type to check
- Returns:
- true iff the value is of the type or one of its super types.