public class ModelReferenceHelper extends Object
AntlrModelResolver.
The job of the class is to navigate the model and resolve name strings to attributes or model elements.
| Constructor and Description |
|---|
ModelReferenceHelper() |
| Modifier and Type | Method and Description |
|---|---|
static IModelElement |
getModelElement(String elementName,
ModelReferenceImpl ref,
IModelCollection models,
List<NRLError> errors)
Look up a model element by name, handling both absolute and qualified names.
|
protected static void |
raiseError(List<NRLError> errors,
ModelReferenceImpl ref,
int statusCode,
String message)
Helper method to raise errors on model references more efficiently.
|
static void |
resolveReference(ModelReferenceImpl ref,
IModelCollection models,
IModelElement contextElement,
IClassifier initialContext,
VariableContext variableContext,
Map<String,IVariableDeclaration> globalVariableContext,
List<NRLError> errors)
Resolve a reference by looking up the initial step and traversing a path.
|
public static void resolveReference(ModelReferenceImpl ref, IModelCollection models, IModelElement contextElement, IClassifier initialContext, VariableContext variableContext, Map<String,IVariableDeclaration> globalVariableContext, List<NRLError> errors)
This implements a fall-back algorithm to find the initial step of the path and then resolve all further steps.
null and the
reference remains invalid.ref - the reference to resolvemodels - the models to look up elements incontextElement - the "current" (nearest enclosing) context elementinitialContext - the overall rule/fragment contextvariableContext - a stack of IVariable objects, with variable declarations in
scopeerrors - a collection of semantic errors to add to if necessarypublic static IModelElement getModelElement(String elementName, ModelReferenceImpl ref, IModelCollection models, List<NRLError> errors)
elementName - the element nameref - the reference in which the name occurredmodels - the models to searcherrors - the error list to add to if an error occursprotected static void raiseError(List<NRLError> errors, ModelReferenceImpl ref, int statusCode, String message)
errors - statusCode - message - Copyright © 2006-2013. All Rights Reserved.