|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.utilities.AbstractVisitor<java.lang.Object,C,O,P,EL,PM,S,COA,SSA,CT>
org.eclipse.ocl.AbstractEvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
public abstract class AbstractEvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
An evaluation visitor implementation for OCL expressions.
Note that this class is not intended to be used or extended by
clients. Use the AbstractEvaluationVisitor
interface, instead.
See the Environment
class for a description of the
generic type parameters of this class.
Field Summary |
---|
Fields inherited from class org.eclipse.ocl.utilities.AbstractVisitor |
---|
result |
Constructor Summary | |
---|---|
protected |
AbstractEvaluationVisitor(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env,
EvaluationEnvironment<C,O,P,CLS,E> evalEnv,
java.util.Map<? extends CLS,? extends java.util.Set<? extends E>> extentMap)
Initializes me. |
Method Summary | |
---|---|
protected java.lang.Object |
call(O operation,
OCLExpression<C> body,
java.lang.Object target,
java.lang.Object[] args)
Invokes the specified additional operation on a target object. |
protected java.lang.Number |
coerceNumber(java.lang.Number number)
Tests whether a given number can be safely coerced to Double or Integer without changing the value of the number. |
protected C |
getBoolean()
Obtains my environment's implementation of the OCL Boolean type. |
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. |
java.util.Map<? extends CLS,? extends java.util.Set<? extends E>> |
getExtentMap()
Obtains the mapping of model classes to their extends. |
protected C |
getInteger()
Obtains my environment's implementation of the OCL Integer type. |
protected java.lang.Object |
getInvalid()
Obtains my environment's implementation of the OclInvalid value. |
protected java.lang.String |
getName(java.lang.Object namedElement)
Obtains the name of the specified element, if it has one. |
protected OCLExpression<C> |
getOperationBody(O operation)
Obtains the body of the specified operation's def or body expression, if any. |
protected OCLExpression<C> |
getPropertyBody(P property)
Obtains the body of the specified property's def or der expression, if any. |
protected C |
getReal()
Obtains my environment's implementation of the OCL Real type. |
protected ExpressionInOCL<C,PM> |
getSpecification(CT constraint)
Overridden by subclasses interested in visiting constraints, to get the constraint's specification. |
protected OCLStandardLibrary<C> |
getStandardLibrary()
Obtains my environment's OCL Standard Library implementation. |
protected C |
getString()
Obtains my environment's implementation of the OCL String type. |
protected UMLReflection<PK,C,O,P,EL,PM,S,COA,SSA,CT> |
getUMLReflection()
|
protected C |
getUnlimitedNatural()
Obtains my environment's implementation of the OCL UnlimitedNatural type. |
protected EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> |
getVisitor()
Obtains the visitor on which I perform nested Visitable.accept(org.eclipse.ocl.utilities.Visitor) calls. |
protected java.lang.Number |
higherPrecisionNumber(java.lang.Number number)
Coerces the given number to Double or Long precision, if possible. |
protected boolean |
isLaxNullHandling()
Queries whether our evaluation environment has the option for lax null handling enabled. |
protected boolean |
isUndefined(java.lang.Object value)
Convenience method to determine whether the specified value is the null or OclInvalid. |
protected java.lang.Object |
navigate(P property,
OCLExpression<C> derivation,
java.lang.Object target)
Obtains an object's value of the specified additional property. |
protected java.lang.Boolean |
oclIsKindOf(java.lang.Object value,
java.lang.Object typeArg)
Checks whether the supplied value is an instance of the supplied type or one of its super types. |
protected java.lang.Boolean |
oclIsTypeOf(java.lang.Object value,
java.lang.Object typeArg)
Checks whether the supplied object is an instance of the supplied type. |
protected void |
setEvaluationEnvironment(EvaluationEnvironment<C,O,P,CLS,E> evaluationEnvironment)
Sets the evaluation environment to be used by this visitor during evaluation. |
java.lang.String |
toString()
|
java.lang.Object |
visitConstraint(CT 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) . |
java.lang.Object |
visitExpression(OCLExpression<C> expression)
This default implementation simply asks the expression to accept me. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractEvaluationVisitor(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env, EvaluationEnvironment<C,O,P,CLS,E> evalEnv, java.util.Map<? extends CLS,? extends java.util.Set<? extends E>> extentMap)
env
- the current environmentevalEnv
- an evaluation environment (map of variable names to values)extentMap
- a map of classes to their instance setsMethod Detail |
---|
protected final EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getVisitor()
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.
protected void setEvaluationEnvironment(EvaluationEnvironment<C,O,P,CLS,E> evaluationEnvironment)
evaluationEnvironment
- non-null evaluation environment
java.lang.IllegalArgumentException
- if the passed evaluationEnvironment
is
null
public EvaluationEnvironment<C,O,P,CLS,E> getEvaluationEnvironment()
EvaluationVisitor
getEvaluationEnvironment
in interface EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
public Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getEnvironment()
EvaluationVisitor
getEnvironment
in interface EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
protected UMLReflection<PK,C,O,P,EL,PM,S,COA,SSA,CT> getUMLReflection()
public java.util.Map<? extends CLS,? extends java.util.Set<? extends E>> getExtentMap()
EvaluationVisitor
getExtentMap
in interface EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
protected OCLStandardLibrary<C> getStandardLibrary()
protected final java.lang.Object getInvalid()
protected final C getBoolean()
protected final C getString()
protected final C getInteger()
protected final C getUnlimitedNatural()
protected final C getReal()
protected java.lang.String getName(java.lang.Object namedElement)
namedElement
- a named element
null
if it has nonepublic java.lang.Object visitExpression(OCLExpression<C> expression)
visitExpression
in interface EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
expression
- an OCL expression to evaluate
public java.lang.Object visitConstraint(CT constraint)
visitExpression(OCLExpression)
.
visitConstraint
in interface EvaluationVisitor<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
visitConstraint
in interface Visitor<java.lang.Object,C,O,P,EL,PM,S,COA,SSA,CT>
visitConstraint
in class AbstractVisitor<java.lang.Object,C,O,P,EL,PM,S,COA,SSA,CT>
AbstractVisitor.getSpecification(Object)
protected ExpressionInOCL<C,PM> getSpecification(CT constraint)
AbstractVisitor
getSpecification
in class AbstractVisitor<java.lang.Object,C,O,P,EL,PM,S,COA,SSA,CT>
constraint
- a constraint
AbstractVisitor.visitConstraint(Object)
public java.lang.String toString()
toString
in class java.lang.Object
protected boolean isUndefined(java.lang.Object value)
value
- a value
protected java.lang.Object call(O operation, OCLExpression<C> body, java.lang.Object target, java.lang.Object[] args)
operation
- the operation to invokebody
- the operation's body expressiontarget
- the object on which to evaluate the operation bodyargs
- the arguments to the operation callprotected OCLExpression<C> getOperationBody(O operation)
operation
- an operation
protected OCLExpression<C> getPropertyBody(P property)
property
- a property
protected java.lang.Object navigate(P property, OCLExpression<C> derivation, java.lang.Object target)
property
- the property to navigatederivation
- the expression that computes its valuetarget
- the object in which context to evaluate the derivation
protected java.lang.Boolean oclIsTypeOf(java.lang.Object value, java.lang.Object typeArg)
value
- the value to checktypeArg
- the type to check
protected java.lang.Boolean oclIsKindOf(java.lang.Object value, java.lang.Object typeArg)
value
- the value to checktypeArg
- the type to check
protected java.lang.Number coerceNumber(java.lang.Number number)
Tests whether a given number can be safely coerced to Double or Integer without changing the value of the number. Safe means that coercing a number to Double or Integer and then coercing it back to the original type will result in the same value (no loss of precision). This is trivial for types, which have a smaller domain then Integer or Double, but for example a Long number may not be safely coerced to Integer.
If the coercion is safe, the number will be returned as either Double or Integer, as appropriate to the original precision. Otherwise the original number is returned.
number
- a number to coerce to Integer or Double
protected java.lang.Number higherPrecisionNumber(java.lang.Number number)
Coerces the given number to Double or Long precision, if possible. Note that this is only impossible for BigDecimal or BigInteger values, respectively, that are out of range of their primitive counterparts.
number
- a number to coerce to Long or Double
protected boolean isLaxNullHandling()
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |