Drools :: Core 6.0.0.Alpha9

org.drools.common
Class RuleFlowGroupImpl

java.lang.Object
  extended by org.drools.common.RuleFlowGroupImpl
All Implemented Interfaces:
Iterable<ActivationNode>, InternalRuleFlowGroup, org.kie.runtime.rule.RuleFlowGroup

public class RuleFlowGroupImpl
extends Object
implements InternalRuleFlowGroup

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
           
 
Constructor Summary
RuleFlowGroupImpl()
           
RuleFlowGroupImpl(String name)
          Construct a RuleFlowGroupImpl with the given name.
RuleFlowGroupImpl(String name, boolean active, boolean autoDeactivate)
           
 
Method Summary
 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()
           
 long getClearedForRecency()
           
 String getName()
           
 Map<Long,String> getNodeInstances()
           
 InternalWorkingMemory getWorkingMemory()
           
 int hashCode()
           
 boolean isActive()
           
 boolean isAutoDeactivate()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 void notifyRuleFlowGroupListeners()
           
 void removeActivation(Activation activation)
           
 void removeNodeInstance(Long processInstanceId, String nodeInstanceId)
           
 void removeRuleFlowGroupListener(RuleFlowGroupListener listener)
           
 void setActivatedForRecency(long recency)
           
 void setActive(boolean active)
          Activates or deactivates this RuleFlowGroup.
 void setAutoDeactivate(boolean autoDeactivate)
          Sets the auto-deactivate status of this RuleFlowGroup.
 void setClearedForRecency(long recency)
           
 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)
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.runtime.rule.RuleFlowGroup

setWorkingMemory

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

getWorkingMemory

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

setActive

public void setActive(boolean active)
Description copied from interface: InternalRuleFlowGroup
Activates or deactivates this RuleFlowGroup. When activating, all activations of this RuleFlowGroup are added to the agenda. As long as the RuleFlowGroup remains active, its activations are automatically added to the agenda. When deactivating, all activations of this RuleFlowGroup are removed to the agenda. As long as the RuleFlowGroup remains deactive, its activations are not added to the agenda.

Specified by:
setActive in interface InternalRuleFlowGroup

isActive

public boolean isActive()
Specified by:
isActive in interface InternalRuleFlowGroup

isAutoDeactivate

public boolean isAutoDeactivate()

setAutoDeactivate

public void setAutoDeactivate(boolean autoDeactivate)
Description copied from interface: RuleFlowGroup
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.


clear

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

size

public int size()

addActivation

public void addActivation(Activation activation)
Specified by:
addActivation in interface InternalRuleFlowGroup

removeActivation

public void removeActivation(Activation activation)
Specified by:
removeActivation in interface InternalRuleFlowGroup

deactivateIfEmpty

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

Specified by:
deactivateIfEmpty in interface InternalRuleFlowGroup

addRuleFlowGroupListener

public void addRuleFlowGroupListener(RuleFlowGroupListener listener)
Specified by:
addRuleFlowGroupListener in interface InternalRuleFlowGroup

removeRuleFlowGroupListener

public void removeRuleFlowGroupListener(RuleFlowGroupListener listener)
Specified by:
removeRuleFlowGroupListener in interface InternalRuleFlowGroup

notifyRuleFlowGroupListeners

public void notifyRuleFlowGroupListeners()

isEmpty

public boolean isEmpty()

getActivations

public Activation[] getActivations()
Specified by:
getActivations in interface InternalRuleFlowGroup

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable<ActivationNode>

addNodeInstance

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

removeNodeInstance

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

getNodeInstances

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

setActivatedForRecency

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

getActivatedForRecency

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

setClearedForRecency

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

getClearedForRecency

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

toString

public String toString()
Overrides:
toString in class Object

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.Alpha9

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