|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.computing.ai.expertsystem.AbstractKnowledgeBase
public abstract class AbstractKnowledgeBase
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. This class must be subclassed by a concrete knowledge base so that it is provided with the object and rule base needed for work.
| Field Summary | |
|---|---|
protected java.util.Map |
entryPoints
The map that takes class names into the entry points of the Rete network. |
| Constructor Summary | |
|---|---|
AbstractKnowledgeBase(ConflictSet conflictSet)
Creates a new knowledge base. |
|
| Method Summary | |
|---|---|
void |
addConflictSetListener(RuleFireListener l)
Adds the specified conflict set listener to receive events from this knowledge base. |
void |
addRuleFireListener(RuleFireListener l)
Adds the specified rule fire listener to receive events from this knowledge base. |
protected abstract AbstractRuleBase |
createRuleBase()
Factory method, used to instantiate the actual rule base. |
void |
flush()
Remove all facts (objects) of the object base. |
AbstractRuleBase |
getRuleBase()
Returns the (production) rule base of this knowledge base. |
void |
insert(java.lang.Object obj)
Inserts a new object in this knowledge base. |
void |
internalElementAdded(InternalConflictSetEvent e)
Invoked when an element is added to the conflict set. |
void |
internalElementRemoved(InternalConflictSetEvent e)
Invoked when an element is removed from the conflict set. |
protected void |
modified(java.lang.Object obj)
Informs this base that an object was modified, so that the rules can be retested against the object. |
void |
newFirableRule(int ruleIndex,
java.lang.Object[] objects)
Receives a message from the Rete network indicating that the given rule and objects should be inserted into the conflict set. |
java.util.Vector |
objects(java.lang.String className)
Returns the objects of a given class. |
void |
removeConflictSetListener(RuleFireListener l)
Removes the specified conflict set listener so that it no longer receives conflict set events from this knowledge base. |
void |
removeRuleFireListener(RuleFireListener l)
Removes the specified rule fire listener so that it no longer receives rule fire events from this knowledge base. |
boolean |
retract(java.lang.Object obj)
Removes a given object from 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 |
setConflictSet(ConflictSet conflictSet)
Defines a conflict set policy for this knowledge base. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Map entryPoints
| Constructor Detail |
|---|
public AbstractKnowledgeBase(ConflictSet conflictSet)
conflictSet - the conflict set associated with this knowledge base.| Method Detail |
|---|
protected abstract AbstractRuleBase createRuleBase()
public void addConflictSetListener(RuleFireListener l)
l - the conflict set listenerpublic void addRuleFireListener(RuleFireListener l)
l - the rule base listenerpublic void insert(java.lang.Object obj)
obj - the object being inserted.public void flush()
public AbstractRuleBase getRuleBase()
public void internalElementAdded(InternalConflictSetEvent e)
internalElementAdded in interface InternalConflictSetListenere - the conflict set event.public void internalElementRemoved(InternalConflictSetEvent e)
internalElementRemoved in interface InternalConflictSetListenere - the conflict set event.protected void modified(java.lang.Object obj)
obj - the object that was modified.
public void newFirableRule(int ruleIndex,
java.lang.Object[] objects)
ruleIndex - the index of the firable rule.objects - the objects that made the rule firable.public java.util.Vector objects(java.lang.String className)
className - the name of the class.public void removeConflictSetListener(RuleFireListener l)
l - the conflict set listenerpublic void removeRuleFireListener(RuleFireListener l)
l - the rule fire listenerpublic boolean retract(java.lang.Object obj)
obj - the object being removed.
true if the given object belonged to this base;
false otherwise.public void run()
public void setConflictSet(ConflictSet conflictSet)
conflictSet - the new conflict set that implements its
associated conflict resolution policy.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||