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

jadex.bdi.planlib.iasteps.StepChain Maven / Gradle / Ivy

Go to download

The Jadex applib BDI package contains ready to use functionalities for BDI agents mostly in form of modules called capabilities.

The newest version!
package jadex.bdi.planlib.iasteps;

import java.util.Collection;

import jadex.bridge.IComponentStep;
import jadex.bridge.IInternalAccess;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;

public class StepChain implements IComponentStep
{
	protected IComponentStep[] steps;
	
	public StepChain(IComponentStep[] steps)
	{
		this.steps = steps;
	}
	
	public StepChain(Collection steps)
	{
		this.steps = (IComponentStep[]) steps.toArray(new IComponentStep[steps.size()]);
	}
	
	public IFuture execute(IInternalAccess ia)
	{
		Object[] results = new Object[steps.length];
		for (int i = 0; i < steps.length; ++i)
			results[i] = steps[i].execute(ia);
		
		return new Future(results);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy