Drools :: Core 6.0.0.Beta5

org.drools.core.common
Class RuleFlowGroupImpl

java.lang.Object
  extended by org.drools.core.common.RuleFlowGroupImpl
All Implemented Interfaces:
InternalAgendaGroup, InternalRuleFlowGroup, org.kie.api.runtime.rule.AgendaGroup, org.kie.api.runtime.rule.RuleFlowGroup

public class RuleFlowGroupImpl
extends Object
implements InternalRuleFlowGroup, InternalAgendaGroup

Implementation of a RuleFlowGroup that collects activations of rules of this ruleflow-group. If this group is activated, all its activations are added to the agenda. As long as this group is active, its activations are added to the agenda. Deactivating the group removes all its activations from the agenda and collects them until it is activated again. By default, RuleFlowGroups are automatically deactivated when there are no more activations in the RuleFlowGroup. However, this can be configured.


Nested Class Summary
static class RuleFlowGroupImpl.DeactivateCallback
           
 
Field Summary
 
Fields inherited from interface org.drools.core.spi.AgendaGroup
MAIN
 
Constructor Summary
RuleFlowGroupImpl()
           
RuleFlowGroupImpl(String name, boolean active, boolean autoDeactivate)
           
RuleFlowGroupImpl(String name, InternalRuleBase rbase)
          Construct a RuleFlowGroupImpl with the given name.
 
Method Summary
 void add(Activation activation)
           
 void addActivation(Activation activation)
           
 void addNodeInstance(Long processInstanceId, String nodeInstanceId)
           
 void addRuleFlowGroupListener(RuleFlowGroupListener listener)
           
 void clear()
           
 void deactivateIfEmpty()
          Checks if this ruleflow group is active and should automatically deactivate.
 boolean equals(Object object)
           
 long getActivatedForRecency()
           
 Activation[] getActivations()
           
 Activation[] getAndClear()
           
 PropagationContext getAutoFocusActivator()
           
 long getClearedForRecency()
           
 String getName()
           
 Map<Long,String> getNodeInstances()
           
 InternalWorkingMemory getWorkingMemory()
           
 int hashCode()
           
 void hasRuleFlowListener(boolean hasRuleFlowLister)
           
 boolean isActive()
           
 boolean isAutoDeactivate()
           
 boolean isEmpty()
           
 boolean isRuleFlowListener()
           
 Iterator iterator()
           
 void notifyRuleFlowGroupListeners()
           
 Activation peek()
           
 Activation remove()
           
 void remove(Activation activation)
           
 void removeActivation(Activation activation)
           
 void removeNodeInstance(Long processInstanceId, String nodeInstanceId)
           
 void removeRuleFlowGroupListener(RuleFlowGroupListener listener)
           
 void setActivatedForRecency(long recency)
           
 void setActive(boolean active)
           
 void setAutoDeactivate(boolean autoDeactivate)
          Sets the auto-deactivate status of this RuleFlowGroup.
 void setAutoFocusActivator(PropagationContext ctx)
           
 void setClearedForRecency(long recency)
           
 void setFocus()
           
 void setWorkingMemory(InternalWorkingMemory workingMemory)
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuleFlowGroupImpl

public RuleFlowGroupImpl()

RuleFlowGroupImpl

public RuleFlowGroupImpl(String name,
                         InternalRuleBase rbase)
Construct a RuleFlowGroupImpl with the given name.

Parameters:
name - The RuleFlowGroup name.

RuleFlowGroupImpl

public RuleFlowGroupImpl(String name,
                         boolean active,
                         boolean autoDeactivate)
Method Detail

getName

public String getName()
Specified by:
getName in interface org.kie.api.runtime.rule.AgendaGroup
Specified by:
getName in interface org.kie.api.runtime.rule.RuleFlowGroup

setWorkingMemory

public void setWorkingMemory(InternalWorkingMemory workingMemory)
Specified by:
setWorkingMemory in interface InternalAgendaGroup

getWorkingMemory

public InternalWorkingMemory getWorkingMemory()
Specified by:
getWorkingMemory in interface InternalAgendaGroup

hasRuleFlowListener

