Class TypeContext

  • All Implemented Interfaces:
    net.ssehub.easy.varModel.model.datatypes.IResolutionScope

    public class TypeContext
    extends java.lang.Object
    implements net.ssehub.easy.varModel.model.datatypes.IResolutionScope
    Defines a type context which consists of all variables defined in a project and additionally variables which can be added to the context in a layered manner. While IVML currently may not really require layered type contexts (shadowing variables), we just introduce it here for future use. The typical use is context.pushLayer(); context.addToContext(...); try { // resolve some types or expressions } catch (TranslatorException e) { throw e; } finally { context.popLayer(); } Please note that layers must properly be cleared (popLayer() . Further, a type context provides a resolution scope for its implicit definitions (without providing interfaces or a name).
    This class provides support for sorting elements on project level as well as on compound level according to the input.
    Author:
    Holger Eichelberger
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeContext​(TypeContext context)
      Creates a local type context.
      TypeContext​(net.ssehub.easy.varModel.model.Project project, net.ssehub.easy.dslCore.translation.MessageReceiver messageReceiver)
      Creates a type context for a given project.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) net.ssehub.easy.varModel.model.datatypes.CustomDatatype addImplicitDefinition​(net.ssehub.easy.varModel.model.datatypes.CustomDatatype type)
      Adds an implicit type definition.
      void addToContext​(net.ssehub.easy.varModel.model.AttributeAssignment assignment)
      Adds an attribute assignment to the current context (layer).
      void addToContext​(net.ssehub.easy.varModel.model.datatypes.Compound comp)
      Adds a compound to the current context (layer).
      (package private) void addToContext​(net.ssehub.easy.varModel.model.datatypes.Compound compound, java.lang.String unresolvedParentCompound)
      Stores a refined compound where the parent/super compound could not be loaded at the current time.
      private void addToContext​(net.ssehub.easy.varModel.model.datatypes.Compound comp, java.util.Set<net.ssehub.easy.varModel.model.datatypes.Compound> done)
      Adds a compound to the current context (layer).
      void addToContext​(net.ssehub.easy.varModel.model.DecisionVariableDeclaration var)
      Adds a variable declaration to the current context (layer).
      void addToContext​(net.ssehub.easy.varModel.model.OperationDefinition opDef)
      Adds an operation definition to the current context (layer).
      boolean addToProject​(org.eclipse.emf.ecore.EObject key, net.ssehub.easy.varModel.model.Comment comment, net.ssehub.easy.varModel.model.ContainableModelElement element)
      Adds a containable element to the root resolution scope as well as a mapping from key to comment (optional) and element.
      static boolean allResolved​(net.ssehub.easy.varModel.model.datatypes.IDatatype[] types)
      Returns whether all types in types are resolved.
      void checkEnumOclCompliance​(java.lang.String qName, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature)
      Checks a (potentially) qualified enum literal name for OCL compliance if enabled.
      void clear()
      Clears this type context (for possible reuse).
      (package private) void clearUnresolvedCompounds​(java.lang.String parentCompound)
      Clears the list of incomplete compounds, where the parent/super compound of a refinement was missing.
      void closeSorter​(net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter sorter, java.util.List<org.eclipse.emf.ecore.EObject> elements)
      Closes an elements sorter (regarding the stored data) and sorts the elements within the compound.
      private static net.ssehub.easy.varModel.cst.ConstantValue createConstantValue​(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, net.ssehub.easy.varModel.model.datatypes.IDatatype type, java.lang.Object... values)
      Creates a constant value.
      private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree createValueTree​(java.lang.String sValue, net.ssehub.easy.varModel.model.datatypes.IDatatype type, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature)
      Creates a value tree for a given type.
      private net.ssehub.easy.varModel.model.IModelElement findActualParent​(net.ssehub.easy.varModel.model.IModelElement elt)
      Returns the actual project or compound the element is located in.
      net.ssehub.easy.varModel.model.datatypes.Compound[] findCompounds​(java.util.List<java.lang.String> names, boolean nullOnFail)
      Finds compounds according to the given names.
      net.ssehub.easy.varModel.model.ContainableModelElement findElementByName​(java.lang.String name, java.lang.Class<? extends net.ssehub.easy.varModel.model.ModelElement> type)
      Searches for a specified element.
      net.ssehub.easy.varModel.model.datatypes.IDatatype findRefType​(net.ssehub.easy.varModel.model.datatypes.IDatatype contained)
      Finds a reference type (declaration or defines an implicit type) for a given contained type.
      net.ssehub.easy.varModel.model.datatypes.IDatatype findType​(java.lang.String name, java.lang.Class<? extends net.ssehub.easy.varModel.model.datatypes.IDatatype> type)
      Finds the specified data type definition.
      net.ssehub.easy.varModel.model.AbstractVariable findVariable​(java.lang.String name, java.lang.Class<? extends net.ssehub.easy.varModel.model.AbstractVariable> type)
      Searches for a specified variable.
      net.ssehub.easy.varModel.model.IModelElement findVariableUse​(java.lang.String name)
      Searches for the use of a specified variable (declaration or compound access).
      net.ssehub.easy.varModel.model.ContainableModelElement getElement​(int index)
      Returns a contained model element specified by index.
      net.ssehub.easy.varModel.model.ContainableModelElement getElement​(java.lang.String name)  
      int getElementCount()
      Returns the number of contained elements.
      net.ssehub.easy.varModel.model.ProjectImport getImport​(int index)  
      int getImportsCount()  
      java.lang.String getName()  
      net.ssehub.easy.varModel.model.IModelElement getParent()  
      net.ssehub.easy.varModel.model.Project getProject()
      Returns the project providing the root resolution scope.
      private net.ssehub.easy.varModel.cst.Self getSelf​(net.ssehub.easy.varModel.model.datatypes.Compound comp)
      Returns a self instance from the self pool.
      (package private) java.util.List<net.ssehub.easy.varModel.model.datatypes.Compound> getUnresolvedCompoundRefinments​(java.lang.String parentCompound)
      Returns a list of compounds where the given compound was specified as a super/parent compound, but could not be set, as it was not available during parsing the child compound.
      boolean hasInterfaces()  
      boolean isInterface()  
      net.ssehub.easy.varModel.cst.Variable obtainVariable​(net.ssehub.easy.varModel.model.AbstractVariable decl)
      Obtains a CTS variable node for a given variable declaration, i.e., creates it or returns it from the variable pool of this context.
      void popLayer()
      Pop a resolution layer in case that intermediary variables shell be considered, e.g.
      void popLayer​(int count)
      Pops count layers.
      (package private) net.ssehub.easy.varModel.cst.ConstraintSyntaxTree processQValue​(java.lang.String sValue, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature)
      Processes a qualified name as value.
      void pushLayer​(net.ssehub.easy.varModel.model.IModelElement parent)
      Push a resolution layer in case that intermediary variables shell be considered, e.g.
      int pushParent​(net.ssehub.easy.varModel.model.DecisionVariableDeclaration decVar)
      Pushes the enclosing parents of decVar.
      private int pushParentRec​(net.ssehub.easy.varModel.model.IModelElement elt)
      Pushes the enclosing parents of elt in a recursive manner.
      void registerSorter​(net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter sorter, org.eclipse.emf.ecore.EObject key, net.ssehub.easy.varModel.model.Comment comment, net.ssehub.easy.varModel.model.ContainableModelElement element)
      Registers an element to be sorted (later).
      private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree resolveSelf​(net.ssehub.easy.varModel.model.IModelElement parent, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature)
      Resolves "self" and returns the corresponding syntax tree (one node).
      net.ssehub.easy.varModel.model.datatypes.IDatatype resolveType​(de.uni_hildesheim.sse.ivml.Type type)
      Resolves a given type to a type representation in the IVML object model.
      net.ssehub.easy.varModel.cst.ConstraintSyntaxTree resolveValue​(de.uni_hildesheim.sse.ivml.Value value, net.ssehub.easy.varModel.model.IModelElement parent, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature)
      Resolves a value and returns the corresponding syntax tree (one node).
      private static void setIndexes​(java.util.List<org.eclipse.emf.ecore.EObject> elements, ContainableElementsMapAndComparator map)
      Transfers the index positions of elements to map.
      void sortProjectElements​(java.util.List<org.eclipse.emf.ecore.EObject> topLevelElements)
      Sorts the elements in the root resolution scope according to the the given list of top-level elements.
      • Methods inherited from class java.lang.Object

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

      • implicitDefinitions

        private net.ssehub.easy.varModel.model.ContainableModelElementList implicitDefinitions
      • project

        private net.ssehub.easy.varModel.model.Project project
      • messageReceiver

        private net.ssehub.easy.dslCore.translation.MessageReceiver messageReceiver
      • variablePool

        private net.ssehub.easy.varModel.cst.VariablePool variablePool
      • selfPool

        private java.util.Map<net.ssehub.easy.varModel.model.datatypes.Compound,​net.ssehub.easy.varModel.cst.Self> selfPool
      • directContext

        private java.util.Stack<net.ssehub.easy.varModel.model.ContainableModelElementList> directContext
      • unresolvedCompoundRefinements

        private java.util.Map<java.lang.String,​java.util.List<net.ssehub.easy.varModel.model.datatypes.Compound>> unresolvedCompoundRefinements
    • Constructor Detail

      • TypeContext

        public TypeContext​(net.ssehub.easy.varModel.model.Project project,
                           net.ssehub.easy.dslCore.translation.MessageReceiver messageReceiver)
        Creates a type context for a given project.
        Parameters:
        project - the project representing the root resolution scope of this type context
        messageReceiver - instance for receiving, storing and passing messages to Eclipse
      • TypeContext

        public TypeContext​(TypeContext context)
        Creates a local type context.
        Parameters:
        context - the global type context to take basic information from
    • Method Detail

      • pushLayer

        public void pushLayer​(net.ssehub.easy.varModel.model.IModelElement parent)
        Push a resolution layer in case that intermediary variables shell be considered, e.g. within a compound. Please note that the parent itself is not added to the layer/context and needs a specific subsequent add call.
        Parameters:
        parent - the parent (scope, may be null - in this case the parent scope of the previous layer is considered)
      • pushParent

        public int pushParent​(net.ssehub.easy.varModel.model.DecisionVariableDeclaration decVar)
        Pushes the enclosing parents of decVar.
        Parameters:
        decVar - the variable to push
        Returns:
        the number of layers pushed
      • pushParentRec

        private int pushParentRec​(net.ssehub.easy.varModel.model.IModelElement elt)
        Pushes the enclosing parents of elt in a recursive manner.
        Parameters:
        elt - the element to push the parents for
        Returns:
        the number of layers pushed
      • popLayer

        public void popLayer()
        Pop a resolution layer in case that intermediary variables shell be considered, e.g. at the end of a compound. Please consider proper handling of exceptions so that this method is always called at the end of a pushed section so that further semantic analysis after the error is possible!
      • addToContext

        public void addToContext​(net.ssehub.easy.varModel.model.datatypes.Compound comp)
        Adds a compound to the current context (layer). Please call #pushLayer() before.
        Parameters:
        comp - the compound for which all contained variables shall be added
      • addToContext

        private void addToContext​(net.ssehub.easy.varModel.model.datatypes.Compound comp,
                                  java.util.Set<net.ssehub.easy.varModel.model.datatypes.Compound> done)
        Adds a compound to the current context (layer). Please call #pushLayer() before.
        Parameters:
        comp - the compound for which all contained variables shall be added
        done - already added compounds
      • addToContext

        public void addToContext​(net.ssehub.easy.varModel.model.AttributeAssignment assignment)
        Adds an attribute assignment to the current context (layer). Please call #pushLayer() before.
        Parameters:
        assignment - the assignment for which all contained variables shall be added
      • addToContext

        void addToContext​(net.ssehub.easy.varModel.model.datatypes.Compound compound,
                          java.lang.String unresolvedParentCompound)
        Stores a refined compound where the parent/super compound could not be loaded at the current time.
        Parameters:
        compound - A refined compound where the super compound was not set so far (i.e. is set to null).
        unresolvedParentCompound - The name of the super/parent compound, which was not found so far.
      • getUnresolvedCompoundRefinments

        java.util.List<net.ssehub.easy.varModel.model.datatypes.Compound> getUnresolvedCompoundRefinments​(java.lang.String parentCompound)
        Returns a list of compounds where the given compound was specified as a super/parent compound, but could not be set, as it was not available during parsing the child compound.
        Parameters:
        parentCompound - The parent/super compound of a refinement.
        Returns:
        null or a list of incomplete compounds.
      • clearUnresolvedCompounds

        void clearUnresolvedCompounds​(java.lang.String parentCompound)
        Clears the list of incomplete compounds, where the parent/super compound of a refinement was missing. Should be done after the refinements where resolved.
        Parameters:
        parentCompound - The name of the super/parent compound.
      • addToContext

        public void addToContext​(net.ssehub.easy.varModel.model.OperationDefinition opDef)
        Adds an operation definition to the current context (layer). Please call #pushLayer() before.
        Parameters:
        opDef - the operation definition which shall be added
      • addToContext

        public void addToContext​(net.ssehub.easy.varModel.model.DecisionVariableDeclaration var)
        Adds a variable declaration to the current context (layer). Please call #pushLayer() before.
        Parameters:
        var - the decision variable declaration which shall be added
      • getProject

        public net.ssehub.easy.varModel.model.Project getProject()
        Returns the project providing the root resolution scope.
        Returns:
        the project
      • obtainVariable

        public final net.ssehub.easy.varModel.cst.Variable obtainVariable​(net.ssehub.easy.varModel.model.AbstractVariable decl)
        Obtains a CTS variable node for a given variable declaration, i.e., creates it or returns it from the variable pool of this context.
        Parameters:
        decl - the declaration
        Returns:
        the variable
      • resolveType

        public net.ssehub.easy.varModel.model.datatypes.IDatatype resolveType​(de.uni_hildesheim.sse.ivml.Type type)
                                                                       throws net.ssehub.easy.dslCore.translation.TranslatorException
        Resolves a given type to a type representation in the IVML object model.
        Parameters:
        type - the type to be resolved
        Returns:
        the representing type
        Throws:
        net.ssehub.easy.dslCore.translation.TranslatorException - in case that the given type cannot be resolved
      • findRefType

        public net.ssehub.easy.varModel.model.datatypes.IDatatype findRefType​(net.ssehub.easy.varModel.model.datatypes.IDatatype contained)
        Finds a reference type (declaration or defines an implicit type) for a given contained type.
        Parameters:
        contained - the contained type
        Returns:
        the reference type declaration
      • findElementByName

        public net.ssehub.easy.varModel.model.ContainableModelElement findElementByName​(java.lang.String name,
                                                                                        java.lang.Class<? extends net.ssehub.easy.varModel.model.ModelElement> type)
                                                                                 throws net.ssehub.easy.varModel.model.ModelQueryException
        Searches for a specified element.
        Parameters:
        name - the name of the element to search for (may be qualified)
        type - the specific element to be returned
        Returns:
        the corresponding variable or null
        Throws:
        net.ssehub.easy.varModel.model.ModelQueryException - in case of semantic problems
      • findVariable

        public net.ssehub.easy.varModel.model.AbstractVariable findVariable​(java.lang.String name,
                                                                            java.lang.Class<? extends net.ssehub.easy.varModel.model.AbstractVariable> type)
                                                                     throws net.ssehub.easy.varModel.model.ModelQueryException
        Searches for a specified variable.
        Parameters:
        name - the name of the variable to search for (may be qualified)
        type - the specific variable of datatype to be returned, AbstractVariable is used if null
        Returns:
        the corresponding variable or null
        Throws:
        net.ssehub.easy.varModel.model.ModelQueryException - in case of semantic problems
      • findActualParent

        private net.ssehub.easy.varModel.model.IModelElement findActualParent​(net.ssehub.easy.varModel.model.IModelElement elt)
        Returns the actual project or compound the element is located in.
        Parameters:
        elt - the element
        Returns:
        the actual parent
      • findVariableUse

        public net.ssehub.easy.varModel.model.IModelElement findVariableUse​(java.lang.String name)
                                                                     throws net.ssehub.easy.varModel.model.ModelQueryException
        Searches for the use of a specified variable (declaration or compound access).
        Parameters:
        name - the name of the variable to search for (may be qualified)
        Returns:
        the corresponding variable or null
        Throws:
        net.ssehub.easy.varModel.model.ModelQueryException - in case of semantic problems
      • findType

        public net.ssehub.easy.varModel.model.datatypes.IDatatype findType​(java.lang.String name,
                                                                           java.lang.Class<? extends net.ssehub.easy.varModel.model.datatypes.IDatatype> type)
                                                                    throws net.ssehub.easy.varModel.model.ModelQueryException
        Finds the specified data type definition.
        Parameters:
        name - the name of the type to search for (may be qualified)
        type - the specific type of datatype to be returned, IDatatype is used if null
        Returns:
        the corresponding type or null
        Throws:
        net.ssehub.easy.varModel.model.ModelQueryException - in case of semantic problems
      • findCompounds

        public net.ssehub.easy.varModel.model.datatypes.Compound[] findCompounds​(java.util.List<java.lang.String> names,
                                                                                 boolean nullOnFail)
                                                                          throws net.ssehub.easy.varModel.model.ModelQueryException
        Finds compounds according to the given names.
        Parameters:
        names - the names of the compounds
        nullOnFail - if null shall be returned on failing resolution
        Returns:
        the found compounds (null if there was nothing to resolve or individuals were not resolved and nullOnFail, else an array with null entries)
        Throws:
        net.ssehub.easy.varModel.model.ModelQueryException - in case of semantic problems
      • allResolved

        public static boolean allResolved​(net.ssehub.easy.varModel.model.datatypes.IDatatype[] types)
        Returns whether all types in types are resolved.
        Parameters:
        types - the types to inspect
        Returns:
        true for all resolved, false for at least one not resolved or null==types
      • getElement

        public net.ssehub.easy.varModel.model.ContainableModelElement getElement​(int index)
        Returns a contained model element specified by index.
        Specified by:
        getElement in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
        Parameters:
        index - a 0-based index specifying the operation to be returned
        Returns:
        the contained element
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getElementCount()
      • getElementCount

        public int getElementCount()
        Returns the number of contained elements.
        Specified by:
        getElementCount in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
        Returns:
        the number of contained elements
      • addImplicitDefinition

        net.ssehub.easy.varModel.model.datatypes.CustomDatatype addImplicitDefinition​(net.ssehub.easy.varModel.model.datatypes.CustomDatatype type)
        Adds an implicit type definition.
        Parameters:
        type - the implicitly defined type
        Returns:
        type
        See Also:
        getElement(int), getElementCount()
      • resolveValue

        public net.ssehub.easy.varModel.cst.ConstraintSyntaxTree resolveValue​(de.uni_hildesheim.sse.ivml.Value value,
                                                                              net.ssehub.easy.varModel.model.IModelElement parent,
                                                                              org.eclipse.emf.ecore.EObject object,
                                                                              org.eclipse.emf.ecore.EStructuralFeature feature)
                                                                       throws net.ssehub.easy.dslCore.translation.TranslatorException
        Resolves a value and returns the corresponding syntax tree (one node).
        Parameters:
        value - the value to be converted
        parent - the model parent
        object - the grammar object this method is called for
        feature - the grammar feature this method is called for
        Returns:
        the corresponding syntax tree
        Throws:
        net.ssehub.easy.dslCore.translation.TranslatorException - in case of any translation problem
      • createConstantValue

        private static net.ssehub.easy.varModel.cst.ConstantValue createConstantValue​(org.eclipse.emf.ecore.EObject object,
                                                                                      org.eclipse.emf.ecore.EStructuralFeature feature,
                                                                                      net.ssehub.easy.varModel.model.datatypes.IDatatype type,
                                                                                      java.lang.Object... values)
                                                                               throws net.ssehub.easy.dslCore.translation.TranslatorException
        Creates a constant value.
        Parameters:
        object - the grammar object this method is called for
        feature - the grammar feature this method is called for
        type - the type to create the value for
        values - the actual value(s) (may be null)
        Returns:
        the constant value
        Throws:
        net.ssehub.easy.dslCore.translation.TranslatorException - if creating the constant value fails
      • resolveSelf

        private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree resolveSelf​(net.ssehub.easy.varModel.model.IModelElement parent,
                                                                              org.eclipse.emf.ecore.EObject object,
                                                                              org.eclipse.emf.ecore.EStructuralFeature feature)
                                                                       throws net.ssehub.easy.dslCore.translation.TranslatorException
        Resolves "self" and returns the corresponding syntax tree (one node).
        Parameters:
        parent - the model parent
        object - the grammar object this method is called for
        feature - the grammar feature this method is called for
        Returns:
        the corresponding syntax tree
        Throws:
        net.ssehub.easy.dslCore.translation.TranslatorException - in case of any translation problem
      • getSelf

        private net.ssehub.easy.varModel.cst.Self getSelf​(net.ssehub.easy.varModel.model.datatypes.Compound comp)
        Returns a self instance from the self pool.
        Parameters:
        comp - the compond to return the self instance for
        Returns:
        the self instance
      • processQValue

        net.ssehub.easy.varModel.cst.ConstraintSyntaxTree processQValue​(java.lang.String sValue,
                                                                        org.eclipse.emf.ecore.EObject object,
                                                                        org.eclipse.emf.ecore.EStructuralFeature feature)
                                                                 throws net.ssehub.easy.dslCore.translation.TranslatorException
        Processes a qualified name as value.
        Parameters:
        sValue - the qualified name as string
        object - the grammar object this method is called for
        feature - the grammar feature this method is called for
        Returns:
        the corresponding syntax tree
        Throws:
        net.ssehub.easy.dslCore.translation.TranslatorException - in case of any translation problem
      • checkEnumOclCompliance

        public void checkEnumOclCompliance​(java.lang.String qName,
                                           org.eclipse.emf.ecore.EObject object,
                                           org.eclipse.emf.ecore.EStructuralFeature feature)
        Checks a (potentially) qualified enum literal name for OCL compliance if enabled.
        Parameters:
        qName - the qualified name
        object - the grammar object this method is called for
        feature - the grammar feature this method is called for
      • createValueTree

        private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree createValueTree​(java.lang.String sValue,
                                                                                  net.ssehub.easy.varModel.model.datatypes.IDatatype type,
                                                                                  org.eclipse.emf.ecore.EObject object,
                                                                                  org.eclipse.emf.ecore.EStructuralFeature feature)
                                                                           throws net.ssehub.easy.dslCore.translation.TranslatorException
        Creates a value tree for a given type.
        Parameters:
        sValue - the string representation of the value
        type - the target type
        object - the grammar object this method is called for
        feature - the grammar feature this method is called for
        Returns:
        the value tree
        Throws:
        net.ssehub.easy.dslCore.translation.TranslatorException - in case of any translation problem
      • getImportsCount

        public int getImportsCount()
        Specified by:
        getImportsCount in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
      • getImport

        public net.ssehub.easy.varModel.model.ProjectImport getImport​(int index)
        Specified by:
        getImport in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
      • getParent

        public net.ssehub.easy.varModel.model.IModelElement getParent()
        Specified by:
        getParent in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
      • hasInterfaces

        public boolean hasInterfaces()
        Specified by:
        hasInterfaces in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
      • isInterface

        public boolean isInterface()
        Specified by:
        isInterface in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope
      • addToProject

        public boolean addToProject​(org.eclipse.emf.ecore.EObject key,
                                    net.ssehub.easy.varModel.model.Comment comment,
                                    net.ssehub.easy.varModel.model.ContainableModelElement element)
        Adds a containable element to the root resolution scope as well as a mapping from key to comment (optional) and element.
        Parameters:
        key - the key object as parsed by xText from the input file (may be null then no mapping is added, e.g. when adding a comment only)
        comment - the comment instance (may be null)
        element - the element instance
        Returns:
        true if the addition was successful, false else due to duplicated names
        See Also:
        ContainableElementsMapAndComparator.put(EObject, Comment, ContainableModelElement)
      • sortProjectElements

        public void sortProjectElements​(java.util.List<org.eclipse.emf.ecore.EObject> topLevelElements)
        Sorts the elements in the root resolution scope according to the the given list of top-level elements.
        Parameters:
        topLevelElements - the top-level elements from the grammar
      • setIndexes

        private static void setIndexes​(java.util.List<org.eclipse.emf.ecore.EObject> elements,
                                       ContainableElementsMapAndComparator map)
        Transfers the index positions of elements to map.
        Parameters:
        elements - the list representing the positions
        map - the target map to set the values to
      • registerSorter

        public void registerSorter​(net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter sorter,
                                   org.eclipse.emf.ecore.EObject key,
                                   net.ssehub.easy.varModel.model.Comment comment,
                                   net.ssehub.easy.varModel.model.ContainableModelElement element)
        Registers an element to be sorted (later).
        Parameters:
        sorter - the element being sorted later
        key - the key object as parsed by xText from the input file (may be null then no mapping is added, e.g. when adding a comment only)
        comment - the comment instance (may be null)
        element - the element instance
      • closeSorter

        public void closeSorter​(net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter sorter,
                                java.util.List<org.eclipse.emf.ecore.EObject> elements)
        Closes an elements sorter (regarding the stored data) and sorts the elements within the compound.
        Parameters:
        sorter - the element being sorted
        elements - the grammar elements within the compound defining the sort order
      • clear

        public void clear()
        Clears this type context (for possible reuse).
      • getElement

        public net.ssehub.easy.varModel.model.ContainableModelElement getElement​(java.lang.String name)
        Specified by:
        getElement in interface net.ssehub.easy.varModel.model.datatypes.IResolutionScope