jess
Class Defglobal

java.lang.Object
  |
  +--jess.Defglobal

public class Defglobal
extends java.lang.Object
implements JessListener, java.io.Serializable

Class used to represent Defglobals. You can create Defglobals and add them to a Rete engine using Rete.addDefglobal.

(C) 1997 Ernest J. Friedman-Hill and Sandia National Laboratories

Author:
Ernest J. Friedman-Hill
See Also:
Serialized Form

Constructor Summary
Defglobal(java.lang.String name, Value val)
          Create a defglobal.
 
Method Summary
 void eventHappened(JessEvent je)
          On a RESET event, reenter myself into engine, but only if the engine thinks it's appropriate (i,e., depending on the current set-reset-globals setting.) On a CLEAR event, unlink myself from the engine.
 Value getInitializationValue()
          Get this defglobal's initialization value.
 java.lang.String getName()
          Get this defglobal's variable name
 java.lang.String toString()
          Describe myself
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Defglobal

public Defglobal(java.lang.String name,
                 Value val)
          throws JessException
Create a defglobal. Should be added to a Rete object with Rete.addDefglobal. Note that a separate Defglobal object must be created for each global variable, even though one (defglobal) construct may represent more than one such variable.
Parameters:
name - The defglobal's variable name. Note that the name must begin and end with an asterisk.
val - The initial value for the defglobal; can be an RU.FUNCALL value.
Throws:
JessException - If anything goes wrong.
Method Detail

eventHappened

public void eventHappened(JessEvent je)
                   throws JessException
On a RESET event, reenter myself into engine, but only if the engine thinks it's appropriate (i,e., depending on the current set-reset-globals setting.) On a CLEAR event, unlink myself from the engine.
Specified by:
eventHappened in interface JessListener
Parameters:
je - The event
Throws:
JessException - If anything goes wrong.

getName

public java.lang.String getName()
Get this defglobal's variable name
Returns:
The variable name

getInitializationValue

public Value getInitializationValue()
Get this defglobal's initialization value. The returned Value may be a simple value, a Variable, or a FuncallValue, so be careful how you interpret it.
Returns:
The value this variable was originally initialized to

toString

public java.lang.String toString()
Describe myself
Overrides:
toString in class java.lang.Object
Returns:
A pretty-printed version of the defglobal, suitable for parsing

© 1997 E.J. Friedman-Hill and Sandia Corporation