|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jess.Context
A Context represents a scope in which variables can be declared. It also holds a pointer to a Rete object in which code can be executed.
You can use getVariable(java.lang.String)
and
setVariable(java.lang.String, jess.Value)
to get and change the value of a variable from
Java code, respectively.
The function getEngine()
gives any Userfunction
access to the Rete
object in which it is executing.
When a Userfunction is called, a Context
argument is passed in as the final argument. You should pass this
jess.Context to any methods you call that expect a Context argument themselves.
you make.
Constructor Summary | |
Context(Context c)
Create a new context subordinate to an existing one. |
|
Context(Context c,
Rete engine)
Create a new context subordinate to an existing one. |
Method Summary | |
void |
addDebugInfo(Funcall funcall)
|
void |
clearReturnValue()
Clear the return flag and return value for this context. |
Value |
getBindingVariable(java.lang.String varName)
|
Rete |
getEngine()
Returns the Rete engine associated with this context. |
Fact |
getFact()
If this context represents a join network node from a rule LHS, this will return the right input of the node. |
Funcall |
getFuncall()
|
LineNumberRecord |
getLineNumberRecord()
|
jess.LogicalNode |
getLogicalSupportNode()
If this context represents the RHS of a rule which is firing, and the LHS of the rule has provided logical support, this method will return the LogicalNode that lends support. |
Context |
getParent()
|
Value |
getReturnValue()
Get the value set via setReturnValue |
Token |
getToken()
If this context represents a join network node from a rule LHS, this will return the left input of the node. |
Value |
getVariable(java.lang.String name)
Get the value of a variable |
java.util.Iterator |
getVariableNames()
|
boolean |
isVariableDefined(java.lang.String name)
Report whether a variable has a value in this context |
Context |
pop()
Pop this context off the execution stack. |
Context |
push()
Create and return a new context subordinate to this one. |
boolean |
returning()
Returns true if the return flag has been set in this context. |
void |
setExistingVariable(java.lang.String name,
Value value)
Set an existing variable in an ancestor of this context to a value; if no existing variable, value is set in this context. |
Value |
setReturnValue(Value val)
Set the return flag to true, and supply a value to be returned. |
void |
setVariable(java.lang.String name,
Value value)
Set a variable in this context to some type and value. |
java.lang.String |
toString()
Returns a useful debug representation of the context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Context(Context c)
c
- The parent for the new contextpush()
public Context(Context c, Rete engine)
c
- The parent for the new contextengine
- The value to be returned from getEngineMethod Detail |
public final Token getToken()
public final Fact getFact()
public final jess.LogicalNode getLogicalSupportNode()
public final boolean returning()
public final Value setReturnValue(Value val)
val
- The value that should be returned from this context
public final Value getReturnValue()
public final void clearReturnValue()
public java.util.Iterator getVariableNames()
public final Rete getEngine()
public Context push()
public Context pop()
public Context getParent()
public Value getVariable(java.lang.String name) throws JessException
name
- The name of the variable with no leading '?' or '$'
characters
JessException
- If the variable is undefinedpublic boolean isVariableDefined(java.lang.String name) throws JessException
name
- The name of the variable with no leading '?' or '$'
characters
JessException
public void setVariable(java.lang.String name, Value value) throws JessException
name
- Name of the variablevalue
- The value of the variable
JessException
public void setExistingVariable(java.lang.String name, Value value) throws JessException
name
- Name of the variablevalue
- The value of the variable
JessException
public void addDebugInfo(Funcall funcall) throws JessException
JessException
public java.lang.String toString()
public Funcall getFuncall()
public LineNumberRecord getLineNumberRecord()
public Value getBindingVariable(java.lang.String varName) throws JessException
JessException
|
© 2006 Sandia Corporation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |