public class MessageObserverEvent extends TriggerEvent implements Observer
TriggerEvent.start()
method to enable the trigger.Modifier and Type | Field and Description |
---|---|
(package private) MessageEventDescriptor[] |
descriptor |
protected MLMessage |
message |
(package private) boolean |
observing |
DEFAULT_PRIORITY, FIRE_EVENT, HIGHEST_PRIORITY
Constructor and Description |
---|
MessageObserverEvent(boolean recurring,
PolicyAgentInterface agent,
MessageEventDescriptor... descriptor)
Construct a new Event that will be triggered when the owner agent receives a message matching
the patterhPairs given in this constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Signals that this event should actually be deleted and not repeated after the next call to
TriggerEvent.delete() . |
void |
delete()
Deletes the event from the internal list of all Events.
|
void |
fireEvent()
Overrides
AbstractEvent.fireEvent() by checking to see if this event has
been TriggerEvent.cancel() 'ed. |
MLMessage |
getMessage() |
void |
update(Observable o,
Object arg)
Override the
update() template
method to call the TriggerEvent.trigger() method iff the update was for a
ML.EVENT_MESSAGE_RECEIVED event and the received message
matches the pattern given in the
constructor . |
hasBeenQueued, hasStarted, hasTriggered, isRecurring, start, trigger
clone, compareTo, getEventType, getID, getOwnerConversationID, getParameter, getPriority, getQueueTime, hasFired, keySet, setOwnerConversationID, setParameter, setParameters, setPriority, setQueueTime, toString
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addObserver, countObservers, deleteObserver
protected MLMessage message
MessageEventDescriptor[] descriptor
boolean observing
public MessageObserverEvent(boolean recurring, PolicyAgentInterface agent, MessageEventDescriptor... descriptor)
TriggerEvent.start()
method to enable the trigger.recurring
- set to true to make this a recurring event that doesn't disappear after one activation (see Event.isRecurring()
)agent
- The agent that owns this Event and will be watched for the matching received messagepatternPairs
- A even-cardinality list interpreted as key/value pairs that will be used to match on the received messageupdate(Observable, Object)
public MLMessage getMessage()
public void update(Observable o, Object arg)
update()
template
method to call the TriggerEvent.trigger()
method iff the update was for a
ML.EVENT_MESSAGE_RECEIVED
event and the received message
matches the pattern given in the
constructor
.
By matches we mean that each key in the pattern exists in the message
and the value of the key in the pattern subsumes the value of the key
in the message.update
in interface Observer
Observer.update(java.util.Observable, java.lang.Object)
public void cancel()
TriggerEvent
TriggerEvent.delete()
.cancel
in class TriggerEvent
public void fireEvent()
TriggerEvent
AbstractEvent.fireEvent()
by checking to see if this event has
been TriggerEvent.cancel()
'ed. If it has not been cancelled, AbstractEvent.fireEvent()
is called.fireEvent
in interface Event
fireEvent
in class TriggerEvent
public void delete()
TriggerEvent
TriggerEvent.recurring
event, it doesn't delete the event unless
TriggerEvent.cancel()
has been previously called.delete
in class TriggerEvent
AbstractEvent.delete()