pilot.jesscommunicator
Class JessCommunicator

java.lang.Object
  |
  +--pilot.jesscommunicator.JessCommunicator

public class JessCommunicator
extends java.lang.Object


Field Summary
protected  pilot.jesscommunicator.Rete engine_
          The inference engine of Jess.
protected  JessViewer viewer_
          The Jess viewer.
 
Constructor Summary
JessCommunicator()
          This constructor initiates the engine and resets the factbase.
 
Method Summary
 void addClassTemplate(java.lang.String className)
          The method addClassTemplate adds a template of the given class to the factbase.
 void addObjectFact(java.lang.Object obj)
          The method addObjectFact adds a shadow fact of the given object to the factbase.
 JessViewer getViewer()
          The method getViewer returns the Jess viewer.
 void loadKnowledge(java.lang.String filename)
          The method loadKnowledge loads knowledge, specified as a filename, into the Jess knowledgebase.
 void runEngine()
          The method runEngine evaluates the rules in the rulebase.
 void setRule(java.lang.String rule)
          The method setRule adds a Jess rule to the rulebase.
 void setViewer(JessViewer viewer)
          The method setViewer defines the Jess viewer.
 java.lang.Object[][] showFacts()
          The method showFacts reads the facts from Jess and returns them.
 java.lang.Object[][] showRules()
          The method showRules reads the rules from Jess and returns them.
 void showTemplates()
          The method showTemplates prints all the templates in the Jess engine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

engine_

protected pilot.jesscommunicator.Rete engine_
The inference engine of Jess.

viewer_

protected JessViewer viewer_
The Jess viewer.
Constructor Detail

JessCommunicator

public JessCommunicator()
This constructor initiates the engine and resets the factbase.
Method Detail

loadKnowledge

public void loadKnowledge(java.lang.String filename)
The method loadKnowledge loads knowledge, specified as a filename, into the Jess knowledgebase.
Parameters:
filename - name of the rulebase that has to be loaded by the engine

runEngine

public void runEngine()
The method runEngine evaluates the rules in the rulebase.

showFacts

public java.lang.Object[][] showFacts()
The method showFacts reads the facts from Jess and returns them. Of each fact its id, name, template, and content is returned.
Returns:
2-Dimensional array with content of factbase

showRules

public java.lang.Object[][] showRules()
The method showRules reads the rules from Jess and returns them. Of each rule its id, name, and content is returned.
Returns:
2-Dimensional array with content of rulebase

addClassTemplate

public void addClassTemplate(java.lang.String className)
The method addClassTemplate adds a template of the given class to the factbase.
Parameters:
className - The name of the class the template is based on.

addObjectFact

public void addObjectFact(java.lang.Object obj)
The method addObjectFact adds a shadow fact of the given object to the factbase. The appropriate template should have been created with addClassTemplate.
Parameters:
obj - The Object that has to be added to the factbase.

showTemplates

public void showTemplates()
The method showTemplates prints all the templates in the Jess engine

setViewer

public void setViewer(JessViewer viewer)
The method setViewer defines the Jess viewer.
Parameters:
viewer - The Jess viewer that is to be set.

getViewer

public JessViewer getViewer()
The method getViewer returns the Jess viewer.
Returns:
The JessViewer object

setRule

public void setRule(java.lang.String rule)
The method setRule adds a Jess rule to the rulebase.
Parameters:
rule - The rule to be added.