|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IModelReference
A reference to a model element, consisting of several steps along element and attribute names. Includes an optional "where" clause. The class effectively represents a simple query over a model.
Field Summary | |
---|---|
static int |
REFERENCE_ELEMENT
Reference type: references a model element. |
static int |
REFERENCE_GLOBAL_VARIABLE
Reference type: global variable reference. |
static int |
REFERENCE_RELATIVE_ATTRIBUTE
Reference type: a reference to an attribute, relative to the current evaluation context. |
static int |
REFERENCE_STATIC_ATTRIBUTE
Reference type: a reference to a static attribute, or enumeration value. |
static int |
REFERENCE_TOP_CONTEXT_RELATIVE_ATTRIBUTE
Reference type: a reference to an attribute relative to the rule or fragment context. |
static int |
REFERENCE_VARIABLE_RELATIVE_ATTRIBUTE
Reference type: an attribute relative to a variable, for example x.date , where x is some bound variable. |
static String |
SEPARATOR
The step separator constant |
static int |
STEP_ATTRIBUTE
The initial step is an attribute of a model element |
static int |
STEP_MODEL_ELEMENT
The initial step is a model element |
static int |
STEP_VARIABLE
The initial step is a variable reference |
Fields inherited from interface net.sourceforge.nrl.parser.ast.INRLAstNode |
---|
NEWLINE |
Method Summary | |
---|---|
IModelElement |
getCurrentContext()
Return the "current context" in which this reference was made. |
Object |
getInitialStep()
Return the initial step. |
int |
getInitialStepType()
Return the type of model reference this is: whether it starts with a variable, with a model element, or with an attribute. |
String |
getOriginalString()
Return the original model reference string found in the NRL text. |
int |
getReferenceType()
Indicate what type of reference this is: to an attribute, to a static attribute or enumeration, etc. |
List<IAttribute> |
getRemainingSteps()
Return the remaining steps after the initial step has been traversed. |
IModelElement |
getTarget()
Return the final target of a reference, which is always a model element. |
Methods inherited from interface net.sourceforge.nrl.parser.ast.constraints.IConstraint |
---|
getNRLDataType, setNRLDataType |
Methods inherited from interface net.sourceforge.nrl.parser.ast.INRLAstNode |
---|
accept, dump, getColumn, getLine, getUserData, setUserData |
Field Detail |
---|
static final int REFERENCE_ELEMENT
static final int REFERENCE_STATIC_ATTRIBUTE
TradeType.FX
. Such a reference typically
starts with a model element and points to a static attribute.
static final int REFERENCE_RELATIVE_ATTRIBUTE
tradeHeader.tradeDate
.
static final int REFERENCE_TOP_CONTEXT_RELATIVE_ATTRIBUTE
each leg has date = Trade.date
, the reference
Trade.date
refers to the date of the overall rule context,
not the leg. The element Trade
must be the rule
context, otherwise an error is raised during resolution.
static final int REFERENCE_VARIABLE_RELATIVE_ATTRIBUTE
x.date
, where x is some bound variable.
static final int REFERENCE_GLOBAL_VARIABLE
static final int STEP_ATTRIBUTE
static final int STEP_MODEL_ELEMENT
static final int STEP_VARIABLE
static final String SEPARATOR
Method Detail |
---|
IModelElement getCurrentContext()
getReferenceType()
returns
REFERENCE_RELATIVE_ATTRIBUTE
.
For an attribute reference, this returns the model element in which the
attribute occurred. For example, in the rule in each of the trades,
the tradeDate is equal to '2005-12-12'
,
calling this method on the tradeDate
reference would
return Trade
or whatever the type of 'trades' was.
int getInitialStepType()
Object getInitialStep()
getInitialStepType()
this will return:
IAttribute
object
IModelElement
object
IVariable
object
IMPORTANT: This can only be called after a model has been loaded, because information from the model is needed to determine this.
String getOriginalString()
List<IAttribute> getRemainingSteps()
IAttribute
objects.
int getReferenceType()
REFERENCE_ELEMENT
, REFERENCE_RELATIVE_ATTRIBUTE
,
REFERENCE_STATIC_ATTRIBUTE
,
REFERENCE_TOP_CONTEXT_RELATIVE_ATTRIBUTE
or
REFERENCE_VARIABLE_RELATIVE_ATTRIBUTE
.
IModelElement getTarget()
There is only one case where this can return null: If the initial step is a variable that points to a complex expression rather than a model element. In that case, retrieve the expression from the variable.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |