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

jadex.micro.tutorial.PrintTimeStep 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.tutorial;

import java.util.Date;

import jadex.bridge.IComponentStep;
import jadex.bridge.IInternalAccess;
import jadex.bridge.service.component.IRequiredServicesFeature;
import jadex.bridge.service.types.clock.IClockService;
import jadex.commons.future.DefaultResultListener;
import jadex.commons.future.IFuture;

/**
 *  Component step that prints the time.
 */
public class PrintTimeStep implements IComponentStep
{
	/**
	 *  Execute the command.
	 *  @param args The argument(s) for the call.
	 *  @return The result of the command.
	 */
	public IFuture execute(IInternalAccess ia)
	{
		IFuture fut = ia.getComponentFeature(IRequiredServicesFeature.class).getRequiredService("clockservice");
		fut.addResultListener(new DefaultResultListener()
		{
			public void resultAvailable(IClockService cs)
			{
//				IClockService cs = (IClockService)result;
				System.out.println("Time for a chat buddy: "+new Date(cs.getTime()));
			}
		});
		return IFuture.DONE;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy