org.eclipse.ocl.examples.pivot.utilities
Class PivotUtil

java.lang.Object
  extended by org.eclipse.ocl.examples.domain.utilities.DomainUtil
      extended by org.eclipse.ocl.examples.pivot.utilities.PivotUtil

public class PivotUtil
extends DomainUtil


Nested Class Summary
static class PivotUtil.PrecedenceComparator
          'Highest' precedence first
static class PivotUtil.TemplateParameterSubstitutionComparator
          In TemplateSignature order.
 
Field Summary
static java.lang.String SCHEME_PIVOT
           
 
Fields inherited from class org.eclipse.ocl.examples.domain.utilities.DomainUtil
NAMEABLE_COMPARATOR
 
Constructor Summary
PivotUtil()
           
 
Method Summary
static void appendMultiplicity(java.lang.StringBuilder s, long lower, long upper)
           
static void checkResourceErrors(java.lang.String message, org.eclipse.emf.ecore.resource.Resource resource)
           
static boolean conformsTo(org.eclipse.emf.ecore.EClassifier targetType, org.eclipse.emf.ecore.EClassifier contentType)
           
static boolean conformsTo(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, org.eclipse.emf.ecore.EClassifier contentType)
           
static java.lang.String convertFromOCLString(java.lang.String javaString)
          Deprecated. 
static java.lang.String convertToOCLString(java.lang.String theString)
          Deprecated. 
static ExpressionInOCL createExpressionInOCLError(java.lang.String string)
           
static void debugObjectUsage(java.lang.String prefix, org.eclipse.emf.ecore.EObject element)
           
static boolean debugWellContainedness(Type type)
           
static MetaModelManager findMetaModelManager(org.eclipse.emf.ecore.EObject eObject)
           
static MetaModelManager findMetaModelManager(org.eclipse.emf.ecore.resource.Resource resource)
           
