Class EMFTVMUtil


  • public final class EMFTVMUtil
    extends java.lang.Object
    EMFTVM static utility methods.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  EMFTVMUtil.RegistryTypeSwitch
      Returns the registry type of the switched object.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.regex.Pattern DELIM_PATTERN
      Type namespace matching pattern.
      static java.lang.String INIT_OP_NAME
      Name of the "init" static parameterless operation.
      static java.lang.String MAIN_OP_NAME
      Name of the "main" static parameterless operation.
      static java.lang.String NATIVE
      Native type namespace.
      static java.lang.String NS_DELIM
      Type namespace delimiter.
      static java.lang.String XMI_ID_FEATURE
      Name if the XMI ID feature for EObjects contained in XMIResources.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void add​(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value, int index)
      Adds the value of eo.sf.
      static Field createField​(java.lang.String name, boolean isStatic, java.lang.String[] context, java.lang.String[] type, CodeBlock initialiser)
      Creates a new Field.
      static Operation createOperation​(boolean isStatic, java.lang.String name, java.lang.String[] context, java.lang.String[] returnType, java.lang.String[][][] parameters, CodeBlock body)
      Creates a new Operation.
      static java.lang.Object emf2vm​(ExecEnv env, org.eclipse.emf.ecore.EObject eo, java.lang.Object value)
      Converts value to an EMFTVM value.
      static LazyList<org.eclipse.emf.ecore.EObject> findAllInstances​(org.eclipse.emf.ecore.EClass type, ExecEnv env)
      Finds all instances of type in the registered input/inout models.
      static LazyList<org.eclipse.emf.ecore.EObject> findAllInstIn​(java.lang.Object modelname, org.eclipse.emf.ecore.EClass type, ExecEnv env)
      Finds all instances of type in the given model.
      static java.lang.reflect.Constructor<?> findConstructor​(java.lang.Class<?> context, java.lang.Class<?>[] argTypes)
      Looks for a native Java constructor.
      static java.lang.reflect.Method findNativeMethod​(java.lang.Class<?> context, java.lang.String opname, boolean isStatic)
      Looks for a native Java method without arguments.
      static java.lang.reflect.Method findNativeMethod​(java.lang.Class<?> context, java.lang.String opname, java.lang.Class<?>[] argTypes, boolean isStatic)
      Looks for a native Java method.
      static java.lang.reflect.Method findNativeMethod​(java.lang.Class<?> context, java.lang.String opname, java.lang.Class<?> argType, boolean isStatic)
      Looks for a native Java method.
      static java.lang.reflect.Method findNativeMethod​(Operation op, java.lang.Object self, java.lang.String opname)
      Looks for a native Java method without arguments.
      static java.lang.reflect.Method findNativeMethod​(Operation op, java.lang.Object self, java.lang.String opname, java.lang.Object arg)
      Looks for a native Java method with one argument.
      static java.lang.reflect.Method findNativeMethod​(Operation op, java.lang.Object self, java.lang.String opname, java.lang.Object[] args)
      Looks for a native Java method with multiple arguments.
      static java.lang.reflect.Method findNativeSuperMethod​(Operation op, java.lang.Class<?> context, java.lang.String opname)
      Looks for a native superclass Java method without arguments.
      static java.lang.reflect.Method findNativeSuperMethod​(Operation op, java.lang.Class<?> context, java.lang.String opname, java.lang.Object arg)
      Looks for a native superclass Java method with one argument.
      static java.lang.reflect.Method findNativeSuperMethod​(Operation op, java.lang.Class<?> context, java.lang.String opname, java.lang.Object[] args)
      Looks for a native superclass Java method with multiple arguments.
      static java.lang.reflect.Method findRootMethod​(java.lang.reflect.Method method)
      Finds the root Class declaration for the given method.
      static java.lang.Object get​(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf)
      Retrieves the value of eo.sf.
      static java.lang.Class<?>[] getArgumentClasses​(java.lang.Object[] args)
      Retrieves the classes of args.
      static java.lang.Object getArgumentType​(java.lang.Object arg)
      Retrieves the type of arg.
      static java.lang.Object[] getArgumentTypes​(java.lang.Object[] args)
      Retrieves the types of args.
      static Metamodel getEcoreMetamodel()
      Returns the singleton instance of the Ecore metamodel.
      static Metamodel getEmfTvmMetamodel()
      Returns the singleton instance of the EMFTVM metamodel.
      static java.io.File getFile​(java.lang.String path)
      Returns the file with the given path in the workspace, or the file in the filesystem if the workspace is not available.
      static java.util.Locale getLocale​(java.lang.String locale)
      Returns the Locale for the given locale string.
      static double getMethodCacheHitRate()
      Returns the hit rate of the method cache.
      static java.lang.Object getRegistryType​(java.lang.Object type)
      Returns the type object to use for the registry.
      static double getRootMethodCacheHitRate()
      Returns the hit rate of the root method cache.
      static Metamodel getTraceMetamodel()
      Returns the singleton instance of the Trace metamodel.
      static LazyList<java.lang.Object> getTrans​(java.lang.Object object, java.lang.reflect.Field field, LazyList<java.lang.Object> result)
      Retrieves the transitive closure of field on object.
      static LazyList<java.lang.Object> getTrans​(java.lang.Object object, Field field, StackFrame frame, LazyList<java.lang.Object> result)
      Retrieves the transitive closure of field on object.
      static LazyList<java.lang.Object> getTrans​(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature sf, ExecEnv env, LazyList<java.lang.Object> result)
      Retrieves the transitive closure of sf on object.
      static java.lang.String getTypeName​(ExecEnv env, java.lang.Object type)
      Returns the name of type, for printing.
      static java.lang.String getTypeNames​(ExecEnv env, java.lang.Object[] types)
      Returns the names of types, for printing.
      static java.lang.Object invokeNative​(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method)
      Invokes native Java method on self without arguments.
      static java.lang.Object invokeNative​(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method, java.lang.Object arg)
      Invokes native Java method on self with argument arg.
      static java.lang.Object invokeNative​(StackFrame frame, java.lang.Object self, java.lang.reflect.Method method, java.lang.Object[] args)
      Invokes native Java method on self with arguments args.
      static java.lang.Object invokeNative​(StackFrame frame, java.lang.Object self, java.lang.String opname)
      Invokes native Java method opname on self without arguments.
      static java.lang.Object invokeNative​(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object arg)
      Invokes native Java method opname on self with argument arg.
      static java.lang.Object invokeNative​(StackFrame frame, java.lang.Object self, java.lang.String opname, java.lang.Object[] args)
      Invokes native Java method opname on self with arguments args.
      static java.lang.Object invokeNativeStatic​(StackFrame frame, java.lang.Class<?> type, java.lang.String opname)
      Invokes static native Java method opname without arguments.
      static java.lang.Object invokeNativeStatic​(StackFrame frame, java.lang.Class<?> type, java.lang.String opname, java.lang.Object arg)
      Invokes static native Java method opname with argument arg.
      static java.lang.Object invokeNativeStatic​(StackFrame frame, java.lang.Class<?> type, java.lang.String opname, java.lang.Object[] args)
      Invokes static native Java method opname with arguments args.
      static void registerEPackages​(org.eclipse.emf.ecore.resource.ResourceSet rs)
      Registers all EPackage nsURIs in rs in the local rs EPackage.Registry.
      static void remove​(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value)
      Removes the value from eo.sf.
      static void set​(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf, java.lang.Object value)
      Sets the value of eo.sf.
      static java.lang.String toPrettyString​(java.lang.Object object, ExecEnv env)
      Offers an alternative to the default toString() method.
      static java.lang.String toPrettyString​(java.util.Collection<?> coll, ExecEnv env)
      Offers an alternative to the default toString() method.
      static <T> java.lang.String toPrettyString​(T[] array, ExecEnv env)
      Offers an alternative to the default toString() method.
      static java.lang.Object uncheckedGet​(ExecEnv env, org.eclipse.emf.ecore.EObject eo, org.eclipse.emf.ecore.EStructuralFeature sf)
      Retrieves the value of eo.sf.
      static boolean writeToWithCharset​(java.lang.String string, java.lang.String path, java.lang.String charset)
      Writes string to path with the given charset.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NATIVE

        public static final java.lang.String NATIVE
        Native type namespace.
        See Also:
        Constant Field Values
      • NS_DELIM

        public static final java.lang.String NS_DELIM
        Type namespace delimiter.
        See Also:
        Constant Field Values
      • DELIM_PATTERN

        public static final java.util.regex.Pattern DELIM_PATTERN
        Type namespace matching pattern.
        See Also:
        NS_DELIM
      • MAIN_OP_NAME

        public static final java.lang.String MAIN_OP_NAME
        Name of the "main" static parameterless operation.
        See Also:
        Constant Field Values
      • INIT_OP_NAME

        public static final java.lang.String INIT_OP_NAME
        Name of the "init" static parameterless operation.
        See Also:
        Constant Field Values
      • XMI_ID_FEATURE

        public static final java.lang.String XMI_ID_FEATURE
        Name if the XMI ID feature for EObjects contained in XMIResources.
        See Also:
        Constant Field Values
    • Method Detail

      • getTypeName

        public static java.lang.String getTypeName​(ExecEnv env,
                                                   java.lang.Object type)
        Returns the name of type, for printing.
        Parameters:
        env - the current ExecEnv
        type - the type
        Returns:
        the name of type, for printing
      • getTypeNames

        public static java.lang.String getTypeNames​(ExecEnv env,
                                                    java.lang.Object[] types)
        Returns the names of types, for printing.
        Parameters:
        env - the current ExecEnv.
        types - the types
        Returns:
        the names of types, for printing
      • getRegistryType

        public static java.lang.Object getRegistryType​(java.lang.Object type)
                                                throws java.lang.IllegalArgumentException
        Returns the type object to use for the registry.
        Parameters:
        type - the type object
        Returns:
        the type object to use for the registry
        Throws:
        java.lang.IllegalArgumentException - if type is a primitive EMF type without instance class
      • getEcoreMetamodel

        public static Metamodel getEcoreMetamodel()
        Returns the singleton instance of the Ecore metamodel.
        Returns:
        the singleton instance of the Ecore metamodel
      • getEmfTvmMetamodel

        public static Metamodel getEmfTvmMetamodel()
        Returns the singleton instance of the EMFTVM metamodel.
        Returns:
        the singleton instance of the EMFTVM metamodel
      • getTraceMetamodel

        public static Metamodel getTraceMetamodel()
        Returns the singleton instance of the Trace metamodel.
        Returns:
        the singleton instance of the Trace metamodel
      • findAllInstances

        public static LazyList<org.eclipse.emf.ecore.EObject> findAllInstances​(org.eclipse.emf.ecore.EClass type,
                                                                               ExecEnv env)
        Finds all instances of type in the registered input/inout models.
        Parameters:
        type - the type
        env - the current ExecEnv
        Returns:
        all instances of type in the registered input/inout models
      • findAllInstIn

        public static LazyList<org.eclipse.emf.ecore.EObject> findAllInstIn​(java.lang.Object modelname,
                                                                            org.eclipse.emf.ecore.EClass type,
                                                                            ExecEnv env)
        Finds all instances of type in the given model.
        Parameters:
        modelname - the model name
        type - the type
        env - the current ExecEnv
        Returns:
        all instances of type in the given model
      • toPrettyString

        public static java.lang.String toPrettyString​(java.lang.Object object,
                                                      ExecEnv env)
        Offers an alternative to the default toString() method. Uses env to determine the containing model of types. Compensates for EObject's notoriously bad toString().
        Parameters:
        object -
        env -
        Returns:
        the string representation of object.
      • toPrettyString

        public static java.lang.String toPrettyString​(java.util.Collection<?> coll,
                                                      ExecEnv env)
        Offers an alternative to the default toString() method. Uses env to determine the containing model of types. Compensates for EObject's notoriously bad toString().
        Parameters:
        coll -
        env -
        Returns:
        the string representation of coll.
      • toPrettyString

        public static <T> java.lang.String toPrettyString​(T[] array,
                                                          ExecEnv env)
        Offers an alternative to the default toString() method. Uses env to determine the containing model of types. Compensates for EObject's notoriously bad toString().
        Parameters:
        array -
        env -
        Returns:
        the string representation of coll.
      • get

        public static java.lang.Object get​(ExecEnv env,
                                           org.eclipse.emf.ecore.EObject eo,
                                           org.eclipse.emf.ecore.EStructuralFeature sf)
        Retrieves the value of eo.sf. Checks that eo is not in an output model.
        Parameters:
        env - the current ExecEnv
        eo - the model element to retrieve the value from
        sf - the structural feature to retrieve the value from
        Returns:
        the value of eo.sf.
      • uncheckedGet

        public static java.lang.Object uncheckedGet​(ExecEnv env,
                                                    org.eclipse.emf.ecore.EObject eo,
                                                    org.eclipse.emf.ecore.EStructuralFeature sf)
        Retrieves the value of eo.sf.
        Parameters:
        env - the current ExecEnv
        eo - the model element to retrieve the value from
        sf - the structural feature to retrieve the value from
        Returns:
        the value of eo.sf.
      • emf2vm

        public static java.lang.Object emf2vm​(ExecEnv env,
                                              org.eclipse.emf.ecore.EObject eo,
                                              java.lang.Object value)
        Converts value to an EMFTVM value.
        Parameters:
        env - the current ExecEnv
        eo - the EObject from which the value was obtained
        value - the EMF value to convert
        Returns:
        the EMFTVM value
      • set

        public static void set​(ExecEnv env,
                               org.eclipse.emf.ecore.EObject eo,
                               org.eclipse.emf.ecore.EStructuralFeature sf,
                               java.lang.Object value)
        Sets the value of eo.sf.
        Parameters:
        env - the current ExecEnv
        eo - the model element to set the value for
        sf - the structural feature to set the value for
        value - the value to set
      • add

        public static void add​(ExecEnv env,
                               org.eclipse.emf.ecore.EObject eo,
                               org.eclipse.emf.ecore.EStructuralFeature sf,
                               java.lang.Object value,
                               int index)
        Adds the value of eo.sf.
        Parameters:
        env -
        eo -
        sf -
        value -
        index - the insertion index (-1 for end)
      • remove

        public static void remove​(ExecEnv env,
                                  org.eclipse.emf.ecore.EObject eo,
                                  org.eclipse.emf.ecore.EStructuralFeature sf,
                                  java.lang.Object value)
        Removes the value from eo.sf.
        Parameters:
        env -
        eo -
        sf -
        value -
      • getArgumentTypes

        public static java.lang.Object[] getArgumentTypes​(java.lang.Object[] args)
        Retrieves the types of args.
        Parameters:
        args -
        Returns:
        the types of args
      • getArgumentType

        public static java.lang.Object getArgumentType​(java.lang.Object arg)
        Retrieves the type of arg.
        Parameters:
        arg -
        Returns:
        the type of arg
      • invokeNative

        public static java.lang.Object invokeNative​(StackFrame frame,
                                                    java.lang.Object self,
                                                    java.lang.String opname,
                                                    java.lang.Object[] args)
        Invokes native Java method opname on self with arguments args.
        Parameters:
        frame - the current stack frame
        self - the object on which to invoke the method
        opname - the method name
        args - the method arguments
        Returns:
        the method result
      • invokeNative

        public static java.lang.Object invokeNative​(StackFrame frame,
                                                    java.lang.Object self,
                                                    java.lang.reflect.Method method,
                                                    java.lang.Object[] args)
        Invokes native Java method on self with arguments args.
        Parameters:
        frame - the current stack frame
        self - the object on which to invoke the method
        method - the method
        args - the method arguments
        Returns:
        the method result
      • invokeNative

        public static java.lang.Object invokeNative​(StackFrame frame,
                                                    java.lang.Object self,
                                                    java.lang.String opname,
                                                    java.lang.Object arg)
        Invokes native Java method opname on self with argument arg.
        Parameters:
        frame - the current stack frame
        self - the object on which to invoke the method
        opname - the method name
        arg - the method argument
        Returns:
        the method result
      • invokeNative

        public static java.lang.Object invokeNative​(StackFrame frame,
                                                    java.lang.Object self,
                                                    java.lang.reflect.Method method,
                                                    java.lang.Object arg)
        Invokes native Java method on self with argument arg.
        Parameters:
        frame - the current stack frame
        self - the object on which to invoke the method
        method - the method
        arg - the method argument
        Returns:
        the method result
      • invokeNative

        public static java.lang.Object invokeNative​(StackFrame frame,
                                                    java.lang.Object self,
                                                    java.lang.String opname)
        Invokes native Java method opname on self without arguments.
        Parameters:
        frame - the current stack frame
        self - the object on which to invoke the method
        opname - the method name
        Returns:
        the method result
      • invokeNative

        public static java.lang.Object invokeNative​(StackFrame frame,
                                                    java.lang.Object self,
                                                    java.lang.reflect.Method method)
        Invokes native Java method on self without arguments.
        Parameters:
        frame - the current stack frame
        self - the object on which to invoke the method
        method - the method
        Returns:
        the method result
      • invokeNativeStatic

        public static java.lang.Object invokeNativeStatic​(StackFrame frame,
                                                          java.lang.Class<?> type,
                                                          java.lang.String opname,
                                                          java.lang.Object[] args)
        Invokes static native Java method opname with arguments args.
        Parameters:
        frame - the current stack frame
        type - the class in which the static method is defined
        opname - the method name
        args - the method arguments
        Returns:
        the method result
      • invokeNativeStatic

        public static java.lang.Object invokeNativeStatic​(StackFrame frame,
                                                          java.lang.Class<?> type,
                                                          java.lang.String opname,
                                                          java.lang.Object arg)
        Invokes static native Java method opname with argument arg.
        Parameters:
        frame - the current stack frame
        type - the class in which the static method is defined
        opname - the method name
        arg - the method arguments
        Returns:
        the method result
      • invokeNativeStatic

        public static java.lang.Object invokeNativeStatic​(StackFrame frame,
                                                          java.lang.Class<?> type,
                                                          java.lang.String opname)
        Invokes static native Java method opname without arguments.
        Parameters:
        frame - the current stack frame
        type - the class in which the static method is defined
        opname - the method name
        Returns:
        the method result
      • findNativeMethod

        public static java.lang.reflect.Method findNativeMethod​(java.lang.Class<?> context,
                                                                java.lang.String opname,
                                                                java.lang.Class<?>[] argTypes,
                                                                boolean isStatic)
        Looks for a native Java method.
        Parameters:
        context - The class of the method
        opname - The method name
        argTypes - The types of all arguments
        isStatic - Whether to look for a static method or not
        Returns:
        the method if found, null otherwise
      • findNativeMethod

        public static java.lang.reflect.Method findNativeMethod​(java.lang.Class<?> context,
                                                                java.lang.String opname,
                                                                java.lang.Class<?> argType,
                                                                boolean isStatic)
        Looks for a native Java method.
        Parameters:
        context - The class of the method
        opname - The method name
        argumentType - The type of the argument
        isStatic - Whether to look for a static method or not
        Returns:
        the method if found, null otherwise
      • findNativeMethod

        public static java.lang.reflect.Method findNativeMethod​(java.lang.Class<?> context,
                                                                java.lang.String opname,
                                                                boolean isStatic)
        Looks for a native Java method without arguments.
        Parameters:
        context - The class of the method
        opname - The method name
        isStatic - Whether to look for a static method or not
        Returns:
        the method if found, null otherwise
      • findNativeMethod

        public static java.lang.reflect.Method findNativeMethod​(Operation op,
                                                                java.lang.Object self,
                                                                java.lang.String opname)
        Looks for a native Java method without arguments.
        Parameters:
        op - the previously found EMFTVM Operation
        self - the object on which to invoke the method
        opname - the method name
        Returns:
        the method if found and more specific than op, null otherwise
      • findNativeMethod

        public static java.lang.reflect.Method findNativeMethod​(Operation op,
                                                                java.lang.Object self,
                                                                java.lang.String opname,
                                                                java.lang.Object arg)
        Looks for a native Java method with one argument.
        Parameters:
        op - the previously found EMFTVM Operation
        self - the object on which to invoke the method
        opname - the method name
        arg - the method argument
        Returns:
        the method if found and more specific than op, null otherwise
      • findNativeMethod

        public static java.lang.reflect.Method findNativeMethod​(Operation op,
                                                                java.lang.Object self,
                                                                java.lang.String opname,
                                                                java.lang.Object[] args)
        Looks for a native Java method with multiple arguments.
        Parameters:
        op - the previously found EMFTVM Operation
        self - the object on which to invoke the method
        opname - the method name
        args - the method arguments
        Returns:
        the method if found and more specific than op, null otherwise
      • findNativeSuperMethod

        public static java.lang.reflect.Method findNativeSuperMethod​(Operation op,
                                                                     java.lang.Class<?> context,
                                                                     java.lang.String opname)
        Looks for a native superclass Java method without arguments.
        Parameters:
        op - the previously found EMFTVM Operation
        context - the context for which to find the superclass method
        opname - the method name
        Returns:
        the method if found and more specific than op, null otherwise
      • findNativeSuperMethod

        public static java.lang.reflect.Method findNativeSuperMethod​(Operation op,
                                                                     java.lang.Class<?> context,
                                                                     java.lang.String opname,
                                                                     java.lang.Object arg)
        Looks for a native superclass Java method with one argument.
        Parameters:
        op - the previously found EMFTVM Operation
        context - the context for which to find the superclass method
        name - the method name
        arg - the method argument
        Returns:
        the method if found and more specific than op, null otherwise
      • findNativeSuperMethod

        public static java.lang.reflect.Method findNativeSuperMethod​(Operation op,
                                                                     java.lang.Class<?> context,
                                                                     java.lang.String opname,
                                                                     java.lang.Object[] args)
        Looks for a native superclass Java method with multiple arguments.
        Parameters:
        op - the previously found EMFTVM Operation
        context - the context for which to find the superclass method
        name - the method name
        args - the method arguments
        Returns:
        the method if found and more specific than op, null otherwise
      • findConstructor

        public static java.lang.reflect.Constructor<?> findConstructor​(java.lang.Class<?> context,
                                                                       java.lang.Class<?>[] argTypes)
        Looks for a native Java constructor.
        Parameters:
        context - The class of the method
        argumentTypes - The types of all arguments
        Returns:
        the constructor if found, null otherwise
      • getArgumentClasses

        public static java.lang.Class<?>[] getArgumentClasses​(java.lang.Object[] args)
        Retrieves the classes of args.
        Parameters:
        args -
        Returns:
        the classes of args
      • writeToWithCharset

        public static boolean writeToWithCharset​(java.lang.String string,
                                                 java.lang.String path,
                                                 java.lang.String charset)
                                          throws java.io.IOException
        Writes string to path with the given charset.
        Parameters:
        string - the string to write
        path - the path of the file to write to
        charset - the character set to use, or use default when null
        Returns:
        true on success
        Throws:
        java.io.IOException - when writing fails
      • getFile

        public static java.io.File getFile​(java.lang.String path)
        Returns the file with the given path in the workspace, or the file in the filesystem if the workspace is not available.
        Parameters:
        path - the absolute or relative path to a file.
        Returns:
        the file in the workspace, or the file in the filesystem if the workspace is not available.
      • createOperation

        public static Operation createOperation​(boolean isStatic,
                                                java.lang.String name,
                                                java.lang.String[] context,
                                                java.lang.String[] returnType,
                                                java.lang.String[][][] parameters,
                                                CodeBlock body)
        Creates a new Operation.
        Parameters:
        isStatic - whether the created operation is static
        name - operation name
        context - operation context [type model, type name]
        returnType - operation return [type model, type name]
        parameters - operations parameters: [[[name], [type model, type name]], ...]
        body - operation body
        Returns:
        a new Operation.
        See Also:
        Types
      • createField

        public static Field createField​(java.lang.String name,
                                        boolean isStatic,
                                        java.lang.String[] context,
                                        java.lang.String[] type,
                                        CodeBlock initialiser)
        Creates a new Field.
        Parameters:
        name - field name
        isStatic - whether the field is static
        context - field context [type model, type name]
        type - field [type model, type name]
        initialiser - field initialiser codeblock
        Returns:
        a new Field.
        See Also:
        Types
      • getTrans

        public static LazyList<java.lang.Object> getTrans​(java.lang.Object object,
                                                          Field field,
                                                          StackFrame frame,
                                                          LazyList<java.lang.Object> result)
        Retrieves the transitive closure of field on object.
        Parameters:
        object - the object on which to retrieve field
        field - the field for which to retrieve the value
        frame - the current StackFrame
        result - the intermediate list of values
        Returns:
        the updated result
      • getTrans

        public static LazyList<java.lang.Object> getTrans​(org.eclipse.emf.ecore.EObject object,
                                                          org.eclipse.emf.ecore.EStructuralFeature sf,
                                                          ExecEnv env,
                                                          LazyList<java.lang.Object> result)
        Retrieves the transitive closure of sf on object.
        Parameters:
        object - the object on which to retrieve sf
        sf - the structural feature for which to retrieve the value
        env - the current ExecEnv
        result - the intermediate list of values
        Returns:
        the updated result
      • getTrans

        public static LazyList<java.lang.Object> getTrans​(java.lang.Object object,
                                                          java.lang.reflect.Field field,
                                                          LazyList<java.lang.Object> result)
                                                   throws java.lang.IllegalArgumentException,
                                                          java.lang.IllegalAccessException
        Retrieves the transitive closure of field on object.
        Parameters:
        object - the object on which to retrieve field
        field - the field for which to retrieve the value
        result - the intermediate list of values
        Returns:
        the updated result
        Throws:
        java.lang.IllegalAccessException
        java.lang.IllegalArgumentException
      • getLocale

        public static java.util.Locale getLocale​(java.lang.String locale)
        Returns the Locale for the given locale string.
        Parameters:
        locale - the locale string (e.g. "nl_BE", "es_ES_Traditional_WIN")
        Returns:
        the Locale for the given locale string
      • registerEPackages

        public static void registerEPackages​(org.eclipse.emf.ecore.resource.ResourceSet rs)
        Registers all EPackage nsURIs in rs in the local rs EPackage.Registry. Sets the EPackage nsURI to the EPackage name if not set.
        Parameters:
        rs - the ResourceSet
      • findRootMethod

        public static java.lang.reflect.Method findRootMethod​(java.lang.reflect.Method method)
        Finds the root Class declaration for the given method.
        Parameters:
        method - the method for which to find the root declaration
        Returns:
        the root Method
      • getMethodCacheHitRate

        public static double getMethodCacheHitRate()
        Returns the hit rate of the method cache.
        Returns:
        the hit rate of the method cache, or -1.0 if no hits were recorded yet
      • getRootMethodCacheHitRate

        public static double getRootMethodCacheHitRate()
        Returns the hit rate of the root method cache.
        Returns:
        the hit rate of the root method cache, or -1.0 if no hits were recorded yet