net.sourceforge.nrl.parser.ast
Interface IVariable

All Known Implementing Classes:
Variable

public interface IVariable

A variable reference. A variable is bound either directly to an element, or to a complex expression.


Method Summary
 IModelElement getBoundElement()
          Return the model element bound to this variable.
 IExpression getBoundExpression()
          Return the complex expression bound to this variable.
 String getName()
          Return the variable name.
 NRLDataType getNRLDataType()
          Return a type constant from the NRLDataType class, indicating the data type of the variable.
 Object getUserData(String key)
          Return a named user data object associated with this variable.
 boolean isBoundToElement()
          Return true if the variable is bound to a model element, false if it is bound to a complex expression
 void setNRLDataType(NRLDataType type)
          Assign an NRL type to this variable.
 void setUserData(String key, Object data)
          Associate user data with this variable node, under a given key.
 

Method Detail

getBoundElement

IModelElement getBoundElement()
Return the model element bound to this variable. If isBoundToElement() returns false for this variable, then this method will return null.

Returns:
the element or null if a complex expression is bound.

getBoundExpression

IExpression getBoundExpression()
Return the complex expression bound to this variable. If isBoundToElement() returns true for this variable, then this will return null, else it returns the expression.

Returns:
the expression of null if the variable is bound to an element

getName

String getName()
Return the variable name.

Returns:
the variable name

getNRLDataType

NRLDataType getNRLDataType()
Return a type constant from the NRLDataType class, indicating the data type of the variable.

This can only be called once a type inference algorithm has been applied to the variable or the entire AST.

Returns:
the type, never null

getUserData

Object getUserData(String key)
Return a named user data object associated with this variable.

Parameters:
key - the key identifying the data
Returns:
the object or null if no such data

isBoundToElement

boolean isBoundToElement()
Return true if the variable is bound to a model element, false if it is bound to a complex expression

Returns:
true if bound to element

setNRLDataType

void setNRLDataType(NRLDataType type)
Assign an NRL type to this variable.

Parameters:
type - the type

setUserData

void setUserData(String key,
                 Object data)
Associate user data with this variable node, under a given key.

Parameters:
key - the key
data - the data


Copyright © 2006-2010 Christian Nentwich and others