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

jadex.micro.testcases.pull.PullResultProviderAgent 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.pull;

import jadex.bridge.IInternalAccess;
import jadex.bridge.service.annotation.Service;
import jadex.commons.ICommand;
import jadex.commons.future.IPullIntermediateFuture;
import jadex.commons.future.IPullSubscriptionIntermediateFuture;
import jadex.commons.future.PullIntermediateFuture;
import jadex.commons.future.PullSubscriptionIntermediateFuture;
import jadex.commons.future.TerminationCommand;
import jadex.micro.annotation.Agent;
import jadex.micro.annotation.Description;
import jadex.micro.annotation.Implementation;
import jadex.micro.annotation.ProvidedService;
import jadex.micro.annotation.ProvidedServices;

/**
 *  Agent that provides a service with intermediate results.
 */
@Agent
@Service
@ProvidedServices(@ProvidedService(type=IPullResultService.class, implementation=@Implementation(expression="$pojoagent")))
@Description("Agent that provides a service with intermediate results")
public class PullResultProviderAgent implements IPullResultService
{
	//-------- attributes ---------
	
	/** The agent. */
	@Agent
	protected IInternalAccess agent;
	
	//-------- constructors ---------

	/**
	 *  Get the results.
	 *  @param max The number of intermediate results that will be returned.
	 *  @return The results.
	 */
	public IPullIntermediateFuture getResultsA(final int max)
	{
		final PullIntermediateFuture ret = new PullIntermediateFuture(
			new ICommand>()
		{
			int cnt = 0;
			public void execute(PullIntermediateFuture fut)
			{
				if(cnt getResultsB(final int max)
	{
		final PullSubscriptionIntermediateFuture ret = new PullSubscriptionIntermediateFuture(
			new ICommand>()
		{
			int cnt = 0;
			public void execute(PullSubscriptionIntermediateFuture fut)
			{
				if(cnt




© 2015 - 2024 Weber Informatics LLC | Privacy Policy