|
Drools :: Core 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.drools.core.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 | |
|---|---|
protected int |
activationCounter
|
protected boolean |
fireUntilHalt
|
protected AtomicBoolean |
halt
|
protected KnowledgeHelper |
knowledgeHelper
|
protected static org.slf4j.Logger |
log
|
protected InternalWorkingMemory |
workingMemory
Working memory of this Agenda. |
| Constructor Summary | |
|---|---|
DefaultAgenda()
|
|
DefaultAgenda(InternalRuleBase rb)
Construct. |
|
DefaultAgenda(InternalRuleBase rb,
boolean initMain)
Construct. |
|
| Method Summary | |
|---|---|
void |
activateRuleFlowGroup(InternalRuleFlowGroup group,
long processInstanceId,
String nodeInstanceId)
|
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 |
addActivation(AgendaItem item,
boolean notify)
|
void |
addAgendaGroup(AgendaGroup agendaGroup)
|
void |
addAgendaGroupOnStack(AgendaGroup agendaGroup)
|
void |
addAgendaItemToGroup(AgendaItem item)
|
void |
addEagerRuleAgendaItem(RuleAgendaItem item)
|
void |
addItemToActivationGroup(AgendaItem item)
If the item belongs to an activation group, add it |
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,
TerminalNode rtn)
|
void |
clear()
|
void |
clearAndCancel()
Clears all Activations from the Agenda |
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 |
continueFiring(int fireLimit)
|
boolean |
createActivation(LeftTuple tuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
TerminalNode rtn)
|
AgendaItem |
createAgendaItem(LeftTuple tuple,
int salience,
PropagationContext context,
TerminalNode rtn,
RuleAgendaItem ruleAgendaItem,
InternalAgendaGroup agendaGroup)
|
boolean |
createPostponedActivation(LeftTuple tuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
TerminalNode rtn)
|
RuleAgendaItem |
createRuleAgendaItem(int salience,
PathMemory rs,
TerminalNode rtn)
|
ScheduledAgendaItem |
createScheduledAgendaItem(LeftTuple tuple,
PropagationContext context,
TerminalNode rtn,
InternalAgendaGroup agendaGroup)
|
void |
deactivateRuleFlowGroup(InternalRuleFlowGroup group)
|
void |
deactivateRuleFlowGroup(String name)
Deactivates the RuleFlowGroup with the given name. |
void |
evaluateEagerList()
|
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. |
int |
fireNextItem(AgendaFilter filter,
int fireCount,
int fireLimit)
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 |
AgendaGroup |
getAgendaGroup(String name)
|
AgendaGroup |
getAgendaGroup(String name,
InternalRuleBase ruleBase)
|
AgendaGroup[] |
getAgendaGroups()
|
Map<String,InternalAgendaGroup> |
getAgendaGroupsMap()
|
ConsequenceExceptionHandler |
getConsequenceExceptionHandler()
|
AgendaGroup |
getCurrentAgendaGroup()
|
AgendaGroup |
getFocus()
|
String |
getFocusName()
Returns the name of the agenda group that currently has the focus |
KnowledgeHelper |
getKnowledgeHelper()
|
InternalAgendaGroup |
getMainAgendaGroup()
|
long |
getNextActivationCounter()
|
InternalAgendaGroup |
getNextFocus()
|
RuleFlowGroup |
getRuleFlowGroup(String name)
|
Activation[] |
getScheduledActivations()
|
LinkedList<ScheduledAgendaItem> |
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 |
insertAndStageActivation(AgendaItem activation)
|
boolean |
isDeclarativeAgenda()
|
boolean |
isFireUntilHalt()
|
boolean |
isRuleInstanceAgendaItem(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()
|
RuleAgendaItem |
peekNextRule()
|
void |
readExternal(ObjectInput in)
|
void |
removeActivation(AgendaItem activation)
|
void |
removeEagerRuleAgendaItem(RuleAgendaItem item)
|
void |
removeScheduleItem(ScheduledAgendaItem item)
|
void |
scheduleItem(ScheduledAgendaItem item,
InternalWorkingMemory wm)
|
void |
setActivationsFilter(ActivationsFilter filter)
Sets a filter that prevents activations from being added to the agenda. |
void |
setCurrentAgendaGroup(InternalAgendaGroup agendaGroup)
|
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)
|
int |
sizeOfRuleFlowGroup(String name)
|
void |
stageLeftTuple(RuleAgendaItem ruleAgendaItem,
AgendaItem justified)
|
int |
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 |
|---|
protected static transient org.slf4j.Logger log
protected InternalWorkingMemory workingMemory
protected KnowledgeHelper knowledgeHelper
protected AtomicBoolean halt
protected volatile boolean fireUntilHalt
protected int activationCounter
| 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 void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOException
public RuleAgendaItem createRuleAgendaItem(int salience,
PathMemory rs,
TerminalNode rtn)
createRuleAgendaItem in interface InternalAgendapublic long getNextActivationCounter()
getNextActivationCounter in interface InternalAgenda
public AgendaItem createAgendaItem(LeftTuple tuple,
int salience,
PropagationContext context,
TerminalNode rtn,
RuleAgendaItem ruleAgendaItem,
InternalAgendaGroup agendaGroup)
createAgendaItem in interface InternalAgenda
public ScheduledAgendaItem createScheduledAgendaItem(LeftTuple tuple,
PropagationContext context,
TerminalNode rtn,
InternalAgendaGroup agendaGroup)
createScheduledAgendaItem in interface InternalAgendapublic void setWorkingMemory(InternalWorkingMemory workingMemory)
setWorkingMemory in interface InternalAgendapublic WorkingMemory getWorkingMemory()
Agenda
public void addEagerRuleAgendaItem(RuleAgendaItem item)
addEagerRuleAgendaItem in interface InternalAgendapublic void removeEagerRuleAgendaItem(RuleAgendaItem item)
removeEagerRuleAgendaItem in interface InternalAgenda
public void scheduleItem(ScheduledAgendaItem item,
InternalWorkingMemory wm)
scheduleItem in interface InternalAgendapublic void addItemToActivationGroup(AgendaItem item)
addItemToActivationGroup in interface InternalAgendaitem - public ActivationGroup getStageActivationsGroup()
public void insertAndStageActivation(AgendaItem activation)
insertAndStageActivation in interface InternalAgendapublic boolean addActivation(AgendaItem activation)
InternalAgenda
addActivation in interface InternalAgendapublic 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 int unstageActivations()
public void addActivation(AgendaItem item,
boolean notify)
public void addAgendaItemToGroup(AgendaItem item)
addAgendaItemToGroup in interface InternalAgendapublic 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,
TerminalNode rtn)
createActivation in interface InternalAgenda
public boolean createPostponedActivation(LeftTuple tuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
TerminalNode rtn)
createPostponedActivation in interface InternalAgenda
public void cancelActivation(LeftTuple leftTuple,
PropagationContext context,
InternalWorkingMemory workingMemory,
Activation activation,
TerminalNode rtn)
cancelActivation in interface InternalAgendapublic boolean setFocus(AgendaGroup agendaGroup)
setFocus in interface InternalAgendapublic void setFocus(String name)
Agenda
public void setFocus(PropagationContext ctx,
String name)
public AgendaGroup getFocus()
getFocus in interface InternalAgendapublic InternalAgendaGroup getNextFocus()
getNextFocus in interface InternalAgendapublic RuleAgendaItem peekNextRule()
peekNextRule in interface InternalAgendapublic void setCurrentAgendaGroup(InternalAgendaGroup agendaGroup)
public AgendaGroup getCurrentAgendaGroup()
public AgendaGroup getAgendaGroup(String name)
getAgendaGroup in interface InternalAgendagetAgendaGroup in interface org.kie.api.runtime.rule.Agenda
public AgendaGroup getAgendaGroup(String name,
InternalRuleBase ruleBase)
getAgendaGroup in interface InternalAgendapublic AgendaGroup[] getAgendaGroups()
public Map<String,InternalAgendaGroup> getAgendaGroupsMap()
getAgendaGroupsMap in interface InternalAgendapublic InternalAgendaGroup getMainAgendaGroup()
public AgendaGroup[] getStack()
public LinkedList<AgendaGroup> getStackList()
getStackList in interface InternalAgendapublic void addAgendaGroupOnStack(AgendaGroup agendaGroup)
addAgendaGroupOnStack in interface InternalAgendapublic Map<String,ActivationGroup> getActivationGroupsMap()
getActivationGroupsMap in interface InternalAgendapublic ActivationGroup getActivationGroup(String name)
getActivationGroup in interface InternalAgendagetActivationGroup in interface org.kie.api.runtime.rule.Agendapublic RuleFlowGroup getRuleFlowGroup(String name)
getRuleFlowGroup in interface InternalAgendagetRuleFlowGroup in interface org.kie.api.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 activateRuleFlowGroup(InternalRuleFlowGroup group,
long processInstanceId,
String nodeInstanceId)
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 void deactivateRuleFlowGroup(InternalRuleFlowGroup group)
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<ScheduledAgendaItem> getScheduledActivationsLinkedList()
getScheduledActivationsLinkedList in interface InternalAgendapublic void clear()
clear in interface InternalAgendaclear in interface org.kie.api.runtime.rule.Agendapublic void clearAndCancel()
Agenda
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 int fireNextItem(AgendaFilter filter,
int fireCount,
int fireLimit)
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 evaluateEagerList()
evaluateEagerList in interface InternalAgendapublic int sizeOfRuleFlowGroup(String name)
sizeOfRuleFlowGroup in interface InternalAgenda
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 InternalAgendaConsequenceException
public boolean isRuleInstanceAgendaItem(String ruleflowGroupName,
String ruleName,
long processInstanceId)
InternalAgenda
isRuleInstanceAgendaItem in interface InternalAgendapublic String getFocusName()
Agenda
public boolean isFireUntilHalt()
isFireUntilHalt in interface InternalAgenda
public void stageLeftTuple(RuleAgendaItem ruleAgendaItem,
AgendaItem justified)
stageLeftTuple in interface InternalAgendapublic 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 boolean continueFiring(int fireLimit)
continueFiring in interface InternalAgendapublic 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 InternalAgendapublic KnowledgeHelper getKnowledgeHelper()
|
Drools :: Core 6.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||