com.haley.haleyrules
Interface Agenda

All Superinterfaces:
KnowledgeBaseObject

public interface Agenda
extends KnowledgeBaseObject

The Agenda interface publishes the API for an agenda defined in the Eclipse "defruleset" construct. An agenda belongs to a Ruleset and contains a set of rules. An agenda is returned by Ruleset.findAgenda(String) and Rule.getAgenda().

Author:
The Haley Enterprise Copyright © 1998-2004, all rights reserved. Questions, comments or to report a problem contact support@haley.com

Method Summary
 void excise()
          Removes the agenda from the knowledgebase and calls KnowledgeBaseObject.release().
 Rule findRule(java.lang.String name)
          Find the rule with the specified name in the agenda.
 java.lang.String getName()
          Get the name of an agenda.
 RuleIterator getRules()
           
 Ruleset getRuleset()
          Get the ruleset to which the agenda belongs.
 int getSalience()
          Get the salience of the Agenda
 long run(WorkingMemory wm)
          Runs the inference engine, executing rules from the agenda within this ruleset
 long run(WorkingMemory wm, long limit)
          Runs the inference engine, executing rules from theagenda until the limit has been reached.
 
Methods inherited from interface com.haley.haleyrules.KnowledgeBaseObject
getKnowledgeBase, release
 

Method Detail

getRules

public RuleIterator getRules()
                      throws EclipseException
Throws:
EclipseException

findRule

public Rule findRule(java.lang.String name)
              throws EclipseException
Find the rule with the specified name in the agenda. Each call to this function must be accompanied with a corresponding call to KnowledgeBaseObject.release() or Rule.excise().

Parameters:
name - the name of the rule
Returns:
the rule with the specified name or null if the rules could not be found
Throws:
EclipseException - if the knowledge base has been deleted
EclipseException - if the ruleset for this agenda has been excised
EclipseException - if the agenda has been excised
See Also:
Rule.excise(), KnowledgeBaseObject.release()

getName

public java.lang.String getName()
                         throws EclipseException
Get the name of an agenda.

Returns:
the name of the agenda
Throws:
EclipseException - if the knowledge base has been deleted
EclipseException - if the ruleset for this agenda has been
EclipseException - if the agenda has been
EclipseException - if the rule could not be found

getRuleset

public Ruleset getRuleset()
                   throws EclipseException
Get the ruleset to which the agenda belongs.

Returns:
a ruleset
Throws:
EclipseException - if the knowledge base has been deleted
EclipseException - if the ruleset for this agenda has been excised
EclipseException - if the agenda has been excised
EclipseException - if the rule could not be found

getSalience

public int getSalience()
                throws EclipseException
Get the salience of the Agenda

Returns:
a salience
Throws:
EclipseException - if the knowledge base has been deleted
EclipseException - if the ruleset for this agenda has been excised
EclipseException - if the agenda has been excised
EclipseException - if the rule could not be found

excise

public void excise()
            throws EclipseException
Removes the agenda from the knowledgebase and calls KnowledgeBaseObject.release(). Any subsequent use of any member function, other than KnowledgeBaseObject.release(), will result in an exception. Since all rules within the agenda are also removed, any subsequent use of these objects, other than KnowledgeBaseObject.release(), will also result in an exception. Even after an excise, every function that returned the agenda, e.g, Ruleset.findAgenda(String) or Rule.getAgenda(), must be paired with a corresponding call to KnowledgeBaseObject.release() or excise().

Throws:
EclipseException - if the knowledge base has been deleted
EclipseException - if the ruleset for this agenda has been excised
EclipseException - if the agenda has been excised
EclipseException - if the rule could not be found

run

public long run(WorkingMemory wm,
                long limit)
         throws EclipseException
Runs the inference engine, executing rules from theagenda until the limit has been reached.

Parameters:
wm - the working memory for the run
limit - the maximum number of rules to fire, where -1 indicates that there is no limit
Returns:
the number of rules executed
Throws:
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
EclipseException - if the ruleset has been excised
EclipseException - if an error occurs
See Also:
run(WorkingMemory), Ruleset.run(WorkingMemory,long), Ruleset.run(WorkingMemory), WorkingMemory.run(long), WorkingMemory.run()

run

public long run(WorkingMemory wm)
         throws EclipseException
Runs the inference engine, executing rules from the agenda within this ruleset

Parameters:
wm - the working memory for the run
Returns:
the number of rules executed
Throws:
EclipseException - if the knowledge base has been deleted
EclipseException - if the working memory has been deleted
EclipseException - if the ruleset has been excised
EclipseException - if an error occurs
See Also:
run(WorkingMemory,long), Ruleset.run(WorkingMemory,long), Ruleset.run(WorkingMemory), WorkingMemory.run(long), WorkingMemory.run()


Copyright © 1998-2006 Haley Systems, Inc. All Rights Reserved.