站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 3.0.6 API 英文版文档

ActivationQueue - JBoss RULES 3.0.6 API 英文版文档


org.drools.common
Class ActivationQueue

java.lang.Object
  extended by org.drools.common.ActivationQueue
All Implemented Interfaces:
java.lang.Comparable

public class ActivationQueue
extends java.lang.Object
implements java.lang.Comparable

A LIFO Activation queue based on a LinkedList. Each salience rule value is assigned an ActivationQueue, the salience number is used to prioritise the ActivationQueue within the PriorityQueue. Each Activation in the queue must implement the LinkedListNode interface. Each added Activation is placed at the end of the queue; however Activations can be removed from the end or from any point in queue.

ActivationQueue implements Comparable, based on the salience value, this allows the queue to be correctly prioritised by salience value on the PriorityQueue.

When an ActivationQueue is placed onto a PriorityQueue it is considered active, when it is removed it is inactivate. This ensures that an active ActivationQueue placed onto a PriorityQueue cannot be re-added.

See Also:
LinkedList, PriorityQueue

Constructor Summary
ActivationQueue(int salience)
          Constructs a new ActivationQueue for a given saliene value using a LinkedList to maintain the queue of Activations.
 
Method Summary
 void add(Activation activation)
          Add an Activation to the end of the queue
 int compareTo(java.lang.Object object)
           
 Activation[] getActivations()
           
 LinkedListNode getFirst()
           
 int getSalience()
          Returns the salience.
 boolean isActive()
          Has the queue been placed onto a PriorityQueue, if so this returns true until it is removed.
 boolean isEmpty()
          Returns true if there are no Activations on the queue.
 Activation remove()
          Remove the Activaton at the end of the queue.
 void remove(Activation activation)
          Remove the given Activation from its place in the queue.
 void setActivated(boolean active)
          Specifies whether the queue has been placed onto a PriorityQueue.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivationQueue

public ActivationQueue(int salience)
Constructs a new ActivationQueue for a given saliene value using a LinkedList to maintain the queue of Activations.

Parameters:
salience - The salience queue that the queue is for.
Method Detail

getSalience

public int getSalience()
Returns the salience.

Returns:
The salience queue that the queue is for.

isActive

public boolean isActive()
Has the queue been placed onto a PriorityQueue, if so this returns true until it is removed.

Returns:
boolean

setActivated

public void setActivated(boolean active)
Specifies whether the queue has been placed onto a PriorityQueue. If it has it is set to true, else it is set to false.

Parameters:
active - boolena value that sets the activate state.

compareTo

public int compareTo(java.lang.Object object)
Specified by:
compareTo in interface java.lang.Comparable

add

public void add(Activation activation)
Add an Activation to the end of the queue

Parameters:
activation - the Activation to be placed onto the queue

remove

public Activation remove()
Remove the Activaton at the end of the queue.

Returns:
The last Activation.

remove

public void remove(Activation activation)
Remove the given Activation from its place in the queue. This results in the previous Activation being linked to the next activation.

Parameters:
activation - The Activation to be removed.

getFirst

public LinkedListNode getFirst()

getActivations

public Activation[] getActivations()

isEmpty

public boolean isEmpty()
Returns true if there are no Activations on the queue.

Returns:
boolean value indicating the empty stae of the queue,

size

public int size()