jadex.micro.testcases.prepostconditions.IContractService 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.prepostconditions;
import java.util.List;
import jadex.bridge.service.annotation.CheckIndex;
import jadex.bridge.service.annotation.CheckNotNull;
import jadex.bridge.service.annotation.CheckState;
import jadex.commons.future.IFuture;
import jadex.commons.future.IIntermediateFuture;
/**
* Example for contracts in services.
*
* As precondition it can be used: @CheckNotNull @CheckState @CheckIndex()
* As postcondition it can be used: @CheckNotNull @CheckState
*/
public interface IContractService
{
/**
* Test method for @CheckNotNull and @CheckState.
*/
public @CheckNotNull @CheckState("$res>0 && $res<100") IFuture doSomething(
@CheckNotNull String a,
@CheckState("$arg>0 && $arg<100") int x,
@CheckState("$arg>0") int y);
/**
* Test method for @CheckIndex.
*/
public IFuture getName(@CheckIndex(1) int idx, @CheckNotNull List names);
/**
* Test method for @CheckState with intermediate results.
*
* Will automatically try to determine the number of intermediate results to keep.
*/
public @CheckState(value="$res[-1] < $res", intermediate=true)
IIntermediateFuture getIncreasingValue2();
/**
* Test method for @CheckState with intermediate results.
*/
public @CheckState(value="$res[-1] < $res", intermediate=true, keep=1)
IIntermediateFuture getIncreasingValue();
}