org.eclipse.ocl.examples.pivot.evaluation
Class AbstractEvaluationEnvironment

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.AbstractBasicEnvironment<EvaluationEnvironment>
      extended by org.eclipse.ocl.examples.pivot.evaluation.AbstractEvaluationEnvironment
All Implemented Interfaces:
DomainEvaluationEnvironment, Adaptable, BasicEnvironment, Customizable, EvaluationEnvironment
Direct Known Subclasses:
PivotEvaluationEnvironment

public abstract class AbstractEvaluationEnvironment
extends AbstractBasicEnvironment<EvaluationEnvironment>
implements EvaluationEnvironment

A partial implementation of the EvaluationEnvironment interface, providing some useful common behaviors. Implementors of metamodel-specific environments are encourage to extend this class rather than implement an evaluation environment "from scratch."

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

Author:
Christian W. Damus (cdamus)

Field Summary
protected  MetaModelManager metaModelManager
           
 
Fields inherited from class org.eclipse.ocl.examples.pivot.AbstractBasicEnvironment
parent
 
Constructor Summary
protected AbstractEvaluationEnvironment(EvaluationEnvironment parent)
           
protected AbstractEvaluationEnvironment(MetaModelManager metaModelManager)
           
 
Method Summary
 void add(DomainTypedElement referredVariable, java.lang.Object value)
          Adds the supplied referredVariable and value binding to the environment
 void clear()
          Clears the environment of variables.
 MetaModelManager getMetaModelManager()
           
 java.lang.Object getValueOf(DomainTypedElement referredVariable)
          Returns the value associated with the supplied referredVariable
 java.util.Set<DomainTypedElement> getVariables()
          Return the set of all locally registered variables.
 boolean overrides(Operation operation, int opcode)
          Deprecated. This Classic OCL API is not used by the Pivot.
 java.lang.Object remove(DomainTypedElement referredVariable)
          Deprecated. 
 void replace(DomainTypedElement referredVariable, java.lang.Object value)
          Replaces the current value of the supplied referredVariable with the supplied value.
 java.lang.String toString()
          Returns a string representation of the bindings
 
Methods inherited from class org.eclipse.ocl.examples.pivot.AbstractBasicEnvironment
basicGetOptions, clearOptions, getAdapter, getOptions, getParent, getValue, isEnabled, notOK, putOptions, removeOption, removeOptions, setOption, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.evaluation.EvaluationEnvironment
createModelManager, getType, navigateAssociationClass
 
Methods inherited from interface org.eclipse.ocl.examples.domain.evaluation.DomainEvaluationEnvironment
createVariable
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.Adaptable
getAdapter
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.Customizable
clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption
 

Field Detail

metaModelManager

@NonNull
protected final MetaModelManager metaModelManager
Constructor Detail

AbstractEvaluationEnvironment

protected AbstractEvaluationEnvironment(@NonNull
                                        MetaModelManager metaModelManager)

AbstractEvaluationEnvironment

protected AbstractEvaluationEnvironment(@NonNull
                                        EvaluationEnvironment parent)
Method Detail

getMetaModelManager

@NonNull
public MetaModelManager getMetaModelManager()
Specified by:
getMetaModelManager in interface EvaluationEnvironment

getValueOf

@Nullable
public java.lang.Object getValueOf(@NonNull
                                            DomainTypedElement referredVariable)
Returns the value associated with the supplied referredVariable

Specified by:
getValueOf in interface EvaluationEnvironment
Parameters:
referredVariable - the referredVariable whose value is to be returned
Returns:
the value associated with the referredVariable

getVariables

@NonNull
public java.util.Set<DomainTypedElement> getVariables()
Description copied from interface: EvaluationEnvironment
Return the set of all locally registered variables.

Specified by:
getVariables in interface EvaluationEnvironment

replace

public void replace(@NonNull
                    DomainTypedElement referredVariable,
                    @Nullable
                    java.lang.Object value)
Replaces the current value of the supplied referredVariable with the supplied value.

Specified by:
replace in interface DomainEvaluationEnvironment
Specified by:
replace in interface EvaluationEnvironment
Parameters:
referredVariable - the referredVariable
value - the new value

add

public void add(@NonNull
                DomainTypedElement referredVariable,
                @Nullable
                java.lang.Object value)
Adds the supplied referredVariable and value binding to the environment

Specified by:
add in interface DomainEvaluationEnvironment
Specified by:
add in interface EvaluationEnvironment
Parameters:
referredVariable - the referredVariable to add
value - the associated binding
See Also:
EvaluationEnvironment.replace(DomainTypedElement, Object)

remove

@Deprecated
public java.lang.Object remove(@NonNull
                                          DomainTypedElement referredVariable)
Deprecated. 

Removes the supplied referredVariable and binding from the environment (if it exists) and returns it.

Specified by:
remove in interface EvaluationEnvironment
Parameters:
referredVariable - the referredVariable to remove
Returns:
the value associated with the removed referredVariable

clear

public void clear()
Clears the environment of variables.

Specified by:
clear in interface EvaluationEnvironment

toString

public java.lang.String toString()
Returns a string representation of the bindings

Overrides:
toString in class java.lang.Object

overrides

@Deprecated
public boolean overrides(@NonNull
                                    Operation operation,
                                    int opcode)
Deprecated. This Classic OCL API is not used by the Pivot.

Specified by:
overrides in interface EvaluationEnvironment