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.
 
Nested classes/interfaces inherited from class org.eclipse.ocl.examples.domain.utilities.DomainUtil
DomainUtil.EAnnotationComparator, DomainUtil.ENamedElementComparator, DomainUtil.NameableComparator
 
Field Summary
 
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 checkExpression(ExpressionInOCL expressionInOCL)
          Check that expressionInOCL was successfully compiled.
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 java.lang.String createTupleValuedConstraint(java.lang.String statusText, java.lang.Integer severity, java.lang.String messageText)
           
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 formatDiagnostics(org.eclipse.emf.common.util.Diagnostic diagnostic, java.lang.String newLine)
           
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 org.eclipse.emf.common.util.URI getASURI(org.eclipse.emf.common.util.URI uri)
           
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 java.lang.String getBodyExpression(java.lang.String umlBody)
          Trim a surrounding "result=(...)" to convert a UML BodyCondition to an OCL BodyExpression.
static CollectionKind getCollectionKind(CollectionType collectionType)
           
static Constraint getContainingConstraint(Element element)
           
static ExpressionInOCL getContainingExpressionInOCL(Element element)
           
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 DomainEvaluator getEvaluator(org.eclipse.emf.ecore.EObject eObject)
           
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)
          Deprecated. 
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 getNonASURI(org.eclipse.emf.common.util.URI uri)
           
static
<T extends Element>
T
getNonNullAst(java.lang.Class<T> pivotClass, Pivotable pivotableElement)
           
static org.eclipse.emf.common.util.URI getNonPivotURI(org.eclipse.emf.common.util.URI uri)
          Deprecated. 
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)
          Deprecated. 
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 ExpressionInOCL getValidExpressionInOCL(NamedElement contextElement, java.lang.String expression)
          Return an OCL AST from a string in the context of a NamedElement.
static boolean isASURI(java.lang.String uri)
           
static boolean isASURI(org.eclipse.emf.common.util.URI uri)
           
static boolean isLibraryType(Type type)
           
static boolean isPivotURI(org.eclipse.emf.common.util.URI uri)
          Deprecated. 
static boolean isValidIdentifier(java.lang.String value)
           
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 resetContainer(org.eclipse.emf.ecore.EObject eObject)
          Detach object from its container so that a child-stealing detection is avoided when attaching to a new container.
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 setBody(OpaqueExpression opaqueExpression, 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)
          Deprecated. 
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, getEAnnotation, getIndentation, getLabel, getLabel, getLambdaParameterTypes, getOperationParameterTypes, getSafeName, isRegistered, nonNullEMF, nonNullModel, nonNullPivot, nonNullState, safeCompareTo, safeEquals, suppressThrowWarnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PivotUtil

public PivotUtil()
Method Detail

appendMultiplicity

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

checkExpression

public static void checkExpression(@NonNull
                                   ExpressionInOCL expressionInOCL)
Check that expressionInOCL was successfully compiled. Throws an InvalidValueException explaining the problem if expressionInOCL has no contextVariable and has a StringLiteralExp bodyExpression.


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)

createTupleValuedConstraint

@NonNull
public static java.lang.String createTupleValuedConstraint(@NonNull
                                                                   java.lang.String statusText,
                                                                   @Nullable
                                                                   java.lang.Integer severity,
                                                                   @Nullable
                                                                   java.lang.String messageText)

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)

formatDiagnostics

public static java.lang.String formatDiagnostics(@NonNull
                                                 org.eclipse.emf.common.util.Diagnostic diagnostic,
                                                 @NonNull
                                                 java.lang.String newLine)

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)

getASURI

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

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)

getBodyExpression

@NonNull
public static java.lang.String getBodyExpression(@NonNull
                                                         java.lang.String umlBody)
Trim a surrounding "result=(...)" to convert a UML BodyCondition to an OCL BodyExpression.


getCollectionKind

public static CollectionKind getCollectionKind(CollectionType collectionType)

getContainingConstraint

@Nullable
public static Constraint getContainingConstraint(@Nullable
                                                          Element element)

getContainingExpressionInOCL

@Nullable
public static ExpressionInOCL getContainingExpressionInOCL(@Nullable
                                                                    Element element)

getContainingNamespace

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

getContainingPackage

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

getContainingRoot

@Nullable
public static Root getContainingRoot(@Nullable
                                              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.


getEvaluator

@NonNull
public static DomainEvaluator getEvaluator(@NonNull
                                                   org.eclipse.emf.ecore.EObject eObject)

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 bodyExpression 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

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


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)

getNonASURI

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

getNonNullAst

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

getNonPivotURI

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


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

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


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)

getValidExpressionInOCL

@NonNull
public static ExpressionInOCL getValidExpressionInOCL(@NonNull
                                                              NamedElement contextElement,
                                                              @NonNull
                                                              java.lang.String expression)
                                               throws ParserException
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, a ParserException is thrown.

Throws:
ParserException

isASURI

public static boolean isASURI(@Nullable
                              java.lang.String uri)

isASURI

public static boolean isASURI(@Nullable
                              org.eclipse.emf.common.util.URI uri)

isLibraryType

public static boolean isLibraryType(@NonNull
                                    Type type)

isPivotURI

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


isValidIdentifier

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

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)

resetContainer

public static void resetContainer(@NonNull
                                  org.eclipse.emf.ecore.EObject eObject)
Detach object from its container so that a child-stealing detection is avoided when attaching to a new container.


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.


setBody

public static void setBody(@NonNull
                           OpaqueExpression opaqueExpression,
                           @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

@Deprecated
public static void setMessage(@NonNull
                                         ExpressionInOCL expressionInOCL,
                                         @Nullable
                                         OCLExpression oclExpression,
                                         @Nullable
                                         java.lang.String stringExpression)
Deprecated. 

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