public void hasRuleFlowListener(boolean hasRuleFlowLister)
Specified by:
hasRuleFlowListener in interface InternalAgendaGroup

isRuleFlowListener

public boolean isRuleFlowListener()
Specified by:
isRuleFlowListener in interface InternalAgendaGroup

remove

public Activation remove()
Specified by:
remove in interface InternalAgendaGroup

peek

public Activation peek()
Specified by:
peek in interface InternalAgendaGroup

setActive

public void setActive(boolean active)
Specified by:
setActive in interface InternalAgendaGroup

isActive

public boolean isActive()
Returns:
boolean value indicating if the AgendaGroup is active and thus being evaluated.

setAutoFocusActivator

public void setAutoFocusActivator(PropagationContext ctx)

getAutoFocusActivator

public PropagationContext getAutoFocusActivator()

isAutoDeactivate

public boolean isAutoDeactivate()
Specified by:
isAutoDeactivate in interface InternalAgendaGroup

setAutoDeactivate

public void setAutoDeactivate(boolean autoDeactivate)
Description copied from interface: InternalAgendaGroup
Sets the auto-deactivate status of this RuleFlowGroup. If this is set to true, an active RuleFlowGroup automatically deactivates if it has no more activations. If it had no activations when it was activated, it will be deactivated immediately.

Specified by:
setAutoDeactivate in interface InternalAgendaGroup

clear

public void clear()
Specified by:
clear in interface InternalAgendaGroup
Specified by:
clear in interface org.kie.api.runtime.rule.AgendaGroup
Specified by:
clear in interface org.kie.api.runtime.rule.RuleFlowGroup

setFocus

public void setFocus()
Specified by:
setFocus in interface org.kie.api.runtime.rule.AgendaGroup

getAndClear

public Activation[] getAndClear()
Specified by:
getAndClear in interface InternalAgendaGroup

add

public void add(Activation activation)
Specified by:
add in interface InternalAgendaGroup

addActivation

public void addActivation(Activation activation)

remove

public void remove(Activation activation)
Specified by:
remove in interface InternalAgendaGroup

removeActivation

public void removeActivation(Activation activation)

deactivateIfEmpty

public void deactivateIfEmpty()
Checks if this ruleflow group is active and should automatically deactivate. If the queue is empty, it deactivates the group.


addRuleFlowGroupListener

public void addRuleFlowGroupListener(RuleFlowGroupListener listener)

removeRuleFlowGroupListener

public void removeRuleFlowGroupListener(RuleFlowGroupListener listener)

notifyRuleFlowGroupListeners

public void notifyRuleFlowGroupListeners()

isEmpty

public boolean isEmpty()
Returns:
boolean value indicating if this AgendaGroup is empty or not

getActivations

public Activation[] getActivations()
Specified by:
getActivations in interface InternalAgendaGroup
Returns:
An immutable Collection of all the activations in the AgendaGroup

iterator

public Iterator iterator()

addNodeInstance

public void addNodeInstance(Long processInstanceId,
                            String nodeInstanceId)
Specified by:
addNodeInstance in interface InternalAgendaGroup

removeNodeInstance

public void removeNodeInstance(Long processInstanceId,
                               String nodeInstanceId)
Specified by:
removeNodeInstance in interface InternalAgendaGroup

getNodeInstances

public Map<Long,String> getNodeInstances()
Specified by:
getNodeInstances in interface InternalAgendaGroup

setActivatedForRecency

public void setActivatedForRecency(long recency)
Specified by:
setActivatedForRecency in interface InternalAgendaGroup

getActivatedForRecency

public long getActivatedForRecency()
Specified by:
getActivatedForRecency in interface InternalAgendaGroup

setClearedForRecency

public void setClearedForRecency(long recency)
Specified by:
setClearedForRecency in interface InternalAgendaGroup

getClearedForRecency

public long getClearedForRecency()
Specified by:
getClearedForRecency in interface InternalAgendaGroup

toString

public String toString()
Overrides:
toString in class Object

size

public int size()
Returns:
The int total number of activations

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Drools :: Core 6.0.0.Beta5

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.