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.TreeSetactivationsThe activations.protected longcountThe current count.protected java.util.MapcountsThe map containing the activation order count (for FIFO in case two activations are equal).protected ActivationnextThe 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 voidaddActivation(Activation act)Add a new activation.java.util.CollectiongetActivations()Get the current activations.ActivationgetNextActivation()Get the next activation.booleanisEmpty()Test if the agenda is empty.voidremoveActivation(Activation act)Remove an activationvoidsetNextActivation(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:
addActivationin classAbstractAgenda- Parameters:
act- The activation.
-
removeActivation
public void removeActivation(Activation act)
Remove an activation- Specified by:
removeActivationin classAbstractAgenda- Parameters:
act- The activation.
-
getActivations
public java.util.Collection getActivations()
Get the current activations.- Specified by:
getActivationsin interfaceIAgenda- Specified by:
getActivationsin classAbstractAgenda- Returns:
- The activations.
-
isEmpty
public boolean isEmpty()
Test if the agenda is empty.- Specified by:
isEmptyin interfaceIAgenda- Specified by:
isEmptyin classAbstractAgenda- Returns:
- True if is empty.
-
getNextActivation
public Activation getNextActivation()
Get the next activation.- Specified by:
getNextActivationin interfaceIAgenda- Specified by:
getNextActivationin classAbstractAgenda- Returns:
- The next activation.
-
setNextActivation
public void setNextActivation(Activation next)
Set the next activation.- Specified by:
setNextActivationin interfaceIAgenda- Specified by:
setNextActivationin classAbstractAgenda
-
-