uk.ac.ucl.cs.emofocl.jmi
Class EMOFOCLUtilities

java.lang.Object
  extended by uk.ac.ucl.cs.emofocl.jmi.EMOFOCLUtilities

public class EMOFOCLUtilities
extends Object

Author:
jwskene

Constructor Summary
EMOFOCLUtilities()
           
 
Method Summary
static boolean conformsTo(Type type1, Type type2)
           
static boolean conformsToTypeOf(Type type, MultiplicityElement element)
           
static OCLCollection createElementCompatibleCollection(OCLCollection example, CollectionKind kind)
           
static Type findOrCreatePrimitiveType(Specification specification, OCLEquivalentKind kind)
           
static String formatEnumerationLiteral(EnumerationLiteral literal)
           
static String formatMOFPackagePath(MOFPackage mOFPackage)
           
static String formatMultiplicityOfElement(MultiplicityElement element)
           
static String formatNamedElement(NamedElement namedElement)
           
static String formatOperation(Operation operation)
          Useful for describing an existing operation
static String formatOperation(String name, List argumentTypes)
          Useful for reporting that a hypothetical operation does not exist
static String formatOperation(Type owningType, String name, List argumentTypes)
          Useful for reporting that a hypothetical operation does not exist
static String formatPath(List path)
           
static String formatPathPrefix(int prefix, List path)
           
static String formatProperty(Property property)
           
static String formatTypeOfElement(MultiplicityElement element)
           
static String formatTypePath(Type type)
           
static Type getBooleanType(Specification specification)
           
static javax.jmi.reflect.RefClass getClassProxyFromMetaElement(javax.jmi.reflect.RefPackage outermostPackageProxy, MOFClass meta)
           
static CollectionType getCollectionType(Specification specification, CollectionKind kind, Type elementType)
           
static javax.jmi.reflect.RefEnum getEnumerationFromMetaElement(javax.jmi.reflect.RefPackage outermostPackageProxy, Enumeration meta, String literal)
           
static javax.jmi.reflect.RefEnum getEnumLiteralFromMetaElement(javax.jmi.reflect.RefPackage model, EnumerationLiteral literal)
           
static Type getIntegerType(Specification specification)
           
static InvalidType getInvalidType(Specification specification)
           
static Type getOCLTypeFromMultiplicityElement(Specification specification, MultiplicityElement element)
           
static javax.jmi.reflect.RefPackage getPackageFromMetaElement(javax.jmi.reflect.RefPackage outermostPackageProxy, MOFPackage meta)
           
static Type getRealType(Specification specification)
           
static Specification getSpecification(NamedElement namedElement)
           
static Type getStringType(Specification specification)
           
static TupleType getTupleType(Specification specification, List elementNames, List elementTypes)
           
static VoidType getVoidType(Specification specification)
           
static boolean instanceOf(Object object, Type type)
           
static boolean isBooleanType(Type type)
           
static boolean isCollectionType(Type type)
           
static boolean isInSpecification(Specification specification, Type type)
           
static boolean isIntegerType(Type type)
           
static boolean isNumericType(Type type)
           
static boolean isRealType(Type type)
           
static boolean isStringType(Type type)
           
static boolean isWeakType(Type type)
          VoidTypes and InvalidTypes are weak in the sense that they conform to any type.
static NamedElement resolve(MOFPackage namespace, List path)
          Main resolution function.
static Property resolveAttribute(MOFClass type, String name)
           
static MOFPackage resolveNamespace(MOFPackage namespace, List path)
          Resolves all but the last element of the path specified: i.e.
