public class EcoreModelQuery extends AbstractEcoreModelQuery<de.uni_hildesheim.sse.ivml.Project,ModelElementTypeFinder.ModelElementDescription>
| Modifier and Type | Field and Description |
|---|---|
static EcoreModelQuery |
INSTANCE
The instance of this
EcoreModelQuery for retrieving elements from an
Ecore-model. |
| Modifier | Constructor and Description |
|---|---|
private |
EcoreModelQuery()
Constructs an instance of this
EcoreModelQuery. |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
compareByBasicType(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
Checks whether the given
ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration. |
private boolean |
compareByDerivedType(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
Checks whether the given
ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration. |
private boolean |
compareByQualifiedName(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
Checks whether the given
ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration. |
private java.lang.String |
constructFullTypeDefinition(de.uni_hildesheim.sse.ivml.Type type)
Returns the full type definition based on the given
Type. |
private boolean |
equalNames(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
Checks whether the name of the given
VariableDeclaration equals the name of the given . |
org.eclipse.emf.ecore.EObject |
getEcoreElement(CommonXtextEditor<?,de.uni_hildesheim.sse.ivml.Project> ivmlEditor,
ModelElementTypeFinder.ModelElementDescription elementDescription)
Returns the
EObject of the parse tree of the given XtextEditor's resource that matches the element
described by the given ModelElementTypeFinder.ModelElementDescription. |
java.lang.String |
getName(de.uni_hildesheim.sse.ivml.Project project)
Returns the name of the project.
|
de.uni_hildesheim.sse.ivml.Project |
getProject(org.eclipse.xtext.nodemodel.ICompositeNode rootNode)
Returns the
Project of the Ecore-model represented by the given root node. |
protected de.uni_hildesheim.sse.ivml.Project |
getProject(org.eclipse.xtext.resource.XtextResource resource)
Returns the
Project in the given resource (IVML-file). |
private java.util.List<de.uni_hildesheim.sse.ivml.Typedef> |
getSpecificTypeDefs(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typeDefs,
ModelElementTypeFinder.ClassType specificType)
Creates a sub-list of the given list of
Typedefs in which only type definitions are included that provide
the specific type definition described by the given ModelElementTypeFinder.ClassType. |
private boolean |
isTypeDefClass(ModelElementTypeFinder.ClassType type)
Checks whether the given
ModelElementTypeFinder.ClassType describes a type definition in IVML, e.g.:
Enum
OrderedEnum
Compound
Mapping |
private boolean |
notEmpty(ModelElementTypeFinder.ModelElementDescription elementDescription)
Checks whether the given
ModelElementTypeFinder.ModelElementDescription is not null and all information
is available (the nested Strings are not null or empty). |
private org.eclipse.emf.ecore.EObject |
processCompoundElements(de.uni_hildesheim.sse.ivml.TypedefCompound compound,
ModelElementTypeFinder.ModelElementDescription elementDescription) |
private org.eclipse.emf.ecore.EObject |
processDecisionVariableDeclarations(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> varDecls,
ModelElementTypeFinder.ModelElementDescription elementDescription)
Returns an
EObject if this object is part of the given list of VariableDeclarations and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription. |
private org.eclipse.emf.ecore.EObject |
processProjectContents(de.uni_hildesheim.sse.ivml.ProjectContents projectContents,
ModelElementTypeFinder.ModelElementDescription elementDescription)
Returns an
EObject if this object is part of the given ProjectContents and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription. |
private org.eclipse.emf.ecore.EObject |
processTypeDefinitions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typeDefs,
ModelElementTypeFinder.ModelElementDescription elementDescription,
ModelElementTypeFinder.ClassType searchType)
Returns an
EObject if this object is part of the given list of Typedefs and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription. |
getRootNode, getXtextResource, notEmpty, notEmpty, notEmptypublic static final EcoreModelQuery INSTANCE
EcoreModelQuery for retrieving elements from an
Ecore-model.private EcoreModelQuery()
EcoreModelQuery.protected de.uni_hildesheim.sse.ivml.Project getProject(org.eclipse.xtext.resource.XtextResource resource)
Project in the given resource (IVML-file).resource - the XtextResource from which the Project should be retrievedProject in the given resource (IVML-file). May return null if the
given resource is null, cannot be parsed, or there is no Project in that filepublic de.uni_hildesheim.sse.ivml.Project getProject(org.eclipse.xtext.nodemodel.ICompositeNode rootNode)
Project of the Ecore-model represented by the given root node.rootNode - the ICompositeNode which is the root of the Ecore-model from which the
Project should be retrievedProject in the given resource (IVML-file). May return null if the
given root node is null, or there is no Project in that filepublic org.eclipse.emf.ecore.EObject getEcoreElement(CommonXtextEditor<?,de.uni_hildesheim.sse.ivml.Project> ivmlEditor, ModelElementTypeFinder.ModelElementDescription elementDescription)
EObject of the parse tree of the given XtextEditor's resource that matches the element
described by the given ModelElementTypeFinder.ModelElementDescription.
The search for this object will be performed in the Ecore-model of the given IVML-editor's resource only. This
requires that it is ensured that the given editor displays an IVML-file which includes the desired element.ivmlEditor - the XtextEditor which displays the IVML-file in which the desired element should
be foundelementDescription - the ModelElementTypeFinder.ModelElementDescription that describes the VarModel element that should
be found in the parse tree of the given editor's resourceEObject that matches the element described by the given ModelElementTypeFinder.ModelElementDescription. May
return null if the element could not be foundprivate org.eclipse.emf.ecore.EObject processProjectContents(de.uni_hildesheim.sse.ivml.ProjectContents projectContents,
ModelElementTypeFinder.ModelElementDescription elementDescription)
EObject if this object is part of the given ProjectContents and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription.projectContents - the ProjectContents in which to search for the element described by
the given ModelElementTypeFinder.ModelElementDescriptionelementDescription - the ModelElementTypeFinder.ModelElementDescription that describes the EObject to be
found in the ProjectContentsEObject if this object is part of the given projects ProjectContents and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription; null otherwise.private org.eclipse.emf.ecore.EObject processDecisionVariableDeclarations(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> varDecls,
ModelElementTypeFinder.ModelElementDescription elementDescription)
EObject if this object is part of the given list of VariableDeclarations and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription.varDecls - the list of VariableDeclarations in which to search for the element described by
the given ModelElementTypeFinder.ModelElementDescriptionelementDescription - the ModelElementTypeFinder.ModelElementDescription that describes the EObject to be
found in the list of VariableDeclarationsEObject if this object is part of the given list of VariableDeclarations and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription; null otherwise.private boolean compareByBasicType(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration. This is
done by checking the basic type and the name of the VariableDeclaration against the type and the name defined
in the ModelElementTypeFinder.ModelElementDescription.varDecl - the VariableDeclaration that is checked against the ModelElementTypeFinder.ModelElementDescription by type and
nameelementDescription - the ModelElementTypeFinder.ModelElementDescription that is checked against the VariableDeclaration
by type and nametrue if the given ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration.
False otherwise.private boolean compareByQualifiedName(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration. This is
done by checking the qualified name of the VariableDeclaration against the type defined in the ModelElementTypeFinder.ModelElementDescription
and by checking the name of the VariableDeclaration against the name defined in the ModelElementTypeFinder.ModelElementDescription.varDecl - the VariableDeclaration that is checked against the ModelElementTypeFinder.ModelElementDescription by qualified name (type) and
nameelementDescription - the ModelElementTypeFinder.ModelElementDescription that is checked against the VariableDeclaration
by qualified name (type) and nametrue if the given ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration.
False otherwise.private boolean compareByDerivedType(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration. This is
done by re-constructing the full type definition under the assumption that the given VariableDeclaration is constructed by
a combination of (derived) types, e.g. sequenceOf(refBy(MyInteger)). This re-constructed type is than checked against the
type of the given ModelElementTypeFinder.ModelElementDescription. If this type is equal and the name of the VariableDeclaration and in the
ModelElementTypeFinder.ModelElementDescription are equal, both elements describe the same model element.varDecl - the VariableDeclaration that is checked against the ModelElementTypeFinder.ModelElementDescription by type and nameelementDescription - the ModelElementTypeFinder.ModelElementDescription that is checked against the VariableDeclaration
by type and nametrue if the given ModelElementTypeFinder.ModelElementDescription describes the given VariableDeclaration.
False otherwise.private java.lang.String constructFullTypeDefinition(de.uni_hildesheim.sse.ivml.Type type)
Type.
This leads to re-construction of combined types like sequenceOf(refBy(MyInteger)).type - the Type from where to start re-constructing the full type definition by recursively checking
the sub-types (any valid combination of derived types, qualified names, and basic types).String. May return an empty String the given type is null.private boolean equalNames(de.uni_hildesheim.sse.ivml.VariableDeclaration varDecl,
ModelElementTypeFinder.ModelElementDescription elementDescription)
VariableDeclaration equals the name of the given .
This is done by iterating over all variable declaration parts of the VariableDeclaration and checking whether one of
these parts match the name of the .varDecl - the VariableDeclaration of which all variable declaration parts are checked against the name defined
by the given elementDescription - the ModelElementTypeFinder.ModelElementDescription which name is checked against all variable declaration parts
of the given VariableDeclarationtrue if the name defined in the given ModelElementTypeFinder.ModelElementDescription matches one variable declaration
part of the given VariableDeclaration. False otherwise.private org.eclipse.emf.ecore.EObject processTypeDefinitions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typeDefs,
ModelElementTypeFinder.ModelElementDescription elementDescription,
ModelElementTypeFinder.ClassType searchType)
EObject if this object is part of the given list of Typedefs and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription.
This method compares a filtered subset of the given list of Typedef. Which specific type of
Typedef will be used depends on the given ModelElementTypeFinder.ClassType searchType.
Currently supported types are: Compound, Enum (which will also include OrderedEnum,
and Mapping.
Note that this kind of comparison requires to ensure that the given ModelElementTypeFinder.ModelElementDescription describes
a Typedef.typeDefs - the full list of Typedefs in which to search for the element described by the given
ModelElementTypeFinder.ModelElementDescription. Filtering this full list will be done by this method in accordance to the
type defined by searchTypeelementDescription - the ModelElementTypeFinder.ModelElementDescription that describes the element for which the
EObject should be found in the list of TypedefssearchType - the specific type of Typedef to look for: one of ModelElementTypeFinder.ClassTypeEObject if this object is part of the given list of Typedefs and
matches the element described by the given ModelElementTypeFinder.ModelElementDescription
null otherwise.private org.eclipse.emf.ecore.EObject processCompoundElements(de.uni_hildesheim.sse.ivml.TypedefCompound compound,
ModelElementTypeFinder.ModelElementDescription elementDescription)
private boolean isTypeDefClass(ModelElementTypeFinder.ClassType type)
ModelElementTypeFinder.ClassType describes a type definition in IVML, e.g.:
Enum
OrderedEnum
Compound
Mappingtype - the ModelElementTypeFinder.ClassType to check whether this is a class used in IVML to define
a new typetrue if the given ModelElementTypeFinder.ClassType matches one of the types listed above.
False otherwise.private java.util.List<de.uni_hildesheim.sse.ivml.Typedef> getSpecificTypeDefs(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typeDefs,
ModelElementTypeFinder.ClassType specificType)
Typedefs in which only type definitions are included that provide
the specific type definition described by the given ModelElementTypeFinder.ClassType.typeDefs - the list of Typedefs from which a subset of specific type definitions should be returnedspecificType - the specific type of Typedefs to be included in a new list.Typedefs in which only type definitions are included that provide
the specific type definition described by the given ModelElementTypeFinder.ClassType. May return null if the given list
of type definitions is null or empty. May return an empty list if the given list does not contain
type definitions of the desired specific type.private boolean notEmpty(ModelElementTypeFinder.ModelElementDescription elementDescription)
ModelElementTypeFinder.ModelElementDescription is not null and all information
is available (the nested Strings are not null or empty).elementDescription - the ModelElementTypeFinder.ModelElementDescription to checktrue if the given ModelElementTypeFinder.ModelElementDescription is not null and all information
is available. False otherwise.public java.lang.String getName(de.uni_hildesheim.sse.ivml.Project project)
IEcoreModelQueryproject - the projectprojectCopyright © 2009 - 2018 SSE. All Rights Reserved.