nl.tudelft.goal.EIS2Java.annotation
Annotation Type AsPercept


@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:

  1. name: the name of the percept to be returned
  2. multiplePercepts: true when the percept function returns a List of List of (translatable) Objects;
  3. filter. One of Filter.Type.ALWAYS, ONCE, ONCHANGE or ONCHANGENEG.
  4. event. True when the percepts are event based and the results from all calls to this method should be passed to the agent.
The filter type determines the way percepts are filtered before sending out through EIS:

*
filter name full name behaviour
ALWAYS send always send percepts every round
ONCE send one timesend 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.

Author:
Lennard de Rijk, W.Pasman 27sep2011 added filter annotation

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

name

public abstract String name
The name of the Percept when generated

multiplePercepts

public abstract boolean multiplePercepts
If defined as true the return value of the annotated function must be of type Collection. The return value will be used to generate multiple percepts with the same name.

Default:
false

filter

public abstract Filter.Type filter
Default:
nl.tudelft.goal.EIS2Java.translation.Filter.Type.ALWAYS

event

public abstract boolean event
Default:
false


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.