All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.micro.testcases.stream.Receiver2Agent Maven / Gradle / Ivy

Go to download

The Jadex micro applications package contains several example applications, benchmarks and testcases using micro agents.

There is a newer version: 4.0.267
Show newest version
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]++




© 2015 - 2024 Weber Informatics LLC | Privacy Policy