org.drools.common
Class BinaryHeapQueueAgendaGroup

java.lang.Object
  extended by org.drools.common.BinaryHeapQueueAgendaGroup
All Implemented Interfaces:
Externalizable, Serializable, InternalAgendaGroup, org.drools.runtime.rule.AgendaGroup

public class BinaryHeapQueueAgendaGroup
extends Object
implements InternalAgendaGroup

AgendaGroup implementation that uses a PriorityQueue to prioritise the evaluation of added ActivationQueues. The AgendaGroup also maintains a Map of ActivationQueues for requested salience values.

See Also:
PriorityQueue, ActivationQueue, Serialized Form

Field Summary
 
Fields inherited from interface org.drools.spi.AgendaGroup
MAIN
 
Constructor Summary
BinaryHeapQueueAgendaGroup()
          Construct an AgendaGroup with the given name.
BinaryHeapQueueAgendaGroup(String name, InternalRuleBase ruleBase)
           
 
Method Summary
 void add(Activation activation)
           
 void clear()
           
 boolean equal(Object object)
           
 Activation[] getActivations()
           
 Activation[] getAndClear()
           
 PropagationContext getAutoFocusActivator()
           
 String getName()
           
 Activation getNext()
           
 int hashCode()
           
 boolean isActive()
           
 boolean isEmpty()
          Iterates a PriorityQueue removing empty entries until it finds a populated entry and return true, otherwise it returns false;
 void readExternal(ObjectInput in)
           
 void remove(AgendaItem agendaItem)
           
 void setActive(boolean activate)
           
 void setAutoFocusActivator(PropagationContext autoFocusActivator)
           
 void setFocus()
           
 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

BinaryHeapQueueAgendaGroup

public BinaryHeapQueueAgendaGroup()
Construct an AgendaGroup with the given name.

Parameters:
name - The name.

BinaryHeapQueueAgendaGroup

public BinaryHeapQueueAgendaGroup(String name,
                                  InternalRuleBase ruleBase)
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

getName

public String getName()
Specified by:
getName in interface org.drools.runtime.rule.AgendaGroup

clear

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

getAndClear

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

size

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

add

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

getNext

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

isActive

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

setActive

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

setAutoFocusActivator

public void setAutoFocusActivator(PropagationContext autoFocusActivator)

getAutoFocusActivator

public PropagationContext getAutoFocusActivator()

isEmpty

public boolean isEmpty()
Iterates a PriorityQueue removing empty entries until it finds a populated entry and return true, otherwise it returns false;

Parameters:
priorityQueue -
Returns:

getActivations

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

toString

public String toString()
Overrides:
toString in class Object

equal

public boolean equal(Object object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

setFocus

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

remove

public void remove(AgendaItem agendaItem)
Specified by:
remove in interface InternalAgendaGroup


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