Class Utils


  • public class Utils
    extends java.lang.Object
    Some public utility methods.
    Author:
    Holger Eichelberger
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Utils.SplitResult
      The result of splitting a contents object.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Utils()
      Prevents this class from being instantiated from outside.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static <T> java.util.List<T> assign​(java.util.List<T> list, java.lang.Object element, java.lang.Class<T> type)
      Helper function to assign the element to list if element is of type type and to create list if not defined before.
      static java.lang.String getQualifiedNameString​(de.uni_hildesheim.sse.ivml.QualifiedName name)
      Returns a string representing a qualified name.
      static java.lang.String getQualifiedNameString​(de.uni_hildesheim.sse.ivml.QualifiedName name, de.uni_hildesheim.sse.ivml.AccessName aName)
      Returns a string representing a qualified name.
      static boolean isImportResolutionEnabled()
      Returns whether the import resolution shall be enabled.
      static <T> java.util.List<T> select​(java.util.List<org.eclipse.emf.ecore.EObject> list, java.lang.Class<T> type)
      Selects those elements out of list which are an instance of type.
      static Utils.SplitResult split​(java.util.List<org.eclipse.emf.ecore.EObject> elements)
      Splits the now heterogeneous list of elements in elements into individual lists stored in the result instance.
      static void split​(java.util.List<org.eclipse.emf.ecore.EObject> elements, Utils.SplitResult result)
      Splits the now heterogeneous list of elements in elements into individual lists stored in result instance.
      static java.lang.String toString​(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl)
      Turns the declared variable names of the varDecl into a string.
      • Methods inherited from class java.lang.Object

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

      • Utils

        private Utils()
        Prevents this class from being instantiated from outside.
    • Method Detail

      • getQualifiedNameString

        public static java.lang.String getQualifiedNameString​(de.uni_hildesheim.sse.ivml.QualifiedName name)
        Returns a string representing a qualified name. (May change in future to structured qualified names.)
        Parameters:
        name - the qualified name
        Returns:
        the corresponding string representation
      • getQualifiedNameString

        public static java.lang.String getQualifiedNameString​(de.uni_hildesheim.sse.ivml.QualifiedName name,
                                                              de.uni_hildesheim.sse.ivml.AccessName aName)
        Returns a string representing a qualified name. (May change in future to structured qualified names.)
        Parameters:
        name - the qualified name
        aName - optional access to a compound (may be null)
        Returns:
        the corresponding string representation
      • select

        public static <T> java.util.List<T> select​(java.util.List<org.eclipse.emf.ecore.EObject> list,
                                                   java.lang.Class<T> type)
        Selects those elements out of list which are an instance of type.
        Type Parameters:
        T - the type of elements to be selected
        Parameters:
        list - the list to select from
        type - the type to select upon
        Returns:
        a list of elements which are an instance of type
      • assign

        private static <T> java.util.List<T> assign​(java.util.List<T> list,
                                                    java.lang.Object element,
                                                    java.lang.Class<T> type)
        Helper function to assign the element to list if element is of type type and to create list if not defined before.
        Type Parameters:
        T - the type of elements to be processed
        Parameters:
        list - the list to insert element into
        element - the element to be inserted
        type - the type to check for
        Returns:
        list or a new list including element if type matches
      • split

        public static Utils.SplitResult split​(java.util.List<org.eclipse.emf.ecore.EObject> elements)
        Splits the now heterogeneous list of elements in elements into individual lists stored in the result instance.
        Parameters:
        elements - the elements to split
        Returns:
        the result instance
      • split

        public static void split​(java.util.List<org.eclipse.emf.ecore.EObject> elements,
                                 Utils.SplitResult result)
        Splits the now heterogeneous list of elements in elements into individual lists stored in result instance.
        Parameters:
        elements - the elements to split
        result - the result instance to be modified as a side effect
      • isImportResolutionEnabled

        public static final boolean isImportResolutionEnabled()
        Returns whether the import resolution shall be enabled. This method is legacy and was created while the editor was in an early stage. Please check and remove if adequate.
        Returns:
        true if import resolution is enabled, false else
      • toString

        public static java.lang.String toString​(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl)
        Turns the declared variable names of the varDecl into a string. [debugging]
        Parameters:
        varDecl - the variable declaration
        Returns:
        the names of the declared variables