Package jadex.rules.rulesystem
Class AbstractAgenda
- java.lang.Object
- 
- jadex.rules.rulesystem.AbstractAgenda
 
- 
- All Implemented Interfaces:
- IAgenda
 - Direct Known Subclasses:
- FIFOAgenda,- LIFOAgenda,- PriorityAgenda
 
 public abstract class AbstractAgenda extends java.lang.Object implements IAgenda The agenda contains the activations and can use a conflict resolution strategy for deciding which activation to fire.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.ListhistoryThe history of executed activations (if enabled).protected ActivationlastThe last activation.protected java.util.ListlistenersAgenda listeners (if any).protected intstateThe state.
 - 
Constructor SummaryConstructors Constructor Description AbstractAgenda()Create a new fifo agenda.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddActivation(Activation act)Add a new activation.voidaddAgendaListener(IAgendaListener listener)Add an agenda listener.voidfireRule()Fire one activated rule.abstract java.util.CollectiongetActivations()Get the current activations.java.util.ListgetHistory()Get the history.ActivationgetLastActivation()The last activation.abstract ActivationgetNextActivation()Get the next activation.intgetState()Get the state of the agenda.abstract booleanisEmpty()Test if the agenda is empty.booleanisHistoryEnabled()Get the history mode.protected voidnotifyListeners()Notify all listeners (if any).abstract voidremoveActivation(Activation act)Remove an activationvoidremoveAgendaListener(IAgendaListener listener)Remove an agenda listener.voidsetHistoryEnabled(boolean enabled)Set the history mode.abstract voidsetNextActivation(Activation next)Set the next activation.java.lang.StringtoString()Get the string representation.
 
- 
- 
- 
Field Detail- 
lastprotected Activation last The last activation. Represents the last rule that has been executed (or that is currently executing, if still running).
 - 
listenersprotected java.util.List listeners Agenda listeners (if any).
 - 
historyprotected java.util.List history The history of executed activations (if enabled).
 - 
stateprotected int state The state.
 
- 
 - 
Method Detail- 
fireRulepublic void fireRule() Fire one activated rule.
 - 
addActivationpublic abstract void addActivation(Activation act) Add a new activation.- Parameters:
- act- The activation.
 
 - 
removeActivationpublic abstract void removeActivation(Activation act) Remove an activation- Parameters:
- act- The activation.
 
 - 
getActivationspublic abstract java.util.Collection getActivations() Get the current activations.- Specified by:
- getActivationsin interface- IAgenda
- Returns:
- The activations.
 
 - 
isEmptypublic abstract boolean isEmpty() Test if the agenda is empty.
 - 
getNextActivationpublic abstract Activation getNextActivation() Get the next activation.- Specified by:
- getNextActivationin interface- IAgenda
- Returns:
- The next activation.
 
 - 
setNextActivationpublic abstract void setNextActivation(Activation next) Set the next activation.- Specified by:
- setNextActivationin interface- IAgenda
 
 - 
getStatepublic int getState() Get the state of the agenda. Changes whenever the activation list changes.
 - 
getLastActivationpublic Activation getLastActivation() The last activation. Represents the last rule that has been executed (or that is currently executing, if still running).- Specified by:
- getLastActivationin interface- IAgenda
- Returns:
- null, when no rule has been executed or when fireRule has been called on an empty agenda.
 
 - 
isHistoryEnabledpublic boolean isHistoryEnabled() Get the history mode.- Specified by:
- isHistoryEnabledin interface- IAgenda
 
 - 
setHistoryEnabledpublic void setHistoryEnabled(boolean enabled) Set the history mode.- Specified by:
- setHistoryEnabledin interface- IAgenda
 
 - 
getHistorypublic java.util.List getHistory() Get the history.- Specified by:
- getHistoryin interface- IAgenda
- Returns:
- null, if history not enabled.
 
 - 
addAgendaListenerpublic void addAgendaListener(IAgendaListener listener) Add an agenda listener.- Specified by:
- addAgendaListenerin interface- IAgenda
- Parameters:
- listener- The listener.
 
 - 
removeAgendaListenerpublic void removeAgendaListener(IAgendaListener listener) Remove an agenda listener.- Specified by:
- removeAgendaListenerin interface- IAgenda
- Parameters:
- listener- The listener.
 
 - 
notifyListenersprotected void notifyListeners() Notify all listeners (if any).
 - 
toStringpublic java.lang.String toString() Get the string representation.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- The string representation.
 
 
- 
 
-