|
||||||||||
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 Activation s |
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)
|
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. |
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)
workingMemory
- The WorkingMemory
of this agenda.conflictResolver
- The conflict resolver.public DefaultAgenda(InternalRuleBase rb, boolean initMain)
workingMemory
- The WorkingMemory
of this agenda.conflictResolver
- The conflict resolver.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 InternalAgenda
public void setWorkingMemory(InternalWorkingMemory workingMemory)
setWorkingMemory
in interface InternalAgenda
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public WorkingMemory getWorkingMemory()
Agenda
public void scheduleItem(ScheduledAgendaItem item, InternalWorkingMemory wm)
scheduleItem
in interface InternalAgenda
item
- The item to schedule.public ActivationGroup getStageActivationsGroup()
public boolean addActivation(AgendaItem activation)
InternalAgenda
addActivation
in interface InternalAgenda
public void setActiveActivations(int activeActivations)
public void setDormantActivations(int dormantActivations)
public boolean isDeclarativeAgenda()
isDeclarativeAgenda
in interface InternalAgenda
public void removeActivation(AgendaItem activation)
removeActivation
in interface InternalAgenda
public void modifyActivation(AgendaItem activation, boolean previouslyActive)
modifyActivation
in interface InternalAgenda
public void clearAndCancelStagedActivations()
public void unstageActivations()
public void removeScheduleItem(ScheduledAgendaItem item)
removeScheduleItem
in interface InternalAgenda
public 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 void cancelActivation(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory, Activation activation, RuleTerminalNode rtn)
cancelActivation
in interface InternalAgenda
public 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 InternalAgenda
getAgendaGroup
in interface org.drools.runtime.rule.Agenda
public 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 InternalAgenda
getActivationGroup
in interface org.drools.runtime.rule.Agenda
public RuleFlowGroup getRuleFlowGroup(String name)
getRuleFlowGroup
in interface InternalAgenda
getRuleFlowGroup
in interface org.drools.runtime.rule.Agenda
public void activateRuleFlowGroup(String name)
Agenda
RuleFlowGroup
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)
Agenda
RuleFlowGroup
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)
Agenda
RuleFlowGroup
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()
Agenda
AgendGroups in the focus stack returning the total number of Activation
s
- Returns:
- total number of
Activation
s on the focus stack
public int agendaSize()
Agenda
Activation
s
public Activation[] getActivations()
public Activation[] getScheduledActivations()
public LinkedList getScheduledActivationsLinkedList()
getScheduledActivationsLinkedList
in interface InternalAgenda
public void clear()
clear
in interface InternalAgenda
clear
in interface org.drools.runtime.rule.Agenda
public 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 InternalAgenda
ConsequenceException
- If an error occurs while firing an agenda item.public void fireActivation(Activation activation) throws ConsequenceException
fireActivation
in interface InternalAgenda
workingMemory
- The working memory context.
ConsequenceException
- If an error occurs while attempting to fire the consequence.public void increaseActiveActivations()
increaseActiveActivations
in interface InternalAgenda
public void decreaseActiveActivations()
decreaseActiveActivations
in interface InternalAgenda
public void increaseDormantActivations()
increaseDormantActivations
in interface InternalAgenda
public void decreaseDormantActivations()
decreaseDormantActivations
in interface InternalAgenda
public int getActiveActivations()
getActiveActivations
in interface InternalAgenda
public 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 InternalAgenda
public String getFocusName()
Agenda
public void fireUntilHalt()
InternalAgenda
fireUntilHalt
in interface InternalAgenda
public void fireUntilHalt(AgendaFilter agendaFilter)
InternalAgenda
fireUntilHalt
in interface InternalAgenda
agendaFilter
- filters the activations that may firepublic int fireAllRules(AgendaFilter agendaFilter, int fireLimit)
InternalAgenda
fireAllRules
in interface InternalAgenda
agendaFilter
- 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 InternalAgenda
public void halt()
InternalAgenda
halt
in interface InternalAgenda
public ConsequenceExceptionHandler getConsequenceExceptionHandler()
public void setActivationsFilter(ActivationsFilter filter)
InternalAgenda
setActivationsFilter
in interface InternalAgenda
public ActivationsFilter getActivationsFilter()
InternalAgenda
getActivationsFilter
in interface InternalAgenda
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |