jeops.engine
Class KnowledgeBase

java.lang.Object
  |
  +--jeops.engine.KnowledgeBase

public class KnowledgeBase
extends java.lang.Object

The main class of JEOPS. This class models the knowledge the agent has about the world. In it are stored the facts (objects) and (production) rules that act on the first.

Version:
0.02 29 Jun 1999 First version with comments in English.
Author:
Carlos Figueira Filho (csff@di.ufpe.br)

Constructor Summary
KnowledgeBase(java.lang.String ruleFile)
          Creates a new knowledge base, given the name of the file containing the rules.
KnowledgeBase(java.lang.String ruleFile, RuleSorter ruleSorter)
          Creates a new knowledge base, given the name of the file containing the rules.
 
Method Summary
 void assert(java.lang.Object obj)
          Inserts a new object in this knowledge base.
 void flush()
          Remove all facts (objects) of the object base.
 ObjectBase getObjectBase()
          Returns the object base over which this knowledge base works.
 RuleBase getRuleBase()
          Returns the rule base that controls this knowledge base.
 java.util.Vector objects(java.lang.String className)
          Returns the objects of a given class.
 void retract(java.lang.Object obj)
          Removes a given object of this knowledge base.
 void run()
          Fires the rules in the rule base with the objects present in the object base, until no rule is fireable anymore.
 void setRuleSorter(RuleSorter ruleSorter)
          Defines a conflict set policy for this knowledge base.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KnowledgeBase

public KnowledgeBase(java.lang.String ruleFile)
Creates a new knowledge base, given the name of the file containing the rules. If the rules are not in the specified syntax, the program will abort.
Parameters:
ruleFile - the name of the file containing the rules.

KnowledgeBase

public KnowledgeBase(java.lang.String ruleFile,
                     RuleSorter ruleSorter)
Creates a new knowledge base, given the name of the file containing the rules. If the rules are not in the specified syntax, the program will abort.
Parameters:
ruleFile - the name of the file containing the rules.
ruleSorter - a rule sorter that will define the policy for the rule firing.
Method Detail

assert

public void assert(java.lang.Object obj)
Inserts a new object in this knowledge base.
Parameters:
obj - the object being inserted.

flush

public void flush()
Remove all facts (objects) of the object base.

getObjectBase

public ObjectBase getObjectBase()
Returns the object base over which this knowledge base works.
Returns:
the object base over which this knowledge base works.

getRuleBase

public RuleBase getRuleBase()
Returns the rule base that controls this knowledge base.
Returns:
the rule base that controls this knowledge base.

objects

public java.util.Vector objects(java.lang.String className)
Returns the objects of a given class.
Parameters:
className - the name of the class.

retract

public void retract(java.lang.Object obj)
Removes a given object of this knowledge base.
Parameters:
obj - the object being removed.

run

public void run()
Fires the rules in the rule base with the objects present in the object base, until no rule is fireable anymore.

setRuleSorter

public void setRuleSorter(RuleSorter ruleSorter)
Defines a conflict set policy for this knowledge base.
Parameters:
ruleSorter - the sorter that implements the needed policy.