Used to match (
matches(PolicyAgentInterface, Describable)
)
Event
s
to an abstract pattern represented by the this class. The abstract pattern is
a list of key/value pairs. Keys are NOT case-sensitive. The match is performed by iterating over each
key/value pair in the pattern, and comparing it the corresponding key/value pair
in the
Describable
parameter of
matches(PolicyAgentInterface, Describable)
. The comparison may be one
of 5 operators:
OPERATOR | EXPLANATION |
= | equal |
! | not equal |
< | isa (as per the agent's ontology) |
!< | not isa |
* | regular expression comparison (as per Pattern ) |
The operators are specified by prefixing them (without spaces) to the first (key) parameter in the
put(String, Object)
method. If an operator is not specified, the default
depends on key parameter:
KEY | OPERATOR |
performative | < |
act | < |
type | < |
-- all others -- | = |
In addition, you can specify that a pattern matches only if the cooresponding key is
missing by put([key], "-"), that is, by passing the string "-" as the value of a
key/value pair.
Examples:
put("performative", "request") | matches if the Describle's performative key is a subtype of "request", according to the agent's ontology. |
put("<performative", "request") | matches if the Describle's performative key is a subtype of "request", according to the agent's ontology. |
put("=performative", "request") | matches if the Describle's performative key is exactly "request". |
put("!performative", "request") | matches if the Describle's performative key is NOT "request". |
put("!<performative", "request") | matches if the Describle's performative key is NOT a subtype of "request". |
put("to", ":6700") | matches if the Describable's to key is exactly ":6700". |
put("*to", "[^:]*:6700.*") | matches if the Describable's to key contains ":6700" and there are no leading colons. |
put("content", "-") | matches if the Describable does NOT contain a content key. |