Class TemplateSpecialisation

  extended by org.eclipse.ocl.examples.pivot.manager.TemplateSpecialisation

public class TemplateSpecialisation
extends java.lang.Object

A TemplateSpecialisation supports resolution of template parameter within an element referenced from an OCL expression. For instance a PropertyCallExp.referredProperty references the unspecialised Property and consequently the type and owningType of the referredProperty may have unresolved template parameters. These may be resolved by exploiting the bindings of the ProperyCallExp.source.

Invocation should first invoke needsSpecialisation() to discover whether the cost of constructing a TemplateSpecialisation can be bypassed. If specialisation is needed a TemplateSpecialisation should be constructed for the prevailing OCL Standard Library, and known type equivalences installed by invoking installEquivalence() for each. getSpecialisation may then be used to resolve the type.

Field Summary
protected  java.util.Map<DomainTemplateParameter,DomainType> bindings
protected  DomainStandardLibrary standardLibrary
Constructor Summary
TemplateSpecialisation(DomainStandardLibrary standardLibrary)
Method Summary
 DomainType getSpecialisation(DomainType referredType)
 void installEquivalence(DomainType resolvedType, DomainType referencedType)
static boolean needsSpecialisation(DomainType referencedType)
          Return true if a referencedType needs specialisation to resolve a template parameter.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected final DomainStandardLibrary standardLibrary


protected java.util.Map<DomainTemplateParameter,DomainType> bindings
Constructor Detail


public TemplateSpecialisation(@NonNull
                              DomainStandardLibrary standardLibrary)
Method Detail


public static boolean needsSpecialisation(@Nullable
                                          DomainType referencedType)
Return true if a referencedType needs specialisation to resolve a template parameter.


public DomainType getSpecialisation(@NonNull
                                    DomainType referredType)


public void installEquivalence(@Nullable
                               DomainType resolvedType,
                               DomainType referencedType)