org.drools.reteoo
Class Agenda

java.lang.Object
  extended by org.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

Field Summary
static int ASSERT
           
static int MODIFY
           
static int NONE
           
static int RETRACT
           
 
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 removeFromAgenda(TupleKey key, Rule rule)
          Remove a tuple from the agenda.
(package private)  void removeMarkedItemsFromAgenda()
           
(package private)  void scheduleItem(AgendaItem item)
          Schedule an agenda item for delayed firing.
(package private)  void setAsyncExceptionHandler(AsyncExceptionHandler handler)
          Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.
(package private)  void setMode(int mode)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static int NONE

ASSERT

public static int ASSERT

MODIFY

public static int MODIFY

RETRACT

public static int RETRACT
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.

removeMarkedItemsFromAgenda

void removeMarkedItemsFromAgenda()

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.

setAsyncExceptionHandler

void setAsyncExceptionHandler(AsyncExceptionHandler handler)
Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.

Parameters:
handler -

setMode

void setMode(int mode)


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