org.eclipse.ocl.examples.pivot.ecore
Class EObjectOperation

java.lang.Object
  extended by org.eclipse.ocl.examples.domain.library.AbstractFeature
      extended by org.eclipse.ocl.examples.domain.library.AbstractOperation
          extended by org.eclipse.ocl.examples.pivot.ecore.EObjectOperation
All Implemented Interfaces:
LibraryBinaryOperation, LibraryFeature, LibraryOperation, LibraryTernaryOperation, LibraryUnaryOperation

public class EObjectOperation
extends AbstractOperation
implements LibraryUnaryOperation, LibraryBinaryOperation, LibraryTernaryOperation

An EObjectOperation provides the standard LibraryOperation to implement an OperationCallExp. When constructed with a null specification, the call returns an invalid. When constructed with a non-null specification, the specification defines the operation body, which if provided as an OpaqueExpression is lazily compiled from OCL source text.


Field Summary
protected  org.eclipse.emf.ecore.EOperation eFeature
           
protected  ValueSpecification specification
           
 
Constructor Summary
EObjectOperation(org.eclipse.emf.ecore.EOperation eFeature, ValueSpecification specification)
           
 
Method Summary
 Value evaluate(DomainEvaluator evaluator, DomainCallExp callExp, Value sourceValue, Value... argumentValues)
          Return the result of evaluating operationCall upon sourceVal within the environment provided by EvaluationVisitor.
 Value evaluate(DomainEvaluator evaluator, DomainType returnType, Value sourceValue)
          Return the result of evaluating the operation on an argument.
 Value evaluate(DomainEvaluator evaluator, DomainType returnType, Value sourceValue, Value argumentValue)
          Return the result of evaluating the operation on left and right arguments.
 Value evaluate(DomainEvaluator evaluator, DomainType returnType, Value sourceValue, Value firstArgumentValue, Value secondArgumentValue)
          Return the result of evaluating the operation on source with arg1 and arg2.
protected  void resolveExpressionInOCL(DomainEvaluator evaluator, DomainCallExp callExp, Value sourceValue)
           
 
Methods inherited from class org.eclipse.ocl.examples.domain.library.AbstractOperation
argumentsMayBeInvalid
 
Methods inherited from class org.eclipse.ocl.examples.domain.library.AbstractFeature
getLibraryValidator, getValidator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.domain.library.LibraryOperation
argumentsMayBeInvalid
 
Methods inherited from interface org.eclipse.ocl.examples.domain.library.LibraryFeature
getValidator
 

Field Detail

eFeature

protected final org.eclipse.emf.ecore.EOperation eFeature

specification

protected ValueSpecification specification
Constructor Detail

EObjectOperation

public EObjectOperation(org.eclipse.emf.ecore.EOperation eFeature,
                        ValueSpecification specification)
Method Detail

evaluate

public Value evaluate(DomainEvaluator evaluator,
                      DomainType returnType,
                      Value sourceValue)
               throws InvalidValueException
Description copied from interface: LibraryUnaryOperation
Return the result of evaluating the operation on an argument. An invalid return may be indicated by throwing an exception returning Java null or OCL invalid.

Specified by:
evaluate in interface LibraryUnaryOperation
Returns:
the evaluated value
Throws:
InvalidValueException

evaluate

public Value evaluate(DomainEvaluator evaluator,
                      DomainType returnType,
                      Value sourceValue,
                      Value argumentValue)
               throws InvalidValueException
Description copied from interface: LibraryBinaryOperation
Return the result of evaluating the operation on left and right arguments. An invalid return may be indicated by throwing an exception returning Java null or OCL invalid.

Specified by:
evaluate in interface LibraryBinaryOperation
Returns:
the evaluated value
Throws:
InvalidValueException

evaluate

public Value evaluate(DomainEvaluator evaluator,
                      DomainType returnType,
                      Value sourceValue,
                      Value firstArgumentValue,
                      Value secondArgumentValue)
               throws InvalidValueException
Description copied from interface: LibraryTernaryOperation
Return the result of evaluating the operation on source with arg1 and arg2. An invalid return may be indicated by throwing an exception returning Java null or OCL invalid.

Specified by:
evaluate in interface LibraryTernaryOperation
Returns:
the evaluated value
Throws:
InvalidValueException

evaluate

public Value evaluate(DomainEvaluator evaluator,
                      DomainCallExp callExp,
                      Value sourceValue,
                      Value... argumentValues)
               throws InvalidValueException
Description copied from interface: LibraryOperation
Return the result of evaluating operationCall upon sourceVal within the environment provided by EvaluationVisitor. An invalid return may be indicated by throwing an exception returning Java null or OCL invalid.

Specified by:
evaluate in interface LibraryOperation
Returns:
the evaluated value
Throws:
InvalidValueException

resolveExpressionInOCL

protected void resolveExpressionInOCL(DomainEvaluator evaluator,
                                      DomainCallExp callExp,
                                      Value sourceValue)