Class TypeContext
- java.lang.Object
-
- de.uni_hildesheim.sse.translation.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.IResolutionScopeDefines 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 iscontext.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Stack<net.ssehub.easy.varModel.model.ContainableModelElementList>directContextprivate java.util.Map<net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter,ContainableElementsMapAndComparator>elementSortMapsprivate net.ssehub.easy.varModel.model.ContainableModelElementListimplicitDefinitionsprivate net.ssehub.easy.dslCore.translation.MessageReceivermessageReceiverprivate net.ssehub.easy.varModel.model.Projectprojectprivate java.util.Map<net.ssehub.easy.varModel.model.datatypes.Compound,net.ssehub.easy.varModel.cst.Self>selfPoolprivate ContainableElementsMapAndComparatorsortMapprivate java.util.Map<java.lang.String,java.util.List<net.ssehub.easy.varModel.model.datatypes.Compound>>unresolvedCompoundRefinementsprivate net.ssehub.easy.varModel.cst.VariablePoolvariablePool
-
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.CustomDatatypeaddImplicitDefinition(net.ssehub.easy.varModel.model.datatypes.CustomDatatype type)Adds an implicit type definition.voidaddToContext(net.ssehub.easy.varModel.model.AttributeAssignment assignment)Adds an attribute assignment to the current context (layer).voidaddToContext(net.ssehub.easy.varModel.model.datatypes.Compound comp)Adds a compound to the current context (layer).(package private) voidaddToContext(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 voidaddToContext(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).voidaddToContext(net.ssehub.easy.varModel.model.DecisionVariableDeclaration var)Adds a variable declaration to the current context (layer).voidaddToContext(net.ssehub.easy.varModel.model.OperationDefinition opDef)Adds an operation definition to the current context (layer).booleanaddToProject(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 fromkeytocomment(optional) andelement.static booleanallResolved(net.ssehub.easy.varModel.model.datatypes.IDatatype[] types)Returns whether all types intypesare resolved.voidcheckEnumOclCompliance(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.voidclear()Clears this type context (for possible reuse).(package private) voidclearUnresolvedCompounds(java.lang.String parentCompound)Clears the list of incomplete compounds, where the parent/super compound of a refinement was missing.voidcloseSorter(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.ConstantValuecreateConstantValue(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.ConstraintSyntaxTreecreateValueTree(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 giventype.private net.ssehub.easy.varModel.model.IModelElementfindActualParent(net.ssehub.easy.varModel.model.IModelElement elt)Returns the actual project or compound theelementis located in.net.ssehub.easy.varModel.model.datatypes.Compound[]findCompounds(java.util.List<java.lang.String> names, boolean nullOnFail)Finds compounds according to the givennames.net.ssehub.easy.varModel.model.ContainableModelElementfindElementByName(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.IDatatypefindRefType(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.IDatatypefindType(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.AbstractVariablefindVariable(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.IModelElementfindVariableUse(java.lang.String name)Searches for the use of a specified variable (declaration or compound access).net.ssehub.easy.varModel.model.ContainableModelElementgetElement(int index)Returns a contained model element specified byindex.net.ssehub.easy.varModel.model.ContainableModelElementgetElement(java.lang.String name)intgetElementCount()Returns the number of contained elements.net.ssehub.easy.varModel.model.ProjectImportgetImport(int index)intgetImportsCount()java.lang.StringgetName()net.ssehub.easy.varModel.model.IModelElementgetParent()net.ssehub.easy.varModel.model.ProjectgetProject()Returns the project providing the root resolution scope.private net.ssehub.easy.varModel.cst.SelfgetSelf(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.booleanhasInterfaces()booleanisInterface()net.ssehub.easy.varModel.cst.VariableobtainVariable(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.voidpopLayer()Pop a resolution layer in case that intermediary variables shell be considered, e.g.voidpopLayer(int count)Popscountlayers.(package private) net.ssehub.easy.varModel.cst.ConstraintSyntaxTreeprocessQValue(java.lang.String sValue, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature)Processes a qualified name as value.voidpushLayer(net.ssehub.easy.varModel.model.IModelElement parent)Push a resolution layer in case that intermediary variables shell be considered, e.g.intpushParent(net.ssehub.easy.varModel.model.DecisionVariableDeclaration decVar)Pushes the enclosing parents ofdecVar.private intpushParentRec(net.ssehub.easy.varModel.model.IModelElement elt)Pushes the enclosing parents ofeltin a recursive manner.voidregisterSorter(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.ConstraintSyntaxTreeresolveSelf(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.IDatatyperesolveType(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.ConstraintSyntaxTreeresolveValue(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 voidsetIndexes(java.util.List<org.eclipse.emf.ecore.EObject> elements, ContainableElementsMapAndComparator map)Transfers the index positions ofelementstomap.voidsortProjectElements(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.
-
-
-
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
-
sortMap
private ContainableElementsMapAndComparator sortMap
-
elementSortMaps
private java.util.Map<net.ssehub.easy.varModel.model.datatypes.IContainableElementsSorter,ContainableElementsMapAndComparator> elementSortMaps
-
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 contextmessageReceiver- 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 ofdecVar.- 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 ofeltin a recursive manner.- Parameters:
elt- the element to push the parents for- Returns:
- the number of layers pushed
-
popLayer
public void popLayer(int count)
Popscountlayers.- Parameters:
count- the amount of layers to pop- See Also:
pushParent(DecisionVariableDeclaration)
-
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 addeddone- 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.TranslatorExceptionResolves 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 giventypecannot 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.ModelQueryExceptionSearches 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.ModelQueryExceptionSearches 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,AbstractVariableis 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 theelementis 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.ModelQueryExceptionSearches 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.ModelQueryExceptionFinds 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,IDatatypeis 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.ModelQueryExceptionFinds compounds according to the givennames.- Parameters:
names- the names of the compoundsnullOnFail- 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 intypesare resolved.- Parameters:
types- the types to inspect- Returns:
truefor all resolved,falsefor at least one not resolved ornull==types
-
getElement
public net.ssehub.easy.varModel.model.ContainableModelElement getElement(int index)
Returns a contained model element specified byindex.- Specified by:
getElementin interfacenet.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- ifindex<0 || index>=getElementCount()
-
getElementCount
public int getElementCount()
Returns the number of contained elements.- Specified by:
getElementCountin interfacenet.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.TranslatorExceptionResolves a value and returns the corresponding syntax tree (one node).- Parameters:
value- the value to be convertedparent- the model parentobject- the grammar object this method is called forfeature- 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.TranslatorExceptionCreates a constant value.- Parameters:
object- the grammar object this method is called forfeature- the grammar feature this method is called fortype- the type to create the value forvalues- 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.TranslatorExceptionResolves "self" and returns the corresponding syntax tree (one node).- Parameters:
parent- the model parentobject- the grammar object this method is called forfeature- 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.TranslatorExceptionProcesses a qualified name as value.- Parameters:
sValue- the qualified name as stringobject- the grammar object this method is called forfeature- 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 nameobject- the grammar object this method is called forfeature- 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.TranslatorExceptionCreates a value tree for a giventype.- Parameters:
sValue- the string representation of the valuetype- the target typeobject- the grammar object this method is called forfeature- 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:
getImportsCountin interfacenet.ssehub.easy.varModel.model.datatypes.IResolutionScope
-
getImport
public net.ssehub.easy.varModel.model.ProjectImport getImport(int index)
- Specified by:
getImportin interfacenet.ssehub.easy.varModel.model.datatypes.IResolutionScope
-
getParent
public net.ssehub.easy.varModel.model.IModelElement getParent()
- Specified by:
getParentin interfacenet.ssehub.easy.varModel.model.datatypes.IResolutionScope
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfacenet.ssehub.easy.varModel.model.datatypes.IResolutionScope
-
hasInterfaces
public boolean hasInterfaces()
- Specified by:
hasInterfacesin interfacenet.ssehub.easy.varModel.model.datatypes.IResolutionScope
-
isInterface
public boolean isInterface()
- Specified by:
isInterfacein interfacenet.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 fromkeytocomment(optional) andelement.- 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:
trueif the addition was successful,falseelse 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 ofelementstomap.- Parameters:
elements- the list representing the positionsmap- 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 laterkey- 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 sortedelements- 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:
getElementin interfacenet.ssehub.easy.varModel.model.datatypes.IResolutionScope
-
-