static Operation resolveOperation(MOFClass type, String name, List argumentTypes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EMOFOCLUtilities

public EMOFOCLUtilities()
Method Detail

getPackageFromMetaElement

public static javax.jmi.reflect.RefPackage getPackageFromMetaElement(javax.jmi.reflect.RefPackage outermostPackageProxy,
                                                                     MOFPackage meta)

getClassProxyFromMetaElement

public static javax.jmi.reflect.RefClass getClassProxyFromMetaElement(javax.jmi.reflect.RefPackage outermostPackageProxy,
                                                                      MOFClass meta)

getEnumerationFromMetaElement

public static javax.jmi.reflect.RefEnum getEnumerationFromMetaElement(javax.jmi.reflect.RefPackage outermostPackageProxy,
                                                                      Enumeration meta,
                                                                      String literal)

formatOperation

public static String formatOperation(String name,
                                     List argumentTypes)
Useful for reporting that a hypothetical operation does not exist

Parameters:
name -
argumentTypes -
Returns:

formatProperty

public static String formatProperty(Property property)

formatOperation

public static String formatOperation(Type owningType,
                                     String name,
                                     List argumentTypes)
Useful for reporting that a hypothetical operation does not exist

Parameters:
name -
argumentTypes -
Returns:

formatOperation

public static String formatOperation(Operation operation)
Useful for describing an existing operation

Parameters:
operation -
Returns:

formatNamedElement

public static String formatNamedElement(NamedElement namedElement)

formatEnumerationLiteral

public static String formatEnumerationLiteral(EnumerationLiteral literal)
Parameters:
literal -
Returns:

formatTypeOfElement

public static String formatTypeOfElement(MultiplicityElement element)

formatMultiplicityOfElement

public static String formatMultiplicityOfElement(MultiplicityElement element)

formatTypePath

public static String formatTypePath(Type type)

formatMOFPackagePath

public static String formatMOFPackagePath(MOFPackage mOFPackage)

formatPathPrefix

public static String formatPathPrefix(int prefix,
                                      List path)

formatPath

public static String formatPath(List path)

getSpecification

public static Specification getSpecification(NamedElement namedElement)

resolve

public static NamedElement resolve(MOFPackage namespace,
                                   List path)
                            throws ResolutionException
Main resolution function. Resolves a path against a namespace to return either a package or a type. If the first element in the path is ".", then the specification containing the namespace is used instead of the namespace as the context for resolution.

Parameters:
namespace -
path -
Returns:
Throws:
ResolutionException

resolveNamespace

public static MOFPackage resolveNamespace(MOFPackage namespace,
                                          List path)
                                   throws ResolutionException
Resolves all but the last element of the path specified: i.e. the namespace of the element referred to in the path

Parameters:
namespace -
pathCS -
Returns:
Throws:
ResolutionException

resolveOperation

public static Operation resolveOperation(MOFClass type,
                                         String name,
                                         List argumentTypes)

conformsTo

public static boolean conformsTo(Type type1,
                                 Type type2)

conformsToTypeOf

public static boolean conformsToTypeOf(Type type,
                                       MultiplicityElement element)

instanceOf

public static boolean instanceOf(Object object,
                                 Type type)

resolveAttribute

public static Property resolveAttribute(MOFClass type,
                                        String name)

isInSpecification

public static boolean isInSpecification(Specification specification,
                                        Type type)

findOrCreatePrimitiveType

public static Type findOrCreatePrimitiveType(Specification specification,
                                             OCLEquivalentKind kind)

getBooleanType

public static Type getBooleanType(Specification specification)

getIntegerType

public static Type getIntegerType(Specification specification)

getRealType

public static Type getRealType(Specification specification)

getStringType

public static Type getStringType(Specification specification)

isWeakType

public static boolean isWeakType(Type type)
VoidTypes and InvalidTypes are weak in the sense that they conform to any type.

Parameters:
type -
Returns:

isBooleanType

public static boolean isBooleanType(Type type)

isNumericType

public static boolean isNumericType(Type type)

isIntegerType

public static boolean isIntegerType(Type type)

isRealType

public static boolean isRealType(Type type)

isStringType

public static boolean isStringType(Type type)

getCollectionType

public static CollectionType getCollectionType(Specification specification,
                                               CollectionKind kind,
                                               Type elementType)

getVoidType

public static VoidType getVoidType(Specification specification)

getInvalidType

public static InvalidType getInvalidType(Specification specification)

isCollectionType

public static boolean isCollectionType(Type type)

getTupleType

public static TupleType getTupleType(Specification specification,
                                     List elementNames,
                                     List elementTypes)

getOCLTypeFromMultiplicityElement

public static Type getOCLTypeFromMultiplicityElement(Specification specification,
                                                     MultiplicityElement element)

createElementCompatibleCollection

public static OCLCollection createElementCompatibleCollection(OCLCollection example,
                                                              CollectionKind kind)

getEnumLiteralFromMetaElement

public static javax.jmi.reflect.RefEnum getEnumLiteralFromMetaElement(javax.jmi.reflect.RefPackage model,
                                                                      EnumerationLiteral literal)