jadex.micro.examples.mandelbrot.DisplayService 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.examples.mandelbrot;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import jadex.bridge.SFuture;
import jadex.bridge.service.annotation.Service;
import jadex.bridge.service.annotation.ServiceComponent;
import jadex.commons.future.IFuture;
import jadex.commons.future.ISubscriptionIntermediateFuture;
import jadex.commons.future.SubscriptionIntermediateFuture;
/**
* The service allows displaying results in the frame
* managed by the service providing agent.
*/
@Service
public class DisplayService implements IDisplayService
{
//-------- attributes --------
/** The agent. */
@ServiceComponent
protected DisplayAgent agent;
/** The display subscribers. */
protected Map> subscribers = new HashMap>();
//-------- IDisplayService interface --------
/**
* Display the result of a calculation.
*/
public IFuture displayResult(AreaData result)
{
// System.out.println("displayRes: "+agent.getComponentIdentifier());
// agent.getPanel().setResults(result);
String id = result.getDisplayId();
if(id!=null)
{
SubscriptionIntermediateFuture