public class EventCreationObserver extends ObserverAdapter
Modifier and Type | Field and Description |
---|---|
private boolean |
DEBUG |
private SemanticInterpreterBehaviour |
interpreter
The interpreter to submit the subscribed event when triggered.
|
private boolean |
isOneShot
Indicates if the observer should be done only one time or not
|
private SemanticRepresentation |
subscribedEvent
The formula that represents the subscribed internal event
|
awakeningThread, DIRECTLY_OBSERVED, lastQueryResultOnDirectlyObserved, myKBase, observedFormulas, timeout, timeoutDisabled, updatedOnce, wakeUpDate
Constructor and Description |
---|
EventCreationObserver(KBase kbase,
Formula observedFormula,
Formula subscribedEvent,
SemanticInterpreterBehaviour interpreter)
Creates a new Observer
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
Formula subscribedEvent,
SemanticInterpreterBehaviour interpreter,
boolean isOneShot)
Creates a new Observer
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
Formula subscribedEvent,
SemanticInterpreterBehaviour interpreter,
boolean isOneShot,
Date wakeUpDate)
Creates a new Observer
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
Formula subscribedEvent,
SemanticInterpreterBehaviour interpreter,
boolean isOneShot,
Long timeout)
Creates a new Observer
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
Formula subscribedEvent,
SemanticInterpreterBehaviour interpreter,
Date wakeUpDate)
Creates a new Observer
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
Formula subscribedEvent,
SemanticInterpreterBehaviour interpreter,
Long timeout)
Creates a new Observer
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
SemanticRepresentation subscribedEvent,
SemanticInterpreterBehaviour interpreter,
boolean isOneShot)
Creates a new Observer
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
SemanticRepresentation subscribedEvent,
SemanticInterpreterBehaviour interpreter,
boolean isOneShot,
Date wakeUpDate)
Creates a new Observer with a timeout
|
EventCreationObserver(KBase kbase,
Formula observedFormula,
SemanticRepresentation subscribedEvent,
SemanticInterpreterBehaviour interpreter,
boolean isOneShot,
Long timeout)
Creates a new Observer with a timeout
|
Modifier and Type | Method and Description |
---|---|
void |
action(QueryResult value)
Interprets the subscribed event and removes the suitable
observer if it should be done only one time (isOneShot = true).
|
Formula |
getSubscribedEvent()
Returns the subscribedEvent.
|
void |
timeout()
Timeout method called by the awakening behaviour that is
triggered at the end of the timeout or at the wakeUpDate.
|
getObservedFormula, update
addFormula, disableTimeout, getMyKBase, getObservedFormulas, getTimeOut, getWakeUpDate, isEnabledTimeout, toString
private final boolean DEBUG
private SemanticRepresentation subscribedEvent
private SemanticInterpreterBehaviour interpreter
private boolean isOneShot
public EventCreationObserver(KBase kbase, Formula observedFormula, SemanticRepresentation subscribedEvent, SemanticInterpreterBehaviour interpreter, boolean isOneShot)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to trigger (SemanticRepresentation)interpreter
- the interpreter to submit the subscribed eventisOneShot
- should the observer be done only one time or notpublic EventCreationObserver(KBase kbase, Formula observedFormula, Formula subscribedEvent, SemanticInterpreterBehaviour interpreter, boolean isOneShot)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to trigger (Formula)interpreter
- the interpreter to submit the subscribed eventisOneShot
- should the observer be done only one time or notpublic EventCreationObserver(KBase kbase, Formula observedFormula, Formula subscribedEvent, SemanticInterpreterBehaviour interpreter)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to triggerinterpreter
- the interpreter to submit the subscribed eventpublic EventCreationObserver(KBase kbase, Formula observedFormula, SemanticRepresentation subscribedEvent, SemanticInterpreterBehaviour interpreter, boolean isOneShot, Long timeout)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to trigger (SemanticRepresentation)interpreter
- the interpreter to submit the subscribed eventisOneShot
- should the observer be done only one time or nottimeout
- the delay (Long) before triggering the timeout methodpublic EventCreationObserver(KBase kbase, Formula observedFormula, Formula subscribedEvent, SemanticInterpreterBehaviour interpreter, boolean isOneShot, Long timeout)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to trigger (Formula)interpreter
- the interpreter to submit the subscribed eventisOneShot
- should the observer be done only one time or nottimeout
- the delay (Long) before triggering the timeout methodpublic EventCreationObserver(KBase kbase, Formula observedFormula, Formula subscribedEvent, SemanticInterpreterBehaviour interpreter, Long timeout)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to triggerinterpreter
- the interpreter to submit the subscribed eventtimeout
- the delay (Long) before triggering the timeout methodpublic EventCreationObserver(KBase kbase, Formula observedFormula, SemanticRepresentation subscribedEvent, SemanticInterpreterBehaviour interpreter, boolean isOneShot, Date wakeUpDate)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to trigger (SemanticRepresentation)interpreter
- the interpreter to submit the subscribed eventisOneShot
- should the observer be done only one time or notwakeUpDate
- the date (java.util.Date) when to trigger the timeout methodpublic EventCreationObserver(KBase kbase, Formula observedFormula, Formula subscribedEvent, SemanticInterpreterBehaviour interpreter, boolean isOneShot, Date wakeUpDate)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to trigger (Formula)interpreter
- the interpreter to submit the subscribed eventisOneShot
- should the observer be done only one time or notwakeUpDate
- the date (java.util.Date) when to trigger the timeout methodpublic EventCreationObserver(KBase kbase, Formula observedFormula, Formula subscribedEvent, SemanticInterpreterBehaviour interpreter, Date wakeUpDate)
agent
- The agent that has this observer on its belief baseobservedFormula
- the formula to observesubscribedEvent
- the event to triggerinterpreter
- the interpreter to submit the subscribed eventwakeUpDate
- the date (java.util.Date) when to trigger the timeout methodpublic Formula getSubscribedEvent()
public void action(QueryResult value)
action
in class ObserverAdapter
value
- list of MatchResults which represents the last
queried value of the observed formula.public void timeout()
Observer