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

jadex.bdiv3.runtime.IPlan Maven / Gradle / Ivy

package jadex.bdiv3.runtime;

import jadex.bdiv3x.runtime.IFinishableElement;
import jadex.bdiv3x.runtime.IParameterElement;
import jadex.commons.IFilter;
import jadex.commons.future.IFuture;
import jadex.rules.eca.ChangeInfo;
import jadex.rules.eca.ICondition;

/**
 *  User interface for plans.
 */
public interface IPlan extends IParameterElement, IFinishableElement  // todo: do not extend IParameterElement in case of non bdiv3x
{
	/**
	 *  Get the id.
	 */
	public String getId();
	
	/**
	 *  Abort the plan.
	 */
	public IFuture abort();
	
	/**
	 *  Test if plan is passed.
	 */
	public boolean isPassed();
	
	/**
	 *  Test if plan is aborted.
	 */
	public boolean isAborted();
	
	/**
	 *  Get the reason.
	 *  @return The reason.
	 */
	public Object getReason();
	
	/**
	 *  Get the dispatched element.
	 *  @return The dispatched element.
	 */
	public Object getDispatchedElement();
	
	/**
	 *  Wait for a delay.
	 */
	public IFuture waitFor(long delay);
	
	/**
	 *  Dispatch a goal wait for its result.
	 */
	public  IFuture dispatchSubgoal(T goal);
	
	/**
	 *  Dispatch a goal wait for its result.
	 */
	public  IFuture dispatchSubgoal(T goal, long timeout);
	
	/**
	 *  Wait for a fact change of a belief.
	 */
	public IFuture> waitForFactChanged(String belname);
	
	/**
	 *  Wait for a fact change of a belief.
	 */
	public IFuture> waitForFactChanged(String belname, long timeout);
	
	/**
	 *  Wait for a fact being added to a belief.
	 */
	public IFuture> waitForFactAdded(String belname);
	
	/**
	 *  Wait for a fact being added to a belief.
	 */
	public IFuture> waitForFactAdded(String belname, long timeout);

	/**
	 *  Wait for a fact being removed from a belief.
	 */
	public IFuture> waitForFactRemoved(String belname);
	
	/**
	 *  Wait for a fact being removed from a belief.
	 */
	public IFuture> waitForFactRemoved(String belname, long timeout);
	
	/**
	 *  Wait for a fact being added or removed to a belief.
	 */
	public IFuture> waitForFactAddedOrRemoved(String belname);
	
	/**
	 *  Wait for a fact being added or removed to a belief.
	 */
	public IFuture> waitForFactAddedOrRemoved(String belname, long timeout);
	
	/**
	 *  Wait for a collection change.
	 */
	public  IFuture> waitForCollectionChange(String belname, long timeout, IFilter> filter);
	
	/**
	 *  Wait for a collection change.
	 */
	public  IFuture> waitForCollectionChange(String belname, long timeout, Object id);

	
	/**
	 *  Wait for a condition.
	 */
	public IFuture waitForCondition(ICondition cond, String[] events);
	
	/**
	 *  Wait for a condition.
	 */
	public IFuture waitForCondition(ICondition cond, String[] events, long timeout);
	
//	/**
//	 * 
//	 */
//	public  IFuture invokeInterruptable(IResultCommand, Void> command);

}