jess
Class Defmodule

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

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

A named module containing rules, templates, and other constructs.

(C) 2005 Sandia National Laboratories

See Also:
Serialized Form

Field Summary
static java.lang.String MAIN
           
 
Constructor Summary
Defmodule()
          Construct a module named MAIN.
Defmodule(java.lang.String name, java.lang.String comment)
          Construct a new module.
 
Method Summary
 java.lang.Object accept(Visitor v)
          A proper accept() implementation should call one of the visitXXX() methods on the Visitor.
 Deftemplate addDeftemplate(Deftemplate dt, Rete engine)
          Add a new deftemplate to this moduole.
 java.lang.String getConstructType()
          Return the type of this construct.
 Deftemplate getDeftemplate(java.lang.String name)
          Return a deftemplate defined in this module, by name.
 java.lang.String getDocstring()
          Returns the docmentation string for this module.
 java.lang.String getName()
          Returns the name of this module
 java.util.Iterator listDeftemplates()
          Return an iterator over all the deftemplates defined in this module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAIN

public static final java.lang.String MAIN
See Also:
Constant Field Values
Constructor Detail

Defmodule

public Defmodule()
Construct a module named MAIN.


Defmodule

public Defmodule(java.lang.String name,
                 java.lang.String comment)
Construct a new module.

Parameters:
name - the name of the new module
comment - documentation for the module, or null.
Method Detail

getName

public java.lang.String getName()
Returns the name of this module

Specified by:
getName in interface Named
Returns:
the name

getDocstring

public java.lang.String getDocstring()
Returns the docmentation string for this module.

Specified by:
getDocstring in interface Named
Returns:
the documentation string, or null if none.

listDeftemplates

public java.util.Iterator listDeftemplates()
Return an iterator over all the deftemplates defined in this module.

Returns:
the iterator

getDeftemplate

public Deftemplate getDeftemplate(java.lang.String name)
Return a deftemplate defined in this module, by name.

Parameters:
name - the name of the desired deftemplate
Returns:
the deftemplate if found, or null

addDeftemplate

public Deftemplate addDeftemplate(Deftemplate dt,
                                  Rete engine)
                           throws JessException
Add a new deftemplate to this moduole. The deftemplate must already have been created in this module; it must already report this module's name as part of its name. You can redefine a template only if the definition is identical to the old one.

Parameters:
dt - a new deftemplate
engine - the Rete engine this module belongs to
Returns:
the new deftemplate, or an existing identical template
Throws:
JessException - if anything goes wrong.

getConstructType

public final java.lang.String getConstructType()
Return the type of this construct.

Specified by:
getConstructType in interface Named
Returns:
the string "defmodule".

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.

© 2006 Sandia Corporation