Package jadex.rules.rulesystem
Class PriorityAgenda
- java.lang.Object
-
- jadex.rules.rulesystem.AbstractAgenda
-
- jadex.rules.rulesystem.PriorityAgenda
-
- All Implemented Interfaces:
IAgenda
public class PriorityAgenda extends AbstractAgenda
An agenda that sorts activations according to their priority.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.TreeSet
activations
The activations.protected long
count
The current count.protected java.util.Map
counts
The map containing the activation order count (for FIFO in case two activations are equal).protected Activation
next
The next activation (selected by strategy or manually form outside for debugging).-
Fields inherited from class jadex.rules.rulesystem.AbstractAgenda
history, last, listeners, state
-
-
Constructor Summary
Constructors Constructor Description PriorityAgenda()
Create a new agenda.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addActivation(Activation act)
Add a new activation.java.util.Collection
getActivations()
Get the current activations.Activation
getNextActivation()
Get the next activation.boolean
isEmpty()
Test if the agenda is empty.void
removeActivation(Activation act)
Remove an activationvoid
setNextActivation(Activation next)
Set the next activation.-
Methods inherited from class jadex.rules.rulesystem.AbstractAgenda
addAgendaListener, fireRule, getHistory, getLastActivation, getState, isHistoryEnabled, notifyListeners, removeAgendaListener, setHistoryEnabled, toString
-
-
-
-
Field Detail
-
activations
protected java.util.TreeSet activations
The activations.
-
next
protected Activation next
The next activation (selected by strategy or manually form outside for debugging).
-
counts
protected java.util.Map counts
The map containing the activation order count (for FIFO in case two activations are equal).
-
count
protected long count
The current count.
-
-
Method Detail
-
addActivation
public void addActivation(Activation act)
Add a new activation.- Specified by:
addActivation
in classAbstractAgenda
- Parameters:
act
- The activation.
-
removeActivation
public void removeActivation(Activation act)
Remove an activation- Specified by:
removeActivation
in classAbstractAgenda
- Parameters:
act
- The activation.
-
getActivations
public java.util.Collection getActivations()
Get the current activations.- Specified by:
getActivations
in interfaceIAgenda
- Specified by:
getActivations
in classAbstractAgenda
- Returns:
- The activations.
-
isEmpty
public boolean isEmpty()
Test if the agenda is empty.- Specified by:
isEmpty
in interfaceIAgenda
- Specified by:
isEmpty
in classAbstractAgenda
- Returns:
- True if is empty.
-
getNextActivation
public Activation getNextActivation()
Get the next activation.- Specified by:
getNextActivation
in interfaceIAgenda
- Specified by:
getNextActivation
in classAbstractAgenda
- Returns:
- The next activation.
-
setNextActivation
public void setNextActivation(Activation next)
Set the next activation.- Specified by:
setNextActivation
in interfaceIAgenda
- Specified by:
setNextActivation
in classAbstractAgenda
-
-