jess
Class Defmodule

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

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

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

(C) 2013 Sandia Corporation

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 module.
 boolean getAutoFocus()
          Return the auto-focus property for this module.
 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<Deftemplate> listDeftemplates()
          Return an iterator over all the deftemplates defined in this module.
 void removeDeftemplate(Deftemplate template)
           
 void setAutoFocus(boolean val)
          Turns on auto-focus for 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<Deftemplate> 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 module. 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.

removeDeftemplate

public void removeDeftemplate(Deftemplate template)

setAutoFocus

public void setAutoFocus(boolean val)
Turns on auto-focus for this module. Equivalent to marking every rule in this module with the auto-focus property.

Parameters:
val - true to turn on module autofocus
See Also:
Defrule.setAutoFocus(boolean)

getAutoFocus

public boolean getAutoFocus()
Return the auto-focus property for this module.

Returns:
the autofocus property for this module
See Also:
setAutoFocus(boolean)

© 2013 Sandia Corporation