jess
Class Defglobal

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

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

A Defglobal is a globally-accessible Jess variable. It has a special naming convention: the name must begin and end with an asterisk (*). You can create Defglobals and add them to a Rete engine using Rete.addDefglobal.x

(C) 2005 Sandia National Laboratories

See Also:
Serialized Form

Constructor Summary
Defglobal(java.lang.String name, Value val)
          Create a defglobal.
 
Method Summary
 java.lang.Object accept(Visitor v)
          A proper accept() implementation should call one of the visitXXX() methods on the Visitor.
 java.lang.String getConstructType()
          Return the type of construct this object is; for example, "defrule", "deftemplate", etc.
 java.lang.String getDocstring()
          Always returns null
 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)
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

Specified by:
getName in interface Named
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)
Description copied from interface: Visitable
A proper accept() implementation should call one of the visitXXX() methods on the Visitor.

Specified by:
accept in interface Visitable
Parameters:
v - a visitor to invoke
Returns:
whatever the invoked Visitor method returns.

getConstructType

public final java.lang.String getConstructType()
Description copied from interface: Named
Return the type of construct this object is; for example, "defrule", "deftemplate", etc.

Specified by:
getConstructType in interface Named
Returns:
the construct type

getDocstring

public final java.lang.String getDocstring()
Always returns null

Specified by:
getDocstring in interface Named
Returns:
null

© 2006 Sandia Corporation