Class ModelTranslator
- java.lang.Object
-
- net.ssehub.easy.dslCore.translation.MessageReceiver
-
- net.ssehub.easy.dslCore.translation.ModelTranslator<ExpressionTranslator>
-
- de.uni_hildesheim.sse.translation.ModelTranslator
-
- All Implemented Interfaces:
IMessageReceiver
public class ModelTranslator extends ModelTranslator<ExpressionTranslator>
Implements a ECore-to-IVML translator. Please note that errors which occur during translation are not signalled as individual exceptions but collected and accessible throughModelTranslator.getMessage(int).- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classModelTranslator.EvalBlockResultTemporary result of evalu block processing.static classModelTranslator.ResultImplements a translation result enabling deferred model loading.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<de.uni_hildesheim.sse.ivml.AttrAssignment,AttributeAssignment>assignmentMappingprivate java.util.Map<de.uni_hildesheim.sse.ivml.TypedefCompound,Compound>compoundMappingprivate java.util.Set<org.eclipse.emf.ecore.EObject>definitionsProcessedprivate DerivedTypeMetaCompoundAccessVisitorderivedTypeVisitorprivate ExpressionTranslatorexpressionTranslatorContains an expression translator instance.private IModelProcessingListener<Project>onLoadMsgCleanupListenerprivate java.util.Map<de.uni_hildesheim.sse.ivml.TypedefMapping,DerivedDatatype>typedefMappingprivate java.util.Map<de.uni_hildesheim.sse.ivml.VariableDeclarationPart,DecisionVariableDeclaration>varMapping
-
Constructor Summary
Constructors Constructor Description ModelTranslator()Creates a model translator instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidalreadyDefinedError(java.lang.String name, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature)Emits an already defined error.private voidassignComments(StructuredComment target, java.util.List<?> elements, java.util.List<Comment> comments, IModelElement parent)Assigns the comments incommentsto the corresponding model elements inelements.private voidassignProjectComment(Project project, java.lang.Object element, Comment comment)Assigns acommentto anelementdirectly assigned to aprojectand ensures the existence the structured comment for the project if required.private booleanattributeAssignmentsResolvable(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> attrAssignments, TypeContext context, IDecisionVariableContainer parent, boolean force)Returns whether the assignments inattrAssignmentscan be resolved in the givencontextand the given parentcontainer.private voidcheckCompound(de.uni_hildesheim.sse.ivml.Project eProject, Compound cmp, java.util.Map<Compound,de.uni_hildesheim.sse.ivml.TypedefCompound> cmpMapping, java.util.Map<java.lang.String,DecisionVariableDeclaration> done)Checks the given compound.private voidcheckCompounds(de.uni_hildesheim.sse.ivml.Project eProject, Project project)Checks the compounds in this project.private voidcheckDefaultParamSequence(de.uni_hildesheim.sse.ivml.OpDefStatement op, DecisionVariableDeclaration[] param)Checks the sequence of default and non-default parameters.(package private) voidcompleteLoading(ResultEntry entry)Complete loading of a given model.ModelTranslator.ResultcreateEmptyResult()Creates an empty result for failure cases.ModelTranslator.ResultcreateModel(de.uni_hildesheim.sse.ivml.VariabilityUnit unit, java.net.URI uri, boolean registerSuccessful, ImportResolver<Project> impResolver)Creates a variability model from a given variability unit.private ResultEntrycreateProject(de.uni_hildesheim.sse.ivml.Project project, java.net.URI uri, boolean registerSuccessful, java.util.List<de.uni_hildesheim.sse.ivml.Project> inProgress, ImportResolver<Project> impResolver)Creates a variability model from a given ECore representation of a project.private StructuredCommentcreateStructuredComment(org.eclipse.emf.ecore.EObject object, TypeContext context, java.util.List<Comment> comments)Creates a structured comment for the givenobjectincontextdepending on the contents ofcomments, i.e.(package private) voiderror(IIdentifiable exception, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature)Turns an IVML exception into a xText error.private booleanfindOperation(IDatatype datatype, Operation operation, boolean considerOperand)Finds an operation on a given datatype.private CommenthandleBasicComment(org.eclipse.emf.ecore.EObject object, TypeContext context)Handles the comments assigned to the EMF AST elementobject.protected voidprocessAnnotation(de.uni_hildesheim.sse.ivml.AnnotateTo annotation, TypeContext context)Processes an annotation.protected AttributeprocessAnnotation(de.uni_hildesheim.sse.ivml.AnnotateTo annotation, java.lang.String name, TypeContext context, Attribute initial)Processes the annotation ofname.private booleanprocessAttributeAssignment(de.uni_hildesheim.sse.ivml.AttrAssignment assgn, TypeContext context, IDecisionVariableContainer parent, boolean process, boolean force)Processes an attribute assignment.private voidprocessAttributeAssignmentExpressions(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, TypeContext context)Processes all the expressions of attribute assignments.private voidprocessAttributeAssignments(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, TypeContext context, boolean force)Resolves attribute assignments.private booleanprocessCompound(de.uni_hildesheim.sse.ivml.TypedefCompound tcomp, TypeContext context, boolean force)Processes a compound definition.protected voidprocessConflict(de.uni_hildesheim.sse.ivml.ConflictStmt conflictStmt, TypeContext context)Processes a conflict statement including import restrictions.private voidprocessDefinitions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typedefs, java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> vardecls, java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, TypeContext context, boolean force)Resolve dependencies among type definitions and resolve types in proper sequence.private voidprocessEnum(de.uni_hildesheim.sse.ivml.TypedefEnum tenum, TypeContext context)Processes an enum definition.protected voidprocessEval(de.uni_hildesheim.sse.ivml.Eval eval, TypeContext context, Compound compound)Processes an evaluation block.private ModelTranslator.EvalBlockResultprocessEval(de.uni_hildesheim.sse.ivml.Eval eval, IModelElement parent, TypeContext context)Process an eval block.private voidprocessExpressions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typedefs, java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, java.util.List<de.uni_hildesheim.sse.ivml.ExpressionStatement> exprs, TypeContext context)Processes all expressions at once and delegates to further processing methods.voidprocessExpressionStatement(de.uni_hildesheim.sse.ivml.ExpressionStatement statement, TypeContext context, IDecisionVariableContainer parent, boolean internal)Processes an expression statement and adds the result to the project incontext.protected voidprocessFreeze(de.uni_hildesheim.sse.ivml.Freeze freeze, TypeContext context)Processes a freeze block.protected voidprocessImport(de.uni_hildesheim.sse.ivml.ImportStmt importStmt, TypeContext context)Processes an import statement including import restrictions.protected voidprocessInterface(de.uni_hildesheim.sse.ivml.InterfaceDeclaration eIface, TypeContext context)Processes an interface.private booleanprocessMapping(de.uni_hildesheim.sse.ivml.TypedefMapping tmapping, TypeContext context, boolean force)Processes a typdef (type mapping).protected booleanprocessOpdef(de.uni_hildesheim.sse.ivml.OpDefStatement op, TypeContext context, boolean force)Processes a custom operation definition and adds it to the type context.private ConstraintSyntaxTreeprocessOpDefImpl(de.uni_hildesheim.sse.ivml.OpDefStatement op, TypeContext context, IModelElement parent)Processes an operation definition implementation.private voidprocessOpDefs(java.util.List<de.uni_hildesheim.sse.ivml.OpDefStatement> opDefs, TypeContext context)Resolve dependencies among operation definitions in proper sequence.private voidprocessOpDefs(java.util.List<de.uni_hildesheim.sse.ivml.OpDefStatement> opDefs, TypeContext context, boolean force)Resolves operation definitions.private voidprocessTypeDefExpressions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typedefs, TypeContext context)Processes all the expressions of type definitions.private voidprocessTypedefs(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> compounds, TypeContext context, boolean force)Resolves compound type definitions.private booleanprocessVariableDeclaration(de.uni_hildesheim.sse.ivml.VariableDeclaration decl, TypeContext context, IDecisionVariableContainer container, boolean process, boolean force)Process variable declarationdecladd IVML object model instances toprojectorcompound.private voidprocessVars(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> vars, TypeContext context, boolean force)Resolves variable declarations.private voidresolveAssignments(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> attrAssignments, TypeContext context, IDecisionVariableContainer parent, boolean force)Resolves the given assignments inattrAssignments.private voidresolveDeclarations(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> varDecls, TypeContext context, IDecisionVariableContainer parent, boolean force)Resolves the given declarations invarDecl.private voidresolveImports(de.uni_hildesheim.sse.ivml.Project input, Project project, java.net.URI uri, java.util.List<de.uni_hildesheim.sse.ivml.Project> inProgress, ImportResolver<Project> impResolver, boolean transitiveLoading)Resolve the imports.private java.lang.StringtoString(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclarationPart> parts)Turns variable declaration parts into strings for debugging.private static java.lang.Stringunqualified(IDatatype type)Returns the unqualified name oftype.private booleanvariableDeclarationsResolvable(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> varDecls, TypeContext context, IDecisionVariableContainer parent, boolean force)Returns whether the declarations invarDeclcan be resolved in the givencontextand the given parentcontainer.(package private) voidwarning(IvmlException exception, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature)Turns an IVML exception into a xText warning.-
Methods inherited from class net.ssehub.easy.dslCore.translation.ModelTranslator
collect, copy, error, error, getErrorCount, getExpressionTranslator, getMessage, getMessageCount, select, warning
-
Methods inherited from class net.ssehub.easy.dslCore.translation.MessageReceiver
error
-
-
-
-
Field Detail
-
compoundMapping
private java.util.Map<de.uni_hildesheim.sse.ivml.TypedefCompound,Compound> compoundMapping
-
assignmentMapping
private java.util.Map<de.uni_hildesheim.sse.ivml.AttrAssignment,AttributeAssignment> assignmentMapping
-
varMapping
private java.util.Map<de.uni_hildesheim.sse.ivml.VariableDeclarationPart,DecisionVariableDeclaration> varMapping
-
typedefMapping
private java.util.Map<de.uni_hildesheim.sse.ivml.TypedefMapping,DerivedDatatype> typedefMapping
-
definitionsProcessed
private java.util.Set<org.eclipse.emf.ecore.EObject> definitionsProcessed
-
derivedTypeVisitor
private DerivedTypeMetaCompoundAccessVisitor derivedTypeVisitor
-
onLoadMsgCleanupListener
private IModelProcessingListener<Project> onLoadMsgCleanupListener
-
expressionTranslator
private ExpressionTranslator expressionTranslator
Contains an expression translator instance. Expression are realized in an own class due to separation of concerns.
-
-
Method Detail
-
createModel
public ModelTranslator.Result createModel(de.uni_hildesheim.sse.ivml.VariabilityUnit unit, java.net.URI uri, boolean registerSuccessful, ImportResolver<Project> impResolver)
Creates a variability model from a given variability unit. This is the top-level entry method.- Parameters:
unit- the variability unit to be translateduri- the URI of the project to resolve (in order to find the closest project, may be null)registerSuccessful- successfully created models shall be registered inVarModelimpResolver- the import resolver (may be null to use a new default import resolver)- Returns:
- the corresponding variability model
-
createEmptyResult
public ModelTranslator.Result createEmptyResult()
Creates an empty result for failure cases.- Returns:
- an empty result
-
handleBasicComment
private Comment handleBasicComment(org.eclipse.emf.ecore.EObject object, TypeContext context)
Handles the comments assigned to the EMF AST elementobject.- Parameters:
object- the EMF AST element to analyzecontext- the parent context of the new comment in the IVML object model- Returns:
- the resulting comment (may be null)
-
assignProjectComment
private void assignProjectComment(Project project, java.lang.Object element, Comment comment)
Assigns acommentto anelementdirectly assigned to aprojectand ensures the existence the structured comment for the project if required.- Parameters:
project- the project to assign toelement- the element to assign tocomment- the comment to be assigned
-
createProject
private ResultEntry createProject(de.uni_hildesheim.sse.ivml.Project project, java.net.URI uri, boolean registerSuccessful, java.util.List<de.uni_hildesheim.sse.ivml.Project> inProgress, ImportResolver<Project> impResolver)
Creates a variability model from a given ECore representation of a project. This method is intended as a second-level entry to the translation process.- Parameters:
project- the project to be translated.uri- the URI of the project to resolve (in order to find the closest project, may be null)registerSuccessful- successfully created models shall be registered inVarModelinProgress- the projects currently being processed at onceimpResolver- the import resolver to use (may be null to use a new default import resolver)- Returns:
- the corresponding IVML project
-
checkCompounds
private void checkCompounds(de.uni_hildesheim.sse.ivml.Project eProject, Project project)Checks the compounds in this project.- Parameters:
eProject- the AST project instance to check (fallback for messages)project- the corresponding IVML project instance
-
checkCompound
private void checkCompound(de.uni_hildesheim.sse.ivml.Project eProject, Compound cmp, java.util.Map<Compound,de.uni_hildesheim.sse.ivml.TypedefCompound> cmpMapping, java.util.Map<java.lang.String,DecisionVariableDeclaration> done)Checks the given compound. Due to the dynamic resolution sequence, we perform a post-check for hierarchical compound properties.- Parameters:
eProject- the AST project instance to check (fallback for messages)cmp- the compound to checkcmpMapping- mapping between compounds and related AST objects for error identificationdone- already known/checked slot declarations
-
completeLoading
void completeLoading(ResultEntry entry)
Complete loading of a given model.- Parameters:
entry- the result entry on which to complete loading
-
resolveImports
private void resolveImports(de.uni_hildesheim.sse.ivml.Project input, Project project, java.net.URI uri, java.util.List<de.uni_hildesheim.sse.ivml.Project> inProgress, ImportResolver<Project> impResolver, boolean transitiveLoading)Resolve the imports.- Parameters:
input- the Ecore project representationproject- the target projecturi- the physical URI of the projectinProgress- the other projects being resolved at once (in order to avoid loops)impResolver- the import resolver to use (may be null to use a new default import resolver)transitiveLoading- with or without transitive loading (false = lazy, true = force)
-
processExpressionStatement
public void processExpressionStatement(de.uni_hildesheim.sse.ivml.ExpressionStatement statement, TypeContext context, IDecisionVariableContainer parent, boolean internal) throws TranslatorExceptionProcesses an expression statement and adds the result to the project incontext.- Parameters:
statement- the statement to processcontext- the type context to be consideredparent- the actual (intended) parent of the constraint to be createdinternal- whether the constraint to be created is internal (and shall not be visible to the user)- Throws:
TranslatorException- in case that the processing of thestatementwas terminated abnormally
-
processExpressions
private void processExpressions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typedefs, java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, java.util.List<de.uni_hildesheim.sse.ivml.ExpressionStatement> exprs, TypeContext context)Processes all expressions at once and delegates to further processing methods.- Parameters:
typedefs- the type definitions for which expressions shall be resolvedassignments- the attribute assignments for which expressions shall be resolvedexprs- the expressions to be resolvedcontext- the type resolution context- See Also:
processAttributeAssignmentExpressions(List, TypeContext),processTypeDefExpressions(List, TypeContext)
-
processTypeDefExpressions
private void processTypeDefExpressions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typedefs, TypeContext context)Processes all the expressions of type definitions.- Parameters:
typedefs- the type definitions for which expressions shall be resolvedcontext- the type resolution context- See Also:
processExpressions(List, List, List, TypeContext)
-
processAttributeAssignmentExpressions
private void processAttributeAssignmentExpressions(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, TypeContext context)Processes all the expressions of attribute assignments.- Parameters:
assignments- the attribute assignments for which expressions shall be resolvedcontext- the type resolution context- See Also:
processExpressions(List, List, List, TypeContext)
-
processDefinitions
private void processDefinitions(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> typedefs, java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> vardecls, java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, TypeContext context, boolean force)Resolve dependencies among type definitions and resolve types in proper sequence.- Parameters:
typedefs- the type definitionsvardecls- the variable declarationsassignments- the assignmentscontext- the type resolution contextforce- if creation (and related errors) shall be forced or just tested and created on best-effort
-
processOpDefs
private void processOpDefs(java.util.List<de.uni_hildesheim.sse.ivml.OpDefStatement> opDefs, TypeContext context)Resolve dependencies among operation definitions in proper sequence.- Parameters:
opDefs- the operation definitionscontext- the type resolution context
-
processOpDefs
private void processOpDefs(java.util.List<de.uni_hildesheim.sse.ivml.OpDefStatement> opDefs, TypeContext context, boolean force)Resolves operation definitions.- Parameters:
opDefs- the operation definitions to be resolved (to be modified as a side effect)context- the type contextforce- if creation (and related errors) shall be forced or just tested
-
processTypedefs
private void processTypedefs(java.util.List<de.uni_hildesheim.sse.ivml.Typedef> compounds, TypeContext context, boolean force)Resolves compound type definitions.- Parameters:
compounds- the compounds to be resolved (to be modified as a side effect)context- the type contextforce- if creation (and related errors) shall be forced or just tested
-
processVars
private void processVars(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> vars, TypeContext context, boolean force)Resolves variable declarations.- Parameters:
vars- the variables types to be resolved (to be modified as a side effect)context- the type contextforce- if creation (and related errors) shall be forced
-
processAttributeAssignments
private void processAttributeAssignments(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> assignments, TypeContext context, boolean force)Resolves attribute assignments.- Parameters:
assignments- the attribute assignments to be resolved (to be modified as a side effect)context- the type contextforce- if creation (and related errors) shall be forced
-
toString
private java.lang.String toString(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclarationPart> parts)
Turns variable declaration parts into strings for debugging.- Parameters:
parts- the parts- Returns:
- the names
-
processVariableDeclaration
private boolean processVariableDeclaration(de.uni_hildesheim.sse.ivml.VariableDeclaration decl, TypeContext context, IDecisionVariableContainer container, boolean process, boolean force) throws TranslatorExceptionProcess variable declarationdecladd IVML object model instances toprojectorcompound.- Parameters:
decl- the variable declarations in the projectcontext- the resolution contextcontainer- optional element to add the instances to instead ofprojectprocess-falseif the declaration shall not be created but only tested first,trueif creation should be done in case that the variable declaration can be processedforce- process anyway, don't test- Returns:
trueif the base type is yet available and the remaining type resolution was done,falseif this typedef can actually not be processed- Throws:
TranslatorException- in case of any problem during the translation
-
alreadyDefinedError
private void alreadyDefinedError(java.lang.String name, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature) throws TranslatorExceptionEmits an already defined error.- Parameters:
name- the already defined nameobject- the causing Ecore objectfeature- the causing feature- Throws:
TranslatorException- the corresponding exception always
-
processOpdef
protected boolean processOpdef(de.uni_hildesheim.sse.ivml.OpDefStatement op, TypeContext context, boolean force) throws TranslatorExceptionProcesses a custom operation definition and adds it to the type context.- Parameters:
op- the operation definitioncontext- the type context to be consideredforce- if creation (and related errors) shall be forced or just tested- Returns:
trueif processing was successful,falseif (typically) a function is called which is currently not defined.- Throws:
TranslatorException- in case that the processing of thestatementmust be terminated abnormally
-
unqualified
private static java.lang.String unqualified(IDatatype type)
Returns the unqualified name oftype.- Parameters:
type- the type- Returns:
- the unqualified name
-
checkDefaultParamSequence
private void checkDefaultParamSequence(de.uni_hildesheim.sse.ivml.OpDefStatement op, DecisionVariableDeclaration[] param)Checks the sequence of default and non-default parameters.- Parameters:
op- the operation declarationparam- the parameters to check
-
processOpDefImpl
private ConstraintSyntaxTree processOpDefImpl(de.uni_hildesheim.sse.ivml.OpDefStatement op, TypeContext context, IModelElement parent) throws TranslatorException
Processes an operation definition implementation.- Parameters:
op- the operation definitioncontext- the type contextparent- the parent model element- Returns:
- the implementing constraint syntax tree
- Throws:
TranslatorException- in case that the processing of theopmust be terminated abnormally
-
processInterface
protected void processInterface(de.uni_hildesheim.sse.ivml.InterfaceDeclaration eIface, TypeContext context)Processes an interface. In case of success, the interface will be added to the project incontext.- Parameters:
eIface- the interface to be processedcontext- the type context to be considered
-
processAnnotation
protected void processAnnotation(de.uni_hildesheim.sse.ivml.AnnotateTo annotation, TypeContext context)Processes an annotation. In case of success, the annotation will be applied.- Parameters:
annotation- the interface to be processedcontext- the type context to be considered
-
processAnnotation
protected Attribute processAnnotation(de.uni_hildesheim.sse.ivml.AnnotateTo annotation, java.lang.String name, TypeContext context, Attribute initial)
Processes the annotation ofname. In case of success, the annotation will be applied.- Parameters:
annotation- the annotation to be processedname- the name of the annotated elementcontext- the type context to be consideredinitial- the initial attribute created in series- Returns:
- the created attribute or null
-
findOperation
private boolean findOperation(IDatatype datatype, Operation operation, boolean considerOperand)
Finds an operation on a given datatype.- Parameters:
datatype- the datatype to search foroperation- the operation to be searched forconsiderOperand- whether the operand of the operations defined indatatypeshould be considered as first parameter ofoperation, used to match the implicit project parameter for ambigous operation checking- Returns:
trueif the operation was found,falseelse
-
processEnum
private void processEnum(de.uni_hildesheim.sse.ivml.TypedefEnum tenum, TypeContext context) throws TranslatorExceptionProcesses an enum definition.- Parameters:
tenum- the type definition for the enumcontext- the type context to be considered- Throws:
TranslatorException- in case that the processing of thestatementmust be terminated abnormally
-
processCompound
private boolean processCompound(de.uni_hildesheim.sse.ivml.TypedefCompound tcomp, TypeContext context, boolean force) throws TranslatorExceptionProcesses a compound definition.- Parameters:
tcomp- the type definition for the compoundcontext- the type context to be consideredforce- creation, don't check before- Returns:
trueif the base type is yet available and the remaining type resolution was done,falseif this typedef can actually not be processed- Throws:
TranslatorException- in case that the processing of thetcompmust be terminated abnormally due to type problems
-
processAttributeAssignment
private boolean processAttributeAssignment(de.uni_hildesheim.sse.ivml.AttrAssignment assgn, TypeContext context, IDecisionVariableContainer parent, boolean process, boolean force) throws TranslatorExceptionProcesses an attribute assignment.- Parameters:
assgn- the attribute assignmentcontext- the type context to be consideredparent- the parent containerprocess- the assignment or do only type resolutionforce- creation, don't check before- Returns:
trueif the base types is yet available and the remaining type resolution was done,falseif this assignment can actually not be processed- Throws:
TranslatorException- in case that the processing of theassgnmust be terminated abnormally due to type problems
-
variableDeclarationsResolvable
private boolean variableDeclarationsResolvable(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> varDecls, TypeContext context, IDecisionVariableContainer parent, boolean force) throws TranslatorExceptionReturns whether the declarations invarDeclcan be resolved in the givencontextand the given parentcontainer.- Parameters:
varDecls- the variable declarations to be resolvedcontext- the type contextparent- the parent thevarDeclsshall be inserted intoforce- creation, don't check before- Returns:
trueif the declarations are resolvable,falseelse- Throws:
TranslatorException- in case of type problems, resolution problems or type incompatibilities
-
attributeAssignmentsResolvable
private boolean attributeAssignmentsResolvable(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> attrAssignments, TypeContext context, IDecisionVariableContainer parent, boolean force) throws TranslatorExceptionReturns whether the assignments inattrAssignmentscan be resolved in the givencontextand the given parentcontainer.- Parameters:
attrAssignments- the assignments to be resolvedcontext- the type contextparent- the parent thevarDeclsshall be inserted intoforce- creation, don't check before- Returns:
trueif the declarations are resolvable,falseelse- Throws:
TranslatorException- in case of type problems, resolution problems or type incompatibilities
-
resolveDeclarations
private void resolveDeclarations(java.util.List<de.uni_hildesheim.sse.ivml.VariableDeclaration> varDecls, TypeContext context, IDecisionVariableContainer parent, boolean force) throws TranslatorExceptionResolves the given declarations invarDecl.- Parameters:
varDecls- the variable declarations to be resolvedcontext- the type contextparent- the parent thevarDeclsshall be inserted intoforce- creation, don't check before- Throws:
TranslatorException- in case of type problems, resolution problems or type incompatibilities
-
resolveAssignments
private void resolveAssignments(java.util.List<de.uni_hildesheim.sse.ivml.AttrAssignment> attrAssignments, TypeContext context, IDecisionVariableContainer parent, boolean force) throws TranslatorExceptionResolves the given assignments inattrAssignments.- Parameters:
attrAssignments- the assignments to be resolvedcontext- the type contextparent- the parent theattrAssignmentsshall be inserted intoforce- creation, don't check before- Throws:
TranslatorException- in case of type problems, resolution problems or type incompatibilities
-
processMapping
private boolean processMapping(de.uni_hildesheim.sse.ivml.TypedefMapping tmapping, TypeContext context, boolean force) throws TranslatorExceptionProcesses a typdef (type mapping).- Parameters:
tmapping- the type mapping definitioncontext- the type context to be consideredforce- if creation (and related errors) shall be forced or just tested- Returns:
trueif the base type is yet available and the remaining type resolution was done,falseif this typedef can actually not be processed- Throws:
TranslatorException- in case that the processing of thestatementmust be terminated abnormally
-
processEval
protected void processEval(de.uni_hildesheim.sse.ivml.Eval eval, TypeContext context, Compound compound)Processes an evaluation block. In case of errors the respective element is not added to the resulting project.- Parameters:
eval- the evaluation blockcontext- the context for type resolutioncompound- optional compound to add the eval block to, null for adding it to the actual project incontext
-
processEval
private ModelTranslator.EvalBlockResult processEval(de.uni_hildesheim.sse.ivml.Eval eval, IModelElement parent, TypeContext context)
Process an eval block.- Parameters:
eval- the evaluation blockparent- the parent elementcontext- the context for type resolution- Returns:
- result of processing an eval block
-
processFreeze
protected void processFreeze(de.uni_hildesheim.sse.ivml.Freeze freeze, TypeContext context)Processes a freeze block. In case of errors the respective element is not added to the resulting project.- Parameters:
freeze- the freeze blockcontext- the type context to be considered
-
createStructuredComment
private StructuredComment createStructuredComment(org.eclipse.emf.ecore.EObject object, TypeContext context, java.util.List<Comment> comments)
Creates a structured comment for the givenobjectincontextdepending on the contents ofcomments, i.e. whether there are comments or not.- Parameters:
object- the EObject to create the comment forcontext- the type context to assign the created context tocomments- the comments to consider- Returns:
- the created comment object or null
-
assignComments
private void assignComments(StructuredComment target, java.util.List<?> elements, java.util.List<Comment> comments, IModelElement parent)
Assigns the comments incommentsto the corresponding model elements inelements.- Parameters:
target- the structured comment to store the mapping inelements- the elements to be assigned to the commentscomments- the comments (must be of same size)parent- the explicit parent element of the comments
-
processImport
protected void processImport(de.uni_hildesheim.sse.ivml.ImportStmt importStmt, TypeContext context)Processes an import statement including import restrictions. In case of errors the respective element is not added to the resulting project.- Parameters:
importStmt- the import statementcontext- the type context to be considered
-
processConflict
protected void processConflict(de.uni_hildesheim.sse.ivml.ConflictStmt conflictStmt, TypeContext context)Processes a conflict statement including import restrictions. In case of errors the respective element is not added to the resulting project.- Parameters:
conflictStmt- the conflict statementcontext- the type context to be considered
-
error
void error(IIdentifiable exception, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature)
Turns an IVML exception into a xText error.- Parameters:
exception- the exception to usedcause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literals
-
warning
void warning(IvmlException exception, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature)
Turns an IVML exception into a xText warning.- Parameters:
exception- the exception to usedcause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literals
-
-