org.eclipse.mtl.engine.environment
Class MTLEvaluationEnvironment

java.lang.Object
  extended by org.eclipse.ocl.AbstractEvaluationEnvironment<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EClass,org.eclipse.emf.ecore.EObject>
      extended by org.eclipse.ocl.ecore.EcoreEvaluationEnvironment
          extended by org.eclipse.mtl.engine.environment.MTLEvaluationEnvironment
All Implemented Interfaces:
org.eclipse.ocl.EvaluationEnvironment<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EClass,org.eclipse.emf.ecore.EObject>, org.eclipse.ocl.EvaluationEnvironment.Enumerations<org.eclipse.emf.ecore.EEnumLiteral>, org.eclipse.ocl.options.Customizable, org.eclipse.ocl.util.Adaptable

public class MTLEvaluationEnvironment
extends org.eclipse.ocl.ecore.EcoreEvaluationEnvironment

This will allow us to accurately evaluate custom operations defined in the MTL standard library.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.EvaluationEnvironment
org.eclipse.ocl.EvaluationEnvironment.Enumerations<EL>
 
Constructor Summary
MTLEvaluationEnvironment(org.eclipse.ocl.EvaluationEnvironment<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EClass,org.eclipse.emf.ecore.EObject> parent, Module module)
          This constructor is needed by the factory.
MTLEvaluationEnvironment(Module module)
          This constructor will create our environment given the module from which to resolve dependencies.
 
Method Summary
 java.lang.Object callNonStandardOperation(org.eclipse.emf.ecore.EOperation operation, java.lang.Object source, java.lang.Object[] args)
          The environment will delegate operation calls to this method if it needs to evaluate non-standard MTL operations.
 java.lang.Object callOperation(org.eclipse.emf.ecore.EOperation operation, int opcode, java.lang.Object source, java.lang.Object[] args)
          
 java.lang.Object callStandardOperation(org.eclipse.emf.ecore.EOperation operation, java.lang.Object source, java.lang.Object[] args)
          The environment will delegate operation calls to this method if it needs to evaluate a standard MTL operation.
 java.util.List<Template> getAllCandidates(Module origin, Template call, java.util.List<java.lang.Object> arguments)
          This will return the List of all applicable candidates for the given template call with the given arguments.
 Template getMostSpecificTemplate(java.util.List<Template> candidates, java.util.List<java.lang.Object> arguments)
          Returns the most specific template for the given arguments in the given list.
 
Methods inherited from class org.eclipse.ocl.ecore.EcoreEvaluationEnvironment
createExtentMap, createTuple, getInvalidResult, getJavaMethodFor, getType, getValue, isKindOf, isTypeOf, navigateAssociationClass, navigateProperty
 
Methods inherited from class org.eclipse.ocl.AbstractEvaluationEnvironment
add, basicGetOptions, clear, clearOptions, getAdapter, getOptions, getParent, getValue, getValueOf, isEnabled, overrides, putOptions, remove, removeOption, removeOptions, replace, setOption, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MTLEvaluationEnvironment

public MTLEvaluationEnvironment(org.eclipse.ocl.EvaluationEnvironment<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EClass,org.eclipse.emf.ecore.EObject> parent,
                                Module module)
This constructor is needed by the factory.

Parameters:
parent - Parent evaluation environment.
module - We will resolve dependencies for this module and keep references to all accessible templates.

MTLEvaluationEnvironment

public MTLEvaluationEnvironment(Module module)
This constructor will create our environment given the module from which to resolve dependencies.

Parameters:
module - We will resolve dependencies for this module and keep references to all accessible templates.
Method Detail

callNonStandardOperation

public java.lang.Object callNonStandardOperation(org.eclipse.emf.ecore.EOperation operation,
                                                 java.lang.Object source,
                                                 java.lang.Object[] args)
The environment will delegate operation calls to this method if it needs to evaluate non-standard MTL operations.

Parameters:
operation - Operation which is to be evaluated.
source - Source on which the operations is evaluated.
args - Arguments of the call.
Returns:
Result of the operation call.

callOperation

public java.lang.Object callOperation(org.eclipse.emf.ecore.EOperation operation,
                                      int opcode,
                                      java.lang.Object source,
                                      java.lang.Object[] args)

Specified by:
callOperation in interface org.eclipse.ocl.EvaluationEnvironment<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EClass,org.eclipse.emf.ecore.EObject>
Overrides:
callOperation in class org.eclipse.ocl.ecore.EcoreEvaluationEnvironment
See Also:
EcoreEvaluationEnvironment.callOperation(org.eclipse.emf.ecore.EOperation, int, java.lang.Object, java.lang.Object[])

callStandardOperation

public java.lang.Object callStandardOperation(org.eclipse.emf.ecore.EOperation operation,
                                              java.lang.Object source,
                                              java.lang.Object[] args)
The environment will delegate operation calls to this method if it needs to evaluate a standard MTL operation.

Parameters:
operation - Operation which is to be evaluated.
source - Source on which the operations is evaluated.
args - Arguments of the call.
Returns:
Result of the operation call.

getAllCandidates

public java.util.List<Template> getAllCandidates(Module origin,
                                                 Template call,
                                                 java.util.List<java.lang.Object> arguments)
This will return the List of all applicable candidates for the given template call with the given arguments. These will be ordered as described on reorderCandidatesPriority(Module, Set).

Parameters:
origin - Origin of the template call.
call - The called element.
arguments - Arguments of the call.
Returns:
The set of all applicable templates for these arguments

getMostSpecificTemplate

public Template getMostSpecificTemplate(java.util.List<Template> candidates,
                                        java.util.List<java.lang.Object> arguments)
Returns the most specific template for the given arguments in the given list.

Parameters:
candidates - List of templates candidates to be substituted.
arguments - Arguments of the call.
Returns:
The most specific templates for arguments.

Copyright 2008 Obeo
All Rights Reserved.