当前页面:
在线文档首页 >
JBoss RULES 3.0.6 API 英文版文档
ActivationQueue - JBoss RULES 3.0.6 API 英文版文档
org.drools.common
Class ActivationQueue
java.lang.Object
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 Activation s. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ActivationQueue
public ActivationQueue(int salience)
- Constructs a new
ActivationQueue
for a given saliene value using a
LinkedList
to maintain the queue of Activation
s.
- Parameters:
salience
- The salience queue that the queue is for.
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()