org.drools.reteoo
Class Agenda

java.lang.Object
  extended byorg.drools.reteoo.Agenda
All Implemented Interfaces:
Serializable

class Agenda
extends Object
implements Serializable

Rule-firing Agenda.

Since many rules may be matched by a single assertObject(...) all scheduled actions are placed into the Agenda.

While processing a scheduled action, it may modify or retract objects in other scheduled actions, which must then be removed from the agenda. Non-invalidated actions are left on the agenda, and are executed in turn.

Author:
bob mcwhirter , Simon Harris

Constructor Summary
Agenda(WorkingMemoryImpl workingMemory, ConflictResolver conflictResolver)
          Construct.
 
Method Summary
(package private)  void addToAgenda(ReteTuple tuple, Rule rule)
          Schedule a rule action invokation on this Agenda.
(package private)  void cancelItem(AgendaItem item)
          Cancel a scheduled agenda item for delayed firing.
(package private)  void clearAgenda()
          Clears all Activations from the Agenda
 void fireNextItem(AgendaFilter filter)
          Fire the next scheduled Agenda item.
 boolean isEmpty()
          Determine if this Agenda has any scheduled items.
(package private)  void modifyAgenda(FactHandle trigger, TupleSet newTuples, Rule rule)
          Modify the agenda.
(package private)  void removeFromAgenda(TupleKey key, Rule rule)
          Remove a tuple from the agenda.
(package private)  void scheduleItem(AgendaItem item)
          Schedule an agenda item for delayed firing.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Agenda

public Agenda(WorkingMemoryImpl workingMemory,
              ConflictResolver conflictResolver)
Construct.

Parameters:
workingMemory - The WorkingMemory of this agenda.
conflictResolver - The conflict resolver.
Method Detail

addToAgenda

void addToAgenda(ReteTuple tuple,
                 Rule rule)
Schedule a rule action invokation on this Agenda. Rules specified with noNoop=true that are active should not be added to the agenda

Parameters:
tuple - The matching Tuple.
rule - The rule to fire.

removeFromAgenda

void removeFromAgenda(TupleKey key,
                      Rule rule)
Remove a tuple from the agenda.

Parameters:
key - The key to the tuple to be removed.
rule - The rule to remove.

modifyAgenda

void modifyAgenda(FactHandle trigger,
                  TupleSet newTuples,
                  Rule rule)
Modify the agenda.

Parameters:
trigger - The triggering root object handle.
newTuples - New tuples from the modification.
rule - The rule.

clearAgenda

void clearAgenda()
Clears all Activations from the Agenda


scheduleItem

void scheduleItem(AgendaItem item)
Schedule an agenda item for delayed firing.

Parameters:
item - The item to schedule.

cancelItem

void cancelItem(AgendaItem item)
Cancel a scheduled agenda item for delayed firing.

Parameters:
item - The item to cancel.

isEmpty

public boolean isEmpty()
Determine if this Agenda has any scheduled items.

Returns:
true if the agenda is empty, otherwise false.

size

public int size()

fireNextItem

public void fireNextItem(AgendaFilter filter)
                  throws ConsequenceException
Fire the next scheduled Agenda item.

Throws:
ConsequenceException - If an error occurs while firing an agenda item.


Copyright © 2001-2004 The Codehaus. All Rights Reserved.