jadex.rules.eca.annotations.CombinedCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-rules-eca Show documentation
Show all versions of jadex-rules-eca Show documentation
Small Java annotation-based event-condition-action rule engine.
package jadex.rules.eca.annotations;
import jadex.commons.Tuple2;
import jadex.commons.future.DelegationResultListener;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
import jadex.rules.eca.ICondition;
import jadex.rules.eca.IEvent;
/**
*
*/
public class CombinedCondition implements ICondition
{
/** The conditions. */
protected ICondition[] conditions;
/**
* Create a new CombinedCondition.
*/
public CombinedCondition(ICondition[] conditions)
{
this.conditions = conditions;
}
/**
*
*/
public IFuture> evaluate(IEvent event)
{
return doEvaluate(0, event);
// Tuple2 ret = ICondition.TRUE;
//
// for(int i=0; ret.getFirstEntity().booleanValue() && i> doEvaluate(final int i, final IEvent event)
{
final Future> ret = new Future>();
if(i>(ret)
{
public void customResultAvailable(Tuple2 result)
{
if(result.getFirstEntity().booleanValue())
{
if(i+1>(ret));
}
else
{
ret.setResult(result);
}
}
else
{
ret.setResult(result);
}
}
});
}
return ret;
}
}