I - the variable declaration typeR - the resolver typeE - the expression translator typepublic abstract class ModelTranslator<M extends IModel,I extends VariableDeclaration,R extends Resolver<I>,S extends ExpressionStatement,E extends ExpressionTranslator<I,R,S>> extends ModelTranslator<E>
| Constructor and Description |
|---|
ModelTranslator(E expressionTranslator,
R resolver)
Creates a new model translator.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addImportedVariablesToResolver(M model,
boolean addModel,
java.util.Set<M> done)
Adds (transitively) imported variables to the actual resolver.
|
protected abstract void |
addVisibleDeclarationsToResolver(M model,
R resolver)
Adds visible declarations of
model to resolver. |
private void |
buildLocalTypeRegistry(Advice advice)
Builds a local type registry for
advice. |
static Version |
convert(de.uni_hildesheim.sse.vil.expressions.expressionDsl.VersionStmt versionStatement)
Converts a grammar version statement into a model version object.
|
protected abstract I[] |
createArray(int len)
Creates an array of .
|
protected abstract Compound |
createCompound(CompoundTypeDescriptor type)
Creates a compound object.
|
protected abstract Typedef |
createTypedef(java.lang.String name,
TypeDescriptor<?> type)
Creates a typdef object.
|
protected ModelImport<M> |
getExtensionImport(java.lang.String name,
Imports<M> imports,
org.eclipse.emf.ecore.EObject cause,
org.eclipse.emf.ecore.EStructuralFeature causingFeature)
Returns an extension import (super script, super template).
|
protected abstract ModelManagement<M> |
getManagementInstance()
Returns the management instance.
|
protected R |
getResolver()
Returns the resolver instance.
|
protected java.util.List<IMessage> |
postResolveImports(M model,
java.net.URI uri,
java.util.List<IMessage> resolutionMessages)
Is called in case of resolution problems.
|
protected Advice[] |
processAdvices(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Advice> advices,
java.net.URI modelURI)
Processes the advices (of a script).
|
protected void |
processCompoundContents(java.util.List<org.eclipse.emf.ecore.EObject> elts,
ICompoundReceiver receiver)
Processes the compounds in
elts. |
protected void |
processCompounds(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Compound> cmps,
ICompoundReceiver receiver)
Processes the given compounds.
|
private void |
processCompounds(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Compound> cmps,
ICompoundReceiver receiver,
boolean force)
Processes the given typedefs.
|
protected Imports<M> |
processImports(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Import> imports)
Processes the imports and returns an summarizing instance.
|
protected void |
processTypedefContents(java.util.List<org.eclipse.emf.ecore.EObject> elts,
ITypedefReceiver receiver)
Processes the typedefs in
elts. |
protected void |
processTypedefs(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.TypeDef> defs,
ITypedefReceiver receiver)
Processes the given typedefs.
|
private void |
processTypedefs(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.TypeDef> defs,
ITypedefReceiver receiver,
boolean force)
Processes the given typedefs.
|
protected void |
processVariableDeclarations(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> decls,
IVariableDeclarationReceiver<I> receiver)
Processes all variable declarations considering dependencies and terminates with
an error if not all can be resolved.
|
protected void |
processVariableDeclarations(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> decls,
IVariableDeclarationReceiver<I> receiver,
boolean addToResolver)
Processes all variable declarations considering dependencies and terminates with
an error if not all can be resolved.
|
private void |
processVariableDeclarations(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> decls,
IVariableDeclarationReceiver<I> receiver,
boolean force,
boolean addToResolver)
Processes a set of variable declarations and adds successfully processed
ones to the current resolver level.
|
protected void |
resolveImports(de.uni_hildesheim.sse.vil.expressions.expressionDsl.LanguageUnit input,
org.eclipse.emf.ecore.EStructuralFeature inputFeature,
M model,
java.net.URI uri,
java.util.List<? extends de.uni_hildesheim.sse.vil.expressions.expressionDsl.LanguageUnit> inProgress,
ImportResolver<M> impResolver)
Resolves the imports.
|
protected I[] |
resolveParameters(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Parameter> parameters,
org.eclipse.emf.ecore.EObject cause,
org.eclipse.emf.ecore.EStructuralFeature paramListFeature,
R resolver)
Resolves the parameters in
parameters. |
protected I[] |
resolveParameters(de.uni_hildesheim.sse.vil.expressions.expressionDsl.ParameterList pList,
org.eclipse.emf.ecore.EObject cause,
org.eclipse.emf.ecore.EStructuralFeature paramListFeature,
R resolver)
Resolves the parameters in
pList. |
protected void |
warnVersionRestrictions(de.uni_hildesheim.sse.vil.expressions.expressionDsl.VersionSpec spec)
Issues implementation warnings about version restrictions.
|
collect, copy, error, error, getErrorCount, getExpressionTranslator, getMessage, getMessageCount, select, warningerrorprotected R getResolver()
protected Imports<M> processImports(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Import> imports) throws TranslatorException
imports - the imports to be processedTranslatorException - in case that processing the imports failsprotected ModelImport<M> getExtensionImport(java.lang.String name, Imports<M> imports, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causingFeature) throws TranslatorException
name - the name of the modelimports - the known importscause - the causing ECore element (in case of throwing an exception)causingFeature - the causing feature (in case of throwing an exception)TranslatorException - in case that the import cannot be foundprotected void processTypedefContents(java.util.List<org.eclipse.emf.ecore.EObject> elts,
ITypedefReceiver receiver)
elts.elts - the elementsreceiver - the typedef receiverprotected void processCompoundContents(java.util.List<org.eclipse.emf.ecore.EObject> elts,
ICompoundReceiver receiver)
elts.elts - the elementsreceiver - the compound receiverprotected void processTypedefs(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.TypeDef> defs,
ITypedefReceiver receiver)
defs - the typedefsreceiver - the typedef receiverprotected void processCompounds(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Compound> cmps,
ICompoundReceiver receiver)
defs - the compoundsreceiver - the compozbd receiverprivate void processTypedefs(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.TypeDef> defs,
ITypedefReceiver receiver,
boolean force)
defs - the typedefsreceiver - the typedef receiverforce - force processing typedefs not resolved so farprivate void processCompounds(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Compound> cmps,
ICompoundReceiver receiver,
boolean force)
defs - the typedefsreceiver - the typedef receiverforce - force processing typedefs not resolved so farprotected abstract Typedef createTypedef(java.lang.String name, TypeDescriptor<?> type) throws VilException
name - the name of the typdef/aliastype - the the typeVilExceptionprotected abstract Compound createCompound(CompoundTypeDescriptor type) throws VilException
type - the the compound typeVilExceptionprotected void processVariableDeclarations(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> decls,
IVariableDeclarationReceiver<I> receiver)
decls - the declarations to be processedreceiver - a receiver for the created instancesprotected void processVariableDeclarations(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> decls,
IVariableDeclarationReceiver<I> receiver,
boolean addToResolver)
decls - the declarations to be processedreceiver - a receiver for the created instancesaddToResolver - add the newly created variables to the resolver instanceprivate void processVariableDeclarations(java.util.List<de.uni_hildesheim.sse.vil.expressions.expressionDsl.VariableDeclaration> decls,
IVariableDeclarationReceiver<I> receiver,
boolean force,
boolean addToResolver)
decls - the declarations to be processed (successfully processed declarations will be removed, may be
modified as a side effect)receiver - a receiver for the created instancesforce - if true a failing variable creation will be recorded as an error,
false failing creations will be ignoredaddToResolver - add the newly created variable to the resolver instanceprotected Advice[] processAdvices(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Advice> advices, java.net.URI modelURI)
advices - the advices to be processedmodelURI - the URI to the model being processedprivate void buildLocalTypeRegistry(Advice advice)
advice.advice - the advice to build the local type registry forprotected void warnVersionRestrictions(de.uni_hildesheim.sse.vil.expressions.expressionDsl.VersionSpec spec)
spec - the version specification (may be null)protected I[] resolveParameters(de.uni_hildesheim.sse.vil.expressions.expressionDsl.ParameterList pList, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature paramListFeature, R resolver) throws TranslatorException
pList.pList - the parameter list to be resolvedcause - the causing object containing the parametersparamListFeature - the param list feature on causeresolver - the resolver instancepList in case of name or type failuresTranslatorException - in case that a problem occurredprotected I[] resolveParameters(org.eclipse.emf.common.util.EList<de.uni_hildesheim.sse.vil.expressions.expressionDsl.Parameter> parameters, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature paramListFeature, R resolver) throws TranslatorException
parameters.parameters - the parameters to be resolvedcause - the causing object containing the parametersparamListFeature - the param list feature on causeresolver - the resolver instancepList in case of name or type failuresTranslatorException - in case that a problem occurredprotected abstract I[] createArray(int len)
len - the length of the arraypublic static Version convert(de.uni_hildesheim.sse.vil.expressions.expressionDsl.VersionStmt versionStatement)
versionStatement - the version statement to be convertsprotected abstract ModelManagement<M> getManagementInstance()
protected void resolveImports(de.uni_hildesheim.sse.vil.expressions.expressionDsl.LanguageUnit input,
org.eclipse.emf.ecore.EStructuralFeature inputFeature,
M model,
java.net.URI uri,
java.util.List<? extends de.uni_hildesheim.sse.vil.expressions.expressionDsl.LanguageUnit> inProgress,
ImportResolver<M> impResolver)
input - the input language elementinputFeature - the EMF feature this resolution happens onmodel - the model being createduri - the physical URI of the projectinProgress - the other projects being resolved at once (in order to avoid loops)private void addImportedVariablesToResolver(M model, boolean addModel, java.util.Set<M> done)
model - the model to consideraddModel - whether the variables of model shall be added (true)
or whether only its imports shall be traverseddone - collects models that are already processedaddVisibleDeclarationsToResolver(IModel, Resolver)protected abstract void addVisibleDeclarationsToResolver(M model, R resolver)
model to resolver. This method
shall not consider imports as it is called by addImportedVariablesToResolver(IModel, boolean, Set).model - the model to considerresolver - the resolver to add variables toprotected java.util.List<IMessage> postResolveImports(M model, java.net.URI uri, java.util.List<IMessage> resolutionMessages)
model - the model to be resolveduri - the physical URI of the projectresolutionMessages - the messages collected so farCopyright © 2009 - 2018 SSE. All Rights Reserved.