jess
Class Defglobal

java.lang.Object
  extended byjess.Defglobal
All Implemented Interfaces:
java.io.Serializable, Visitable

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

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
 java.lang.Object accept(Visitor v)
           
 Value getInitializationValue()
          Get this defglobal's initialization value.
 java.lang.String getName()
          Get this defglobal's variable name
 void reset(Rete engine)
          Reinject this Defglobal into the engine
 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

reset

public void reset(Rete engine)
           throws JessException
Reinject this Defglobal into the engine

Throws:
JessException

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

Returns:
A pretty-printed version of the defglobal, suitable for parsing

accept

public java.lang.Object accept(Visitor v)
Specified by:
accept in interface Visitable

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