com.waveset.expression
Class ExEnvironment
java.lang.Object
com.waveset.expression.ExEnvironment
- public class ExEnvironment
- extends java.lang.Object
An object that encapsulates an global evaluation environment
for a collection of expressions, and provides various conveniene
methods for loading and evaluating expressions.
We used to require that all ExNode trees be rooted in an environment,
but that restriction has been removed.
The main advantage of using an environment, is that global definitions
like can be discovered and used by disconnected expression
fragments. But other times its more convenient just to use the static
ExParser methods, and keep your own little private node trees.
Field Summary |
static java.lang.String |
code_id
|
Method Summary |
void |
addNode(ExNode node)
Add a new node to this environment. |
ExValue |
eval(org.w3c.dom.Document doc,
ExState state)
Evaluate an expression represented as a DOM Document. |
ExValue |
eval(java.lang.String expression,
ExState state)
Evaluate an expression represented as a string. |
ExValue |
evalFile(java.lang.String filename,
ExState state)
Evaluate an expression stored in a file. |
ExBlock |
getBlock()
Get the single global block that surrounds all expressions
in this environment. |
void |
link(ExNode node)
"Link" a node into the environment. |
ExNode |
load(org.w3c.dom.Element el)
Load an expression represented as a DOM element into the environment. |
void |
load(java.lang.String expression)
Loads a set of expressions represented as a string into
the environment. |
void |
load(java.lang.String expression,
boolean validate)
Loads a set of expressions represented as a string into
the environment. |
void |
loadFile(java.lang.String filename)
Loads a set of expressions stored in a file into the environment. |
void |
removeNode(ExNode node)
Remove a node from this environment. |
void |
resolve()
Post process the environment after a series of load calls. |
void |
unresolve()
Unresolve any references to force a later resolve. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
code_id
public static final java.lang.String code_id
- See Also:
- Constant Field Values
ExEnvironment
public ExEnvironment()
- Build an environment.
getBlock
public ExBlock getBlock()
- Get the single global block that surrounds all expressions
in this environment.
resolve
public void resolve()
throws WavesetException
- Post process the environment after a series of load calls.
- Throws:
WavesetException
unresolve
public void unresolve()
- Unresolve any references to force a later resolve.
addNode
public void addNode(ExNode node)
- Add a new node to this environment.
removeNode
public void removeNode(ExNode node)
- Remove a node from this environment.
Do we need this?
link
public void link(ExNode node)
- "Link" a node into the environment.
Like addNode but checks to see if the node is already here.
Actually, addNode does that too, but I like the name "link" its
being used in forms now.
Should we allow nodes that are currently in another environment
to be linked?
evalFile
public ExValue evalFile(java.lang.String filename,
ExState state)
throws WavesetException
- Evaluate an expression stored in a file.
- Throws:
WavesetException
eval
public ExValue eval(java.lang.String expression,
ExState state)
throws WavesetException
- Evaluate an expression represented as a string.
A state object must be supplied to hold the runtime state, and
also provide resolution methods for external references if we
have any.
- Throws:
WavesetException
eval
public ExValue eval(org.w3c.dom.Document doc,
ExState state)
throws WavesetException
- Evaluate an expression represented as a DOM Document.
- Throws:
WavesetException
load
public ExNode load(org.w3c.dom.Element el)
throws WavesetException
- Load an expression represented as a DOM element into the environment.
- Throws:
WavesetException
loadFile
public void loadFile(java.lang.String filename)
throws WavesetException
- Loads a set of expressions stored in a file into the environment.
- Throws:
WavesetException
load
public void load(java.lang.String expression)
throws WavesetException
- Loads a set of expressions represented as a string into
the environment.
This is the original interface that doesn't turn on validation.
- Throws:
WavesetException
load
public void load(java.lang.String expression,
boolean validate)
throws WavesetException
- Loads a set of expressions represented as a string into
the environment.
- Throws:
WavesetException