|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.drools.common.DefaultAgenda
public class DefaultAgenda
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 update 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.
| Field Summary | |
|---|---|
int |
activeActivations
|
int |
dormantActivations
|
protected AtomicBoolean |
halt
|
| Constructor Summary | |
|---|---|
DefaultAgenda()
|
|
DefaultAgenda(InternalRuleBase rb)
Construct. |
|
DefaultAgenda(InternalRuleBase rb,
boolean initMain)
Construct. |
|
| Method Summary | |
|---|---|
void |
activateRuleFlowGroup(String name)
Activates the RuleFlowGroup with the given name. |
void |
activateRuleFlowGroup(String name,
long processInstanceId,
String nodeInstanceId)
Activates the RuleFlowGroup with the given name. |
boolean |
addActivation(AgendaItem activation)
Adds the activation to the agenda. |
void |
addAgendaGroup(AgendaGroup agendaGroup)
|
void |
addRuleFlowGroupListener(String ruleFlowGroup,
RuleFlowGroupListener listener)
Adds a RuleFlowGroupListerner to the named RuleFlowGroup |
int |
agendaSize()
Iterates all the modules in the focus stack returning the total number of Activations |
void |
cancelActivation(LeftTuple leftTuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
Activation activation,
RuleTerminalNode rtn)
|
void |
clear()
|
void |
clearAndCancel()
(non-Javadoc) |
void |
clearAndCancelActivationGroup(ActivationGroup activationGroup)
Clears all Activations from an Activation Group. |
void |
clearAndCancelActivationGroup(String name)
Clears all Activations from an Activation-Group. |
void |
clearAndCancelAgendaGroup(AgendaGroup agendaGroup)
Clears all Activations from an Agenda Group. |
void |
clearAndCancelAgendaGroup(String name)
Clears all Activations from an Agenda Group. |
void |
clearAndCancelAndCancel(RuleFlowGroup ruleFlowGroup)
|
void |
clearAndCancelRuleFlowGroup(String name)
|
void |
clearAndCancelStagedActivations()
|
boolean |
createActivation(LeftTuple tuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
RuleTerminalNode rtn,
boolean reuseActivation)
|
AgendaItem |
createAgendaItem(LeftTuple tuple,
int salience,
PropagationContext context,
RuleTerminalNode rtn)
|
boolean |
createPostponedActivation(LeftTuple tuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
RuleTerminalNode rtn)
|
ScheduledAgendaItem |
createScheduledAgendaItem(LeftTuple tuple,
PropagationContext context,
RuleTerminalNode rtn)
|
void |
deactivateRuleFlowGroup(String name)
Deactivates the RuleFlowGroup with the given name. |
void |
decreaseActiveActivations()
|
void |
decreaseDormantActivations()
|
void |
fireActivation(Activation activation)
Fire this item. |
int |
fireAllRules(AgendaFilter agendaFilter,
int fireLimit)
Fires all activations currently in agenda that match the given agendaFilter until the fireLimit is reached or no more activations exist. |
boolean |
fireNextItem(AgendaFilter filter)
Fire the next scheduled Agenda item, skipping items
that are not allowed by the agenda filter. |
boolean |
fireTimedActivation(Activation activation,
boolean saveForLater)
|
void |
fireUntilHalt()
Keeps firing activations until a halt is called. |
void |
fireUntilHalt(AgendaFilter agendaFilter)
Keeps firing activations until a halt is called. |
int |
focusStackSize()
Iterates all the AgendGroup |
ActivationGroup |
getActivationGroup(String name)
|
Map<String,ActivationGroup> |
getActivationGroupsMap()
|
Activation[] |
getActivations()
|
ActivationsFilter |
getActivationsFilter()
Returns the current activations filter or null if none is set |
int |
getActiveActivations()
|
AgendaGroup |
getAgendaGroup(String name)
|
AgendaGroup[] |
getAgendaGroups()
|
Map<String,InternalAgendaGroup> |
getAgendaGroupsMap()
|
ConsequenceExceptionHandler |
getConsequenceExceptionHandler()
|
AgendaGroup |
getCurrentAgendaGroup()
|
int |
getDormantActivations()
|
AgendaGroup |
getFocus()
|
String |
getFocusName()
Returns the name of the agenda group that currently has the focus |
InternalAgendaGroup |
getMainAgendaGroup()
|
AgendaGroup |
getNextFocus()
|
RuleFlowGroup |
getRuleFlowGroup(String name)
|
Map<String,RuleFlowGroup> |
getRuleFlowGroupsMap()
|
Activation[] |
getScheduledActivations()
|
LinkedList |
getScheduledActivationsLinkedList()
|
AgendaGroup[] |
getStack()
|
LinkedList<AgendaGroup> |
getStackList()
|
ActivationGroup |
getStageActivationsGroup()
|
WorkingMemory |
getWorkingMemory()
Returns the WorkignMemory for this Agenda |
void |
halt()
Stop agenda from firing any other rule. |
void |
increaseActiveActivations()
|
void |
increaseDormantActivations()
|
boolean |
isDeclarativeAgenda()
|
boolean |
isRuleActiveInRuleFlowGroup(String ruleflowGroupName,
String ruleName,
long processInstanceId)
Returns true if there is at least one activation of the given rule name in the given ruleflow group name |
void |
modifyActivation(AgendaItem activation,
boolean previouslyActive)
|
void |
notifyHalt()
|
void |
readExternal(ObjectInput in)
|
void |
removeActivation(AgendaItem activation)
|
void |
removeRuleFlowGroupListener(String ruleFlowGroup,
RuleFlowGroupListener listener)
Removes the given RuleFlowGroupListener from the list of listeners of the named RuleFlowGroup |
void |
removeScheduleItem(ScheduledAgendaItem item)
|
void |
scheduleItem(ScheduledAgendaItem item,
InternalWorkingMemory wm)
Schedule an agenda item for delayed firing. |
void |
setActivationsFilter(ActivationsFilter filter)
Sets a filter that prevents activations from being added to the agenda. |
void |
setActiveActivations(int activeActivations)
|
void |
setCurrentAgendaGroup(InternalAgendaGroup agendaGroup)
|
void |
setDormantActivations(int dormantActivations)
|
boolean |
setFocus(AgendaGroup agendaGroup)
|
void |
setFocus(PropagationContext ctx,
String name)
|
void |
setFocus(String name)
Sets the Agenda's focus to the specified AgendaGroup |
void |
setWorkingMemory(InternalWorkingMemory workingMemory)
|
void |
unstageActivations()
|
void |
writeExternal(ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int activeActivations
public int dormantActivations
protected volatile AtomicBoolean halt
| Constructor Detail |
|---|
public DefaultAgenda()
public DefaultAgenda(InternalRuleBase rb)
rb - The InternalRuleBase of this agenda.
public DefaultAgenda(InternalRuleBase rb,
boolean initMain)
rb - The InternalRuleBase of this agenda.initMain - Flag to initialize the MAIN agenda group| Method Detail |
|---|
public AgendaItem createAgendaItem(LeftTuple tuple,
int salience,
PropagationContext context,
RuleTerminalNode rtn)
createAgendaItem in interface InternalAgenda
public ScheduledAgendaItem createScheduledAgendaItem(LeftTuple tuple,
PropagationContext context,
RuleTerminalNode rtn)
createScheduledAgendaItem in interface InternalAgendapublic void setWorkingMemory(InternalWorkingMemory workingMemory)
setWorkingMemory in interface InternalAgenda
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOExceptionpublic WorkingMemory getWorkingMemory()
Agenda
public void scheduleItem(ScheduledAgendaItem item,
InternalWorkingMemory wm)
scheduleItem in interface InternalAgendaitem - The item to schedule.public ActivationGroup getStageActivationsGroup()
public boolean addActivation(AgendaItem activation)
InternalAgenda
addActivation in interface InternalAgendapublic void setActiveActivations(int activeActivations)
public void setDormantActivations(int dormantActivations)
public boolean isDeclarativeAgenda()
isDeclarativeAgenda in interface InternalAgendapublic void removeActivation(AgendaItem activation)
removeActivation in interface InternalAgenda
public void modifyActivation(AgendaItem activation,
boolean previouslyActive)
modifyActivation in interface InternalAgendapublic void clearAndCancelStagedActivations()
public void unstageActivations()
public void removeScheduleItem(ScheduledAgendaItem item)
removeScheduleItem in interface InternalAgendapublic void addAgendaGroup(AgendaGroup agendaGroup)
addAgendaGroup in interface InternalAgenda
public boolean createActivation(LeftTuple tuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
RuleTerminalNode rtn,
boolean reuseActivation)
createActivation in interface InternalAgenda
public boolean createPostponedActivation(LeftTuple tuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
RuleTerminalNode rtn)
public void cancelActivation(LeftTuple leftTuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
Activation activation,
RuleTerminalNode rtn)
cancelActivation in interface InternalAgendapublic boolean setFocus(AgendaGroup agendaGroup)
public void setFocus(String name)
Agenda
public void setFocus(PropagationContext ctx,
String name)
public AgendaGroup getFocus()
public AgendaGroup getNextFocus()
public void setCurrentAgendaGroup(InternalAgendaGroup agendaGroup)
public AgendaGroup getCurrentAgendaGroup()
public AgendaGroup getAgendaGroup(String name)
getAgendaGroup in interface InternalAgendagetAgendaGroup in interface org.drools.runtime.rule.Agendapublic AgendaGroup[] getAgendaGroups()
public Map<String,InternalAgendaGroup> getAgendaGroupsMap()
public InternalAgendaGroup getMainAgendaGroup()
public AgendaGroup[] getStack()
public LinkedList<AgendaGroup> getStackList()
public Map<String,RuleFlowGroup> getRuleFlowGroupsMap()
public Map<String,ActivationGroup> getActivationGroupsMap()
public ActivationGroup getActivationGroup(String name)
getActivationGroup in interface InternalAgendagetActivationGroup in interface org.drools.runtime.rule.Agendapublic RuleFlowGroup getRuleFlowGroup(String name)
getRuleFlowGroup in interface InternalAgendagetRuleFlowGroup in interface org.drools.runtime.rule.Agendapublic void activateRuleFlowGroup(String name)
AgendaRuleFlowGroup with the given name.
All activations in the given RuleFlowGroup are added to the agenda.
As long as the RuleFlowGroup remains active,
its activations are automatically added to the agenda.
public void activateRuleFlowGroup(String name,
long processInstanceId,
String nodeInstanceId)
AgendaRuleFlowGroup with the given name.
All activations in the given RuleFlowGroup are added to the agenda.
As long as the RuleFlowGroup remains active,
its activations are automatically added to the agenda.
The given processInstanceId and nodeInstanceId define the process context
in which this RuleFlowGroup is used.
public void deactivateRuleFlowGroup(String name)
AgendaRuleFlowGroup with the given name.
All activations in the given RuleFlowGroup are removed from the agenda.
As long as the RuleFlowGroup remains deactive,
its activations are not added to the agenda
public int focusStackSize()
AgendaAgendGroups in the focus stack returning the total number of Activations
- Returns:
- total number of
Activations on the focus stack
public int agendaSize()
AgendaActivations
public Activation[] getActivations()
public Activation[] getScheduledActivations()
public LinkedList getScheduledActivationsLinkedList()
getScheduledActivationsLinkedList in interface InternalAgendapublic void clear()
clear in interface InternalAgendaclear in interface org.drools.runtime.rule.Agendapublic void clearAndCancel()
org.drools.common.AgendaI#clearAgenda()public void clearAndCancelAgendaGroup(String name)
Agenda
public void clearAndCancelAgendaGroup(AgendaGroup agendaGroup)
Agenda
public void clearAndCancelActivationGroup(String name)
Agenda
public void clearAndCancelActivationGroup(ActivationGroup activationGroup)
Agenda
public void clearAndCancelRuleFlowGroup(String name)
public void clearAndCancelAndCancel(RuleFlowGroup ruleFlowGroup)
public boolean fireNextItem(AgendaFilter filter)
throws ConsequenceException
Agenda item, skipping items
that are not allowed by the agenda filter.
fireNextItem in interface InternalAgendaConsequenceException - If an error occurs while firing an agenda item.
public void fireActivation(Activation activation)
throws ConsequenceException
fireActivation in interface InternalAgendaactivation - The activation to fire
ConsequenceException - If an error occurs while attempting to fire the consequence.
public boolean fireTimedActivation(Activation activation,
boolean saveForLater)
throws ConsequenceException
fireTimedActivation in interface InternalAgendaConsequenceExceptionpublic void increaseActiveActivations()
increaseActiveActivations in interface InternalAgendapublic void decreaseActiveActivations()
decreaseActiveActivations in interface InternalAgendapublic void increaseDormantActivations()
increaseDormantActivations in interface InternalAgendapublic void decreaseDormantActivations()
decreaseDormantActivations in interface InternalAgendapublic int getActiveActivations()
getActiveActivations in interface InternalAgendapublic int getDormantActivations()
getDormantActivations in interface InternalAgenda
public boolean isRuleActiveInRuleFlowGroup(String ruleflowGroupName,
String ruleName,
long processInstanceId)
InternalAgenda
isRuleActiveInRuleFlowGroup in interface InternalAgenda
public void addRuleFlowGroupListener(String ruleFlowGroup,
RuleFlowGroupListener listener)
InternalAgenda
addRuleFlowGroupListener in interface InternalAgenda
public void removeRuleFlowGroupListener(String ruleFlowGroup,
RuleFlowGroupListener listener)
InternalAgenda
removeRuleFlowGroupListener in interface InternalAgendapublic String getFocusName()
Agenda
public void fireUntilHalt()
InternalAgenda
fireUntilHalt in interface InternalAgendapublic void fireUntilHalt(AgendaFilter agendaFilter)
InternalAgenda
fireUntilHalt in interface InternalAgendaagendaFilter - filters the activations that may fire
public int fireAllRules(AgendaFilter agendaFilter,
int fireLimit)
InternalAgenda
fireAllRules in interface InternalAgendaagendaFilter - the filter on which activations may fire.fireLimit - the maximum number of activations that may fire. If -1, then it will
fire until no more activations exist.
public void notifyHalt()
notifyHalt in interface InternalAgendapublic void halt()
InternalAgenda
halt in interface InternalAgendapublic ConsequenceExceptionHandler getConsequenceExceptionHandler()
public void setActivationsFilter(ActivationsFilter filter)
InternalAgenda
setActivationsFilter in interface InternalAgendapublic ActivationsFilter getActivationsFilter()
InternalAgenda
getActivationsFilter in interface InternalAgenda
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||