public class PerformDescriptor extends Status implements Map<String,String>
Title: CASA Agent Infrastructure
Description:
PerformDescriptor is a meant to be a simple description consisting of key/value pairs. It is an extension ofStatus
with TreeMap
properties added.
PerformDescriptor is usually used to return information from an agent processing a message. The policies
call callback methods to allow the agent to process the message appropriately (if at all), and use the information
returned in the PerformDescriptor to modify behaviour. For example, if a reply is normally called for,
the type of the reply will be modified depending on the Status object in the returned PerformDescriptor, but the
key/value pairs always override whatever the "normative" key/value pairs in any reply message.
In addition you can add a Condition
which will indicate that the associated performance/action
should be delayed until the condition is satisfied (note that this is newer addtion, so it might be neglected
by older code).
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
Modifier and Type | Field and Description |
---|---|
private TreeMap<String,String> |
params |
private static CasaLispOperator |
PERFORMDESCRIPTOR
Lisp operator: (PERFORMDESCRIPTOR ...)
Sends the designated response to |
private static CasaLispOperator |
PERFORMDESCRIPTOR__GET_STATUS
Lisp operator: (PERFORMDESCRIPTOR.GET-STATUS PD ...)
Sends the designated response to |
private static CasaLispOperator |
PERFORMDESCRIPTOR__GET_STATUS_VALUE
Lisp operator: (PERFORMDESCRIPTOR.GET-STATUS-VALUE PD ...)
Sends the designated response to |
private static CasaLispOperator |
PERFORMDESCRIPTOR__GET_VALUE
Lisp operator: (PERFORMDESCRIPTOR.GET-VALUE PD KEY ...)
Sends the designated response to |
private static CasaLispOperator |
PERFORMDESCRIPTOR__OVERLAY
Lisp operator: (PERFORMDESCRIPTOR.OVERLAY PD &allow-other-keys)
Conditionally overlays the PerformDescriptor PD by the other-keys. |
private Status |
status
This seems odd, but this allows PerformDescriptor to "absorb" a different subtype (eg:
StatusObject )
as it's internal structure. |
BAD_CONTENT_FIELD, BAD_REPLY_TO_FIELD, EXCEPTION_CAUGHT, SUCCESS, TIMEOUT, UNEXEPCTED_EXCEPTION_CAUGHT, UNKNOWN_ERROR, UNKNOWN_REPLY, UNKNOWN_WARNING
Constructor and Description |
---|
PerformDescriptor()
Equivalent to
PerformDescriptor(null) |
PerformDescriptor(int value) |
PerformDescriptor(int value,
String explanation) |
PerformDescriptor(ParamsMap map) |
PerformDescriptor(PerformDescriptor other)
Copy Constructor.
|
PerformDescriptor(Status status)
Constructs a new PerformDescriptor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Object |
clone() |
String |
codeToString()
a function to convert the variable representation of a status in code to a string
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,String>> |
entrySet() |
void |
fromString_extension(TokenParser parser)
To be overridden by subclasses to read any additional information from a string.
|
void |
fromString(TokenParser parser) |
String |
get(Object key) |
String |
getExplanation() |
Status |
getStatus() |
int |
getStatusValue() |
boolean |
isEmpty() |
Set<String> |
keySet() |
PerformDescriptor |
overlay(PerformDescriptor other,
TransientAgent agent)
overlay this PerformDescriptor over the argument PerformDescriptor conditionally.
|
String |
put(String key,
String value) |
void |
putAll(Map<? extends String,? extends String> m) |
String |
remove(Object key) |
void |
setExplanation(String explanation) |
PerformDescriptor |
setStatus(int val,
String explanation) |
PerformDescriptor |
setStatus(Status status) |
void |
setStatusValue(int val) |
int |
size() |
String |
toString()
other methods
|
Collection<String> |
values() |
fromString, fromString2, main, toString_extension
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
private Status status
StatusObject
)
as it's internal structure.private static final CasaLispOperator PERFORMDESCRIPTOR
private static final CasaLispOperator PERFORMDESCRIPTOR__OVERLAY
PerformDescriptor
PD by the other-keys.
"Conditionally" means:
private static final CasaLispOperator PERFORMDESCRIPTOR__GET_STATUS_VALUE
private static final CasaLispOperator PERFORMDESCRIPTOR__GET_VALUE
private static final CasaLispOperator PERFORMDESCRIPTOR__GET_STATUS
public PerformDescriptor()
PerformDescriptor(null)
public PerformDescriptor(Status status)
status
- a new Status, if status is null, then it will be taken as new Status(0)
(a success status).public PerformDescriptor(int value)
public PerformDescriptor(int value, String explanation)
public PerformDescriptor(PerformDescriptor other)
other
- another Perform Descriptor, if status is null, then it will be taken as the default Constructor.} (a success status).public PerformDescriptor(ParamsMap map)
public Status getStatus()
public PerformDescriptor setStatus(Status status)
status
- object to become the new internal status objectpublic PerformDescriptor setStatus(int val, String explanation)
public void fromString(TokenParser parser) throws Exception
fromString
in class Status
Exception
public void fromString_extension(TokenParser parser) throws Exception
Status
fromString_extension
in class Status
ParseException
Exception
public PerformDescriptor overlay(PerformDescriptor other, TransientAgent agent)
other
- agent
- the Agent to use in isa comparisons.public boolean containsKey(Object key)
containsKey
in interface Map<String,String>
public boolean containsValue(Object value)
containsValue
in interface Map<String,String>
public String codeToString()
Status
codeToString
in class Status
public String getExplanation()
getExplanation
in class Status
public int getStatusValue()
getStatusValue
in class Status
public void setExplanation(String explanation)
setExplanation
in class Status
public void setStatusValue(int val)
setStatusValue
in class Status