jadex.micro.testcases.InjectedResultsAgent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-micro Show documentation
Show all versions of jadex-applications-micro Show documentation
The Jadex micro applications package contains several example applications, benchmarks and testcases using micro agents.
package jadex.micro.testcases;
import jadex.commons.future.IFuture;
import jadex.micro.annotation.Agent;
import jadex.micro.annotation.AgentArgument;
import jadex.micro.annotation.AgentBody;
import jadex.micro.annotation.AgentResult;
import jadex.micro.annotation.Argument;
import jadex.micro.annotation.Arguments;
import jadex.micro.annotation.Result;
import jadex.micro.annotation.Results;
@Agent
@Arguments(
{
@Argument(name="myarg", clazz=String.class, defaultvalue="\"def_val\"")
})
@Results(
{
@Result(name="myres", clazz=String.class),
@Result(name="myint", clazz=int.class, defaultvalue="-1")
})
public class InjectedResultsAgent
{
@AgentArgument(value="myarg")
@AgentResult
protected String myres;
@AgentResult(value="myint", convert="\"\"+$value", convertback="Integer.parseInt($value)")
protected String someint;
/**
* The agent body.
*/
@AgentBody
public IFuture executeBody()
{
// System.out.println("myres: "+myres);
// System.out.println("someint: "+someint);
someint = "99";
return IFuture.DONE;
}
}