static MetaModelManager findMetaModelManager(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
           
static Type findTypeOf(MetaModelManager metaModelManager, org.eclipse.emf.ecore.EClassifier eClass)
           
static java.lang.String formatResourceDiagnostics(java.util.List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> diagnostics, java.lang.String messagePrefix, java.lang.String newLine)
           
static
<T> T
getAdapter(java.lang.Class<T> adapterClass, java.util.List<org.eclipse.emf.common.notify.Adapter> eAdapters)
           
static
<T> T
getAdapter(java.lang.Class<T> adapterClass, org.eclipse.emf.common.notify.Notifier notifier)
           
static java.util.List<java.util.List<TemplateParameter>> getAllTemplateParameterLists(org.eclipse.emf.ecore.EObject eObject)
           
static java.util.List<TemplateParameter> getAllTemplateParameters(java.util.Collection<TemplateBinding> templateBindings)
           
static java.util.List<TemplateParameter> getAllTemplateParameters(org.eclipse.emf.ecore.EObject eObject)
           
static java.util.Map<TemplateParameter,ParameterableElement> getAllTemplateParametersAsBindings(org.eclipse.emf.ecore.EObject eObject)
           
static java.util.Map<TemplateParameter,ParameterableElement> getAllTemplateParameterSubstitutions(java.util.Map<TemplateParameter,ParameterableElement> map, TemplateableElement templateableElement)
           
static java.util.Map<TemplateParameter,ParameterableElement> getAllTemplateParameterSubstitutions(java.util.Map<TemplateParameter,ParameterableElement> bindings, Type argumentType, LambdaType lambdaType)
           
static Attribution getAttribution(org.eclipse.emf.ecore.EObject eObject)
           
static Type getBehavioralType(Type type)
          Deprecated. 
static Type getBehavioralType(TypedElement element)
          Deprecated. 
static java.lang.String getBody(OpaqueExpression specification)
           
static CollectionKind getCollectionKind(CollectionType collectionType)
           
static java.lang.String getConstraintTypeName(Constraint constraint)
           
static java.lang.String getConstraintTypeName(OpaqueExpression expression)
           
static Namespace getContainingNamespace(org.eclipse.emf.ecore.EObject element)
           
static Package getContainingPackage(org.eclipse.emf.ecore.EObject element)
           
static Root getContainingRoot(org.eclipse.emf.ecore.EObject element)
           
static Type getContainingType(org.eclipse.emf.ecore.EObject element)
           
static int getContainmentDepth(org.eclipse.emf.ecore.EObject eObject)
          Return the number of containers of eObject, 0 if eObject is a root.
static ExpressionInOCL getExpressionInOCL(NamedElement contextElement, OpaqueExpression specification)
          Return an OCL AST from a ValueSpecification in the context of a NamedElement.
static ExpressionInOCL getExpressionInOCL(NamedElement contextElement, java.lang.String expression)
          Return an OCL AST from a string in the context of a NamedElement.
static Element getLowerBound(Element element)
          Return the lower bound for scope resolution lookups in element.
static java.lang.String getMessage(OpaqueExpression specification)
           
static MetaModelManager getMetaModelManager(org.eclipse.emf.ecore.resource.Resource resource)
           
static
<T extends DomainNamedElement>
T
getNamedElement(java.lang.Iterable<T> elements, java.lang.String name)
          Deprecated. 
static Namespace getNamespace(org.eclipse.emf.ecore.EObject element)
           
static org.eclipse.emf.common.util.URI getNonPivotURI(org.eclipse.emf.common.util.URI uri)
           
static java.lang.String getNsURI(DomainElement element)
          Return a URI based on the nsURI of the immediate parent package.
static java.lang.String getNsURI(org.eclipse.emf.ecore.EModelElement element)
          Return a URI based on the nsURI of the immediate parent package.
static Type getOwningType(Feature feature)
           
static Package getPackage(org.eclipse.emf.ecore.EObject object)
           
static
<T extends Element>
T
getPivot(java.lang.Class<T> pivotClass, Pivotable pivotableElement)
           
static org.eclipse.emf.common.util.URI getPivotURI(org.eclipse.emf.common.util.URI uri)
           
static Feature getReferredFeature(CallExp callExp)
           
static Operation getReferredOperation(CallExp callExp)
           
static java.lang.String getStereotype(Constraint object)
           
static java.util.List<ParameterableElement> getTemplateParameterables(TemplateableElement templateableElement)
           
static java.util.List<TemplateParameter> getTemplateParameters(TemplateableElement templateableElement)
           
static Type getType(Type type)
           
static Type getType(TypedElement typedElement)
           
static java.util.List<Type> getTypeTemplateParameterables(TemplateableElement templateableElement)
           
static
<T extends TemplateableElement>
T
getUnspecializedTemplateableElement(T templateableElement)
           
static boolean isLibraryType(Type type)
           
static boolean isPivotURI(org.eclipse.emf.common.util.URI uri)
           
static boolean isValidIdentifier(java.lang.String value)
           
static void localizeSpecializations(org.eclipse.emf.ecore.resource.Resource pivotResource)
          Create local copies of specializations in a local orphanage so that pivotResource can be saved without dangling references to the global orphanage.
static
<T extends org.eclipse.emf.ecore.EObject>
void
refreshList(java.util.List<? super T> oldElements, java.util.List<? extends T> newElements)
           
static
<T extends org.eclipse.emf.ecore.EObject>
void
refreshSet(java.util.List<? super T> oldElements, java.util.Collection<? extends T> newElements)
           
static void setBody(ExpressionInOCL expressionInOCL, OCLExpression oclExpression, java.lang.String stringExpression)
          Define oclExpression as the bodyExpression of an expressionInOCL, and if non-null also define stringExpression as the OCL-languaged body.
static void setMessage(ExpressionInOCL expressionInOCL, OCLExpression oclExpression, java.lang.String stringExpression)
          Define oclExpression as the bodyExpression of an expressionInOCL, and if non-null also define stringExpression as the OCL-languaged body.
static boolean setParserContext(BaseResource resource, org.eclipse.emf.ecore.EObject eObject, java.lang.Object... todoParameters)
          Configure resource to support parsing in the context of an eObject.
static char toHex(int nibble)
          Deprecated. 
 
Methods inherited from class org.eclipse.ocl.examples.domain.utilities.DomainUtil
bind, createNumberFromString, debugEventType, debugFullName, debugSimpleName, formatMultiplicity, getLabel, getLabel, getLambdaParameterTypes, getOperationParameterTypes, getSafeName, nonNullEMF, nonNullModel, nonNullPivot, nonNullState, suppressThrowWarnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEME_PIVOT

public static final java.lang.String SCHEME_PIVOT
See Also:
Constant Field Values
Constructor Detail

PivotUtil

public PivotUtil()
Method Detail

appendMultiplicity

public static void appendMultiplicity(@NonNull
                                      java.lang.StringBuilder s,
                                      long lower,
                                      long upper)

checkResourceErrors

public static void checkResourceErrors(@NonNull
                                       java.lang.String message,
                                       @NonNull
                                       org.eclipse.emf.ecore.resource.Resource resource)
                                throws ParserException
Throws:
ParserException

conformsTo

public static boolean conformsTo(@Nullable
                                 org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
                                 @NonNull
                                 org.eclipse.emf.ecore.EClassifier contentType)

conformsTo

public static boolean conformsTo(@Nullable
                                 org.eclipse.emf.ecore.EClassifier targetType,
                                 @NonNull
                                 org.eclipse.emf.ecore.EClassifier contentType)

convertFromOCLString

@Deprecated
@NonNull
public static java.lang.String convertFromOCLString(@NonNull
                                                                       java.lang.String javaString)
Deprecated. 


convertToOCLString

@Deprecated
public static java.lang.String convertToOCLString(java.lang.String theString)
Deprecated. 


createExpressionInOCLError

@NonNull
public static ExpressionInOCL createExpressionInOCLError(@NonNull
                                                                 java.lang.String string)

debugObjectUsage

public static void debugObjectUsage(java.lang.String prefix,
                                    org.eclipse.emf.ecore.EObject element)

debugWellContainedness

public static boolean debugWellContainedness(Type type)

findMetaModelManager

@Nullable
public static MetaModelManager findMetaModelManager(@NonNull
                                                             org.eclipse.emf.ecore.EObject eObject)

findMetaModelManager

@Nullable
public static MetaModelManager findMetaModelManager(@NonNull
                                                             org.eclipse.emf.ecore.resource.Resource resource)

findMetaModelManager

public static MetaModelManager findMetaModelManager(@NonNull
                                                    org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

findTypeOf

public static Type findTypeOf(@NonNull
                              MetaModelManager metaModelManager,
                              @NonNull
                              org.eclipse.emf.ecore.EClassifier eClass)

formatResourceDiagnostics

public static java.lang.String formatResourceDiagnostics(@NonNull
                                                         java.util.List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> diagnostics,
                                                         @NonNull
                                                         java.lang.String messagePrefix,
                                                         @NonNull
                                                         java.lang.String newLine)

getAdapter

public static <T> T getAdapter(@NonNull
                               java.lang.Class<T> adapterClass,
                               @NonNull
                               org.eclipse.emf.common.notify.Notifier notifier)

getAdapter

public static <T> T getAdapter(@NonNull
                               java.lang.Class<T> adapterClass,
                               @NonNull
                               java.util.List<org.eclipse.emf.common.notify.Adapter> eAdapters)

getAllTemplateParameters

public static java.util.List<TemplateParameter> getAllTemplateParameters(java.util.Collection<TemplateBinding> templateBindings)

getAllTemplateParameterLists

public static java.util.List<java.util.List<TemplateParameter>> getAllTemplateParameterLists(org.eclipse.emf.ecore.EObject eObject)

getAllTemplateParameters

public static java.util.List<TemplateParameter> getAllTemplateParameters(org.eclipse.emf.ecore.EObject eObject)

getAllTemplateParametersAsBindings

@Nullable
public static java.util.Map<TemplateParameter,ParameterableElement> getAllTemplateParametersAsBindings(@NonNull
                                                                                                                org.eclipse.emf.ecore.EObject eObject)

getAllTemplateParameterSubstitutions

@Nullable
public static java.util.Map<TemplateParameter,ParameterableElement> getAllTemplateParameterSubstitutions(@Nullable
                                                                                                                  java.util.Map<TemplateParameter,ParameterableElement> map,
                                                                                                                  @Nullable
                                                                                                                  TemplateableElement templateableElement)

getAllTemplateParameterSubstitutions

public static java.util.Map<TemplateParameter,ParameterableElement> getAllTemplateParameterSubstitutions(java.util.Map<TemplateParameter,ParameterableElement> bindings,
                                                                                                         Type argumentType,
                                                                                                         LambdaType lambdaType)

getAttribution

@NonNull
public static Attribution getAttribution(@NonNull
                                                 org.eclipse.emf.ecore.EObject eObject)

getBehavioralType

@Deprecated
@NonNull
public static Type getBehavioralType(@NonNull
                                                        Type type)
Deprecated. 


getBehavioralType

@Deprecated
@NonNull
public static Type getBehavioralType(@NonNull
                                                        TypedElement element)
Deprecated. 


getBody

public static java.lang.String getBody(OpaqueExpression specification)

getCollectionKind

public static CollectionKind getCollectionKind(CollectionType collectionType)

getConstraintTypeName

public static java.lang.String getConstraintTypeName(@NonNull
                                                     OpaqueExpression expression)

getConstraintTypeName

public static java.lang.String getConstraintTypeName(@NonNull
                                                     Constraint constraint)

getContainingNamespace

public static Namespace getContainingNamespace(org.eclipse.emf.ecore.EObject element)

getContainingPackage

public static Package getContainingPackage(org.eclipse.emf.ecore.EObject element)

getContainingRoot

public static Root getContainingRoot(org.eclipse.emf.ecore.EObject element)

getContainingType

@Nullable
public static Type getContainingType(@Nullable
                                              org.eclipse.emf.ecore.EObject element)

getContainmentDepth

public static int getContainmentDepth(org.eclipse.emf.ecore.EObject eObject)
Return the number of containers of eObject, 0 if eObject is a root.


getExpressionInOCL

@Nullable
public static ExpressionInOCL getExpressionInOCL(@NonNull
                                                          NamedElement contextElement,
                                                          @NonNull
                                                          OpaqueExpression specification)
Return an OCL AST from a ValueSpecification in the context of a NamedElement. If it is necessary to parse OCL concrete syntax and errors result an ExpressionInOCL is returned with a null contextVariable, a null bodyExpression, and a StringLiteral messageExpression containing the error messages.


getExpressionInOCL

@Nullable
public static ExpressionInOCL getExpressionInOCL(@NonNull
                                                          NamedElement contextElement,
                                                          @NonNull
                                                          java.lang.String expression)
Return an OCL AST from a string in the context of a NamedElement. If it is necessary to parse OCL concrete syntax and errors result an ExpressionInOCL is returned with a null contextVariable, a null bodyExpression, and a StringLiteral messageExpression containing the error messages.


getNamedElement

@Deprecated
public static <T extends DomainNamedElement> T getNamedElement(java.lang.Iterable<T> elements,
                                                                          java.lang.String name)
Deprecated. 


getOwningType

@NonNull
public static Type getOwningType(@NonNull
                                         Feature feature)

getPackage

@Nullable
public static Package getPackage(@NonNull
                                          org.eclipse.emf.ecore.EObject object)

getLowerBound

@NonNull
public static Element getLowerBound(@NonNull
                                            Element element)
Return the lower bound for scope resolution lookups in element. This is element unless element is an UnspecifiedType in which case the derived type is returned.


getMessage

@Nullable
public static java.lang.String getMessage(@NonNull
                                                   OpaqueExpression specification)

getMetaModelManager

@NonNull
public static MetaModelManager getMetaModelManager(@NonNull
                                                           org.eclipse.emf.ecore.resource.Resource resource)

getNamespace

@Nullable
public static Namespace getNamespace(@Nullable
                                              org.eclipse.emf.ecore.EObject element)

getNonPivotURI

@NonNull
public static org.eclipse.emf.common.util.URI getNonPivotURI(@NonNull
                                                                     org.eclipse.emf.common.util.URI uri)

getNsURI

public static java.lang.String getNsURI(@NonNull
                                        org.eclipse.emf.ecore.EModelElement element)
Return a URI based on the nsURI of the immediate parent package.


getNsURI

public static java.lang.String getNsURI(@NonNull
                                        DomainElement element)
Return a URI based on the nsURI of the immediate parent package.


getPivot

@Nullable
public static <T extends Element> T getPivot(@NonNull
                                                      java.lang.Class<T> pivotClass,
                                                      @Nullable
                                                      Pivotable pivotableElement)

getPivotURI

@NonNull
public static org.eclipse.emf.common.util.URI getPivotURI(@NonNull
                                                                  org.eclipse.emf.common.util.URI uri)

getReferredFeature

public static Feature getReferredFeature(CallExp callExp)

getReferredOperation

public static Operation getReferredOperation(CallExp callExp)

getTemplateParameters

public static java.util.List<TemplateParameter> getTemplateParameters(TemplateableElement templateableElement)

getStereotype

public static java.lang.String getStereotype(@NonNull
                                             Constraint object)

getTemplateParameterables

public static java.util.List<ParameterableElement> getTemplateParameterables(TemplateableElement templateableElement)

getType

@Nullable
public static Type getType(@Nullable
                                    TypedElement typedElement)

getType

@NonNull
public static Type getType(@NonNull
                                   Type type)

getTypeTemplateParameterables

@NonNull
public static java.util.List<Type> getTypeTemplateParameterables(@NonNull
                                                                         TemplateableElement templateableElement)

getUnspecializedTemplateableElement

@NonNull
public static <T extends TemplateableElement> T getUnspecializedTemplateableElement(@NonNull
                                                                                            T templateableElement)

isLibraryType

public static boolean isLibraryType(@NonNull
                                    Type type)

isPivotURI

public static boolean isPivotURI(@NonNull
                                 org.eclipse.emf.common.util.URI uri)

isValidIdentifier

public static boolean isValidIdentifier(@Nullable
                                        java.lang.String value)

localizeSpecializations

public static void localizeSpecializations(org.eclipse.emf.ecore.resource.Resource pivotResource)
Create local copies of specializations in a local orphanage so that pivotResource can be saved without dangling references to the global orphanage.


refreshList

public static <T extends org.eclipse.emf.ecore.EObject> void refreshList(@Nullable
                                                                         java.util.List<? super T> oldElements,
                                                                         @Nullable
                                                                         java.util.List<? extends T> newElements)

refreshSet

public static <T extends org.eclipse.emf.ecore.EObject> void refreshSet(@Nullable
                                                                        java.util.List<? super T> oldElements,
                                                                        @Nullable
                                                                        java.util.Collection<? extends T> newElements)

setBody

public static void setBody(@NonNull
                           ExpressionInOCL expressionInOCL,
                           @Nullable
                           OCLExpression oclExpression,
                           @Nullable
                           java.lang.String stringExpression)
Define oclExpression as the bodyExpression of an expressionInOCL, and if non-null also define stringExpression as the OCL-languaged body.


setMessage

public static void setMessage(@NonNull
                              ExpressionInOCL expressionInOCL,
                              @Nullable
                              OCLExpression oclExpression,
                              @Nullable
                              java.lang.String stringExpression)
Define oclExpression as the bodyExpression of an expressionInOCL, and if non-null also define stringExpression as the OCL-languaged body.


setParserContext

public static boolean setParserContext(@NonNull
                                       BaseResource resource,
                                       @NonNull
                                       org.eclipse.emf.ecore.EObject eObject,
                                       java.lang.Object... todoParameters)
                                throws ParserException
Configure resource to support parsing in the context of an eObject. Throws a ParserException if a pivot element cannot be identified for eObject.eClass(). Return false if a pivot element can be identified, but it is not one that supports constraint parsing.

Throws:
ParserException - if eObject cannot be converted to a Pivot element

toHex

@Deprecated
public static char toHex(int nibble)
Deprecated. 

Copied from Properties