org.drools.common
Class RuleFlowGroupImpl

java.lang.Object
  extended by org.drools.common.RuleFlowGroupImpl
All Implemented Interfaces:
InternalRuleFlowGroup, org.drools.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 equal(Object object)
           
 String getName()
           
 Map<Long,String> getNodeInstances()
           
 InternalWorkingMemory getWorkingMemory()
           
 int hashCode()
           
 boolean isActive()
           
 boolean isAutoDeactivate()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 void notifyRuleFlowGroupListeners()
           
 void readExternal(ObjectInput in)
           
 void removeActivation(Activation activation)
           
 void removeNodeInstance(Long processInstanceId, String nodeInstanceId)
           
 void removeRuleFlowGroupListener(RuleFlowGroupListener listener)
           
 void setActive(boolean active)
          Activates or deactivates this RuleFlowGroup.
 void setAutoDeactivate(boolean autoDeactivate)
          Sets the auto-deactivate status of this RuleFlowGroup.
 void setWorkingMemory(InternalWorkingMemory workingMemory)
           
 int size()
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, 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

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Throws:
IOException

getName

public String getName()
Specified by:
getName in interface org.drools.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.drools.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()

iterator

public Iterator iterator()

toString

public String toString()
Overrides:
toString in class Object

equal

public boolean equal(Object object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

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


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.