jadex.micro.testcases.stream.Receiver2Agent 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.stream;
import jadex.bridge.IComponentStep;
import jadex.bridge.IInternalAccess;
import jadex.bridge.IOutputConnection;
import jadex.bridge.component.IExecutionFeature;
import jadex.commons.future.IFuture;
import jadex.commons.future.IResultListener;
import jadex.micro.annotation.Agent;
import jadex.micro.annotation.AgentStreamArrived;
@Agent
public class Receiver2Agent
{
@Agent
protected IInternalAccess agent;
/**
*
*/
@AgentStreamArrived
public void streamArrvied(final IOutputConnection con)
{
// System.out.println("received: "+con+" "+con.hashCode());
// final Future ret = new Future();
final IComponentStep step = new IComponentStep()
{
final int[] cnt = new int[]{1};
final int max = getMax();
final IComponentStep self = this;
public IFuture execute(IInternalAccess ia)
{
byte[] tosend = new byte[cnt[0]];
for(int i=0; i()
{
public void resultAvailable(Integer result)
{
if(cnt[0]++