|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME) @Target(value=METHOD) public @interface AsPercept
Annotation for methods that generate a percept. The method must not take any
parameters but is allowed to return any value for which a
Java2Parameter translator has been registered.
@AsPercept tags have four parameters:
| filter name | full name | behaviour |
|---|---|---|
| ALWAYS | send always | send percepts every round |
| ONCE | send one time | *send percepts only the first round |
| ON_CHANGE | send when changed | send percept(s), but only if any of the percepts changes |
| ON_CHANGE_NEG | send on change using 'not' | if percept p is new then send p; if percept p was removed and (multiplePercepts=true or (multiple=false and p became null)) then send not(p) |
Important: the AbstractEnvironment compares old and new percepts
based on the Object that is returned, not based on the translator
result. This is to avoid extra overhead of translation. This means that you
must return a static (non-changing) object as percept, and that that
percept object must have a functioning equals.
| Required Element Summary | |
|---|---|
String |
name
The name of the Percept when generated |
| Optional Element Summary | |
|---|---|
boolean |
event
|
Filter.Type |
filter
|
boolean |
multiplePercepts
If defined as true the return value of the annotated function must be of type Collection. |
| Element Detail |
|---|
public abstract String name
Percept when generated
public abstract boolean multiplePercepts
Collection. The return value will be used to generate
multiple percepts with the same name.
public abstract Filter.Type filter
public abstract boolean event
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||