public abstract class ObservingAgentUI extends Object implements AgentUI
"(ui.monitor ...)"
lisp command."(ui.history...)"
lisp command, which is supported via the evalWithHistory(String)
method.Modifier and Type | Field and Description |
---|---|
protected TransientAgent |
agent
The agent that "owns" this interface.
|
private LinkedList<String> |
history |
private String |
historyAccess |
private int |
MAX_HISTORY |
protected boolean |
showEvents |
protected boolean |
showInfo |
protected boolean |
showMessages |
protected boolean |
showTrace |
protected boolean |
showUnknown |
private static CasaLispOperator |
UI_HISTORY
Lisp operator: (UI_HISTORY )
Print or access the agent history |
private static CasaLispOperator |
UI_MONITOR
Lisp operator: (UI_MONITOR :EVENTS [bool] :MESSAGES [bool] :INFO [bool] :UNKNOWN [bool] :TRACE [bool])
Turn on or off display of various notification message types from the agent. |
TYPE_ANY, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_INT, TYPE_STRING
Modifier | Constructor and Description |
---|---|
protected |
ObservingAgentUI(TransientAgent agent) |
Modifier and Type | Method and Description |
---|---|
protected Status |
eval(String buf)
Evaluate a command string.
|
protected Status |
evalWithHistory(String buf)
Evaluate a command string, taking into account the
"(ui.history...)" lisp command. |
protected void |
handleEvent(String event,
Object obj)
Handle an event notification, by printing it to the ui, depending on the values set in the
"(ui.monitor ...)" lisp command. |
protected void |
handleOther(Object arg)
Handle a non-event notification
|
protected void |
printlnObject(Object obj)
A utility method to safely print out an object.
|
void |
update(Observable o,
Object arg)
Defers to
handleEvent(String, Object) if arg is an
ObserverNotification , or handleOther(Object) otherwise. |
protected TransientAgent agent
protected boolean showEvents
protected boolean showMessages
protected boolean showUnknown
protected boolean showInfo
protected boolean showTrace
private LinkedList<String> history
private int MAX_HISTORY
private String historyAccess
private static final CasaLispOperator UI_MONITOR
private static final CasaLispOperator UI_HISTORY
protected ObservingAgentUI(TransientAgent agent)
agent
- The agent that "owns" this interfaceprotected void handleOther(Object arg)
arg
- The object passed to the notification.protected void handleEvent(String event, Object obj)
"(ui.monitor ...)"
lisp command.event
- the event type stringobj
- the object passed with the eventprotected void printlnObject(Object obj)
obj
- The object to print to the ui.public void update(Observable o, Object arg)
handleEvent(String, Object)
if arg is an
ObserverNotification
, or handleOther(Object)
otherwise.protected Status eval(String buf)
buf
- The string to evaluate in the command language (Lisp).protected Status evalWithHistory(String buf)
"(ui.history...)"
lisp command.buf
- The String to evaluate in the command language (Lisp).