jadex.micro.testcases.semiautomatic.compositeservice.AddService 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.semiautomatic.compositeservice;
import jadex.bridge.IInternalAccess;
import jadex.bridge.service.BasicService;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
/**
* Simple add service.
*/
public class AddService extends BasicService implements IAddService
{
//-------- constructors --------
/**
* Create the service.
*/
public AddService(IInternalAccess comp)
{
super(comp.getComponentIdentifier(), IAddService.class, null);
}
//-------- methods --------
/**
* Add two numbers.
* @param a Number one.
* @param b Number two.
* @return The sum of a and b.
*/
public IFuture add(double a, double b)
{
System.out.println("add service called on: "+getServiceIdentifier().getProviderId());
return new Future(Double.valueOf(a+b));
}
}