public class DependantSocialCommitment extends SocialCommitment implements Observer
Title: CASA Agent Infrastructure
Description:
Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Company: Knowledge Science Group, University of Calgary
A social commitment that is dependent upon another social commitment (the 'guard') to 'fire' (be executed). This is implemented by the observer pattern, where this commitment observes the SCObservable commitment, which will call this commitment's update() method, which will set it's READY status to "true". (SCDependent commitments are initialized with their READY status to false.)SocialCommitment.CommitmentState
Modifier and Type | Field and Description |
---|---|
private SocialCommitment |
guard
The agent we're observing
|
private TriggerEvent |
guardEvent |
private PerformDescriptor |
subjectStatus
The status returned by the observed agent, guard
|
DEFAULT_TIMEOUT, MASK_ALL, MASK_EXECUTABLE, MASK_OBLIGATED, MASK_OUTSTANDING
Constructor and Description |
---|
DependantSocialCommitment(PolicyAgentInterface agent,
SocialCommitment guard,
URLDescriptor newDebtor,
URLDescriptor newCreditor,
String newPerformative,
Act newAct,
Event event,
Action action) |
DependantSocialCommitment(PolicyAgentInterface agent,
SocialCommitment guard,
URLDescriptor newDebtor,
URLDescriptor newCreditor,
String newPerformative,
Act newAct,
Event event,
Action action,
Event... events) |
Modifier and Type | Method and Description |
---|---|
protected StringBuffer |
attributesString()
Creates a
StringBuffer object and fills it with some attributes of
this social commitment. |
private static Event[] |
enbiggen(Event e,
Event... events) |
protected void |
enterTerminalState()
Called whenever the SocialCommitment enters a terminal state (FILFILLED, CANCELED, or VIOLATED).
|
PerformDescriptor |
getGuardStatus() |
void |
setGuard(SocialCommitment newGuard)
Sets the guard and sets this commitment's READY state to false (awaiting the guard's execution) if the
guard is non-null, READY goes to true otherwise.
|
void |
update(Observable o,
Object arg)
TODO update this doc
Updates the state of this commitment based on the event that has occurred.
|
addObserver, clone, compareTo, designateCanceled, designateFulfilled, designateStarted, equals, execute, flagSet, getAct, getAction, getCreatedTime, getCreditor, getDebtor, getEndTime, getEvent, getEventOfType, getFlags, getMessage, getOwnerConversationID, getParameter, getPerformative, getPriority, getSerialNumber, getState, hasEventOfType, hashCode, keySet, meetsMask, notifyObservers, retractTimeoutEvent, setDebtor, setMarked, setNotDebtor, setParameter, setPersistent, setPriority, setShared, toString, toString
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
private SocialCommitment guard
private PerformDescriptor subjectStatus
private TriggerEvent guardEvent
public DependantSocialCommitment(PolicyAgentInterface agent, SocialCommitment guard, URLDescriptor newDebtor, URLDescriptor newCreditor, String newPerformative, Act newAct, Event event, Action action)
guard
- newDebtor
- newCreditor
- newPerformative
- newAct
- msg
- action
- public DependantSocialCommitment(PolicyAgentInterface agent, SocialCommitment guard, URLDescriptor newDebtor, URLDescriptor newCreditor, String newPerformative, Act newAct, Event event, Action action, Event... events)
public void update(Observable o, Object arg)
SocialCommitment
update
in interface Observer
update
in class SocialCommitment
EventObserver.notifyEventOccurred(java.lang.String,
casa.event.Event, java.lang.Object)
protected StringBuffer attributesString()
SocialCommitment
StringBuffer
object and fills it with some attributes of
this social commitment. This method should be overridden in subclasses to
give more information.attributesString
in class SocialCommitment
public PerformDescriptor getGuardStatus()
public void setGuard(SocialCommitment newGuard)
newGuard
- The guardprotected void enterTerminalState()
enterTerminalState
in class SocialCommitment