org.eclipse.ocl.internal.evaluation
Class CachedTypeChecker<C,O,P,PM>

java.lang.Object
  extended by org.eclipse.ocl.AbstractTypeChecker<C,O,P,PM>
      extended by org.eclipse.ocl.internal.evaluation.BasicTypeChecker<C,O,P,PM>
          extended by org.eclipse.ocl.internal.evaluation.CachedTypeChecker<C,O,P,PM>
All Implemented Interfaces:
TypeChecker<C,O,P>, TypeChecker.Cached<C,O,P>

public class CachedTypeChecker<C,O,P,PM>
extends BasicTypeChecker<C,O,P,PM>
implements TypeChecker.Cached<C,O,P>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.TypeChecker
TypeChecker.Cached<C,O,P>
 
Constructor Summary
CachedTypeChecker(Environment<?,C,O,P,?,PM,?,?,?,?,?,?> environment)
           
 
Method Summary
protected  boolean exactlyMatches(java.util.List<? extends PM> requiredParameters, java.util.List<? extends PM> candidateParameters)
          Return true if requiredParameters is an exact match for candidateParameters.
 P findAttribute(C owner, java.lang.String name)
          Finds the most specific (re)definition of an attribute in the specified classifier.
protected  java.util.List<O> getBestMatchingOperations(C owner, java.lang.String name, java.util.List<? extends TypedElement<C>> args)
           
 O getDynamicOperation(C dynamicType, O staticOperation)
          Return the operation of dynamicType that exactly match the staticOperation, or null if there is none or more than one.
protected  O getExactMatchingOperation(java.util.Map<java.lang.String,java.lang.Object> name2operationOrOperations, O operation)
          Return the operation from the name2operationOrOperations cache that matches operation.
protected  java.util.Map<java.lang.String,java.lang.Object> getName2OperationOrOperations(C type)
          Return the map of name to operator or list of operations for a type.
protected  java.util.Map<java.lang.String,P> getName2Property(C type)
          Return the map of name to property for a type.
 void reset()
          Reset the cache forcing lazy evaluations to restart.
 void setBypass(boolean bypass)
          Reset the cache and define its bypass state.
 
Methods inherited from class org.eclipse.ocl.internal.evaluation.BasicTypeChecker
resolve, resolveCollectionType, resolveTupleType
 
Methods inherited from class org.eclipse.ocl.AbstractTypeChecker
checkMutuallyComparable, commonSuperType, commonSuperType, compatibleTypeMatch, exactTypeMatch, findOperationMatching, findSignalMatching, getAttributes, getEnvironment, getOCLFactory, getOperations, getPropertyType, getRelationship, getRelationship, getResultType, getUMLReflection, isStandardLibraryFeature, matchArgs, matchArgsWithExactitude, resolveGenericSignature, resolveGenericType
 
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.TypeChecker
checkMutuallyComparable, commonSuperType, compatibleTypeMatch, exactTypeMatch, findOperationMatching, findSignalMatching, getAttributes, getOperations, getPropertyType, getRelationship, getResultType, isStandardLibraryFeature, matchArgs, resolveGenericSignature
 

Constructor Detail

CachedTypeChecker

public CachedTypeChecker(Environment<?,C,O,P,?,PM,?,?,?,?,?,?> environment)
Method Detail

exactlyMatches

protected boolean exactlyMatches(java.util.List<? extends PM> requiredParameters,
                                 java.util.List<? extends PM> candidateParameters)
Return true if requiredParameters is an exact match for candidateParameters.


findAttribute

public P findAttribute(C owner,
                       java.lang.String name)
Description copied from class: AbstractTypeChecker
Finds the most specific (re)definition of an attribute in the specified classifier.

Specified by:
findAttribute in interface TypeChecker<C,O,P>
Overrides:
findAttribute in class AbstractTypeChecker<C,O,P,PM>
Parameters:
owner - the classifier to search
name - the name of the operation
Returns:
the matching operation, or null if not found

getBestMatchingOperations

protected java.util.List<O> getBestMatchingOperations(C owner,
                                                      java.lang.String name,
                                                      java.util.List<? extends TypedElement<C>> args)
Overrides:
getBestMatchingOperations in class AbstractTypeChecker<C,O,P,PM>

getDynamicOperation

public O getDynamicOperation(C dynamicType,
                             O staticOperation)
Return the operation of dynamicType that exactly match the staticOperation, or null if there is none or more than one.

Specified by:
getDynamicOperation in interface TypeChecker.Cached<C,O,P>

getExactMatchingOperation

protected O getExactMatchingOperation(java.util.Map<java.lang.String,java.lang.Object> name2operationOrOperations,
                                      O operation)
Return the operation from the name2operationOrOperations cache that matches operation. Returns null if there is no operation or more than one.

Parameters:
name2operationOrOperations -
operation -

getName2OperationOrOperations

protected java.util.Map<java.lang.String,java.lang.Object> getName2OperationOrOperations(C type)
Return the map of name to operator or list of operations for a type.


getName2Property

protected java.util.Map<java.lang.String,P> getName2Property(C type)
Return the map of name to property for a type.


reset

public void reset()
Description copied from interface: TypeChecker.Cached
Reset the cache forcing lazy evaluations to restart.

Specified by:
reset in interface TypeChecker.Cached<C,O,P>

setBypass

public void setBypass(boolean bypass)
Description copied from interface: TypeChecker.Cached
Reset the cache and define its bypass state. When bypassed the cache is not used, which may be appropriate if many additional properties or operations are being defined since each of these activities reset the cache, so there may be little benefit in populating it.

Specified by:
setBypass in interface TypeChecker.Cached<C,O,P>