Example 1
import ros.kernel.*;
public class rejo2 implements Agent
{
public reactive met(int i)
{
repeat(i)
stop;
gen "e";
}
public reactive rmain(String[]
args)
{
par
{
loop {
wait "e";
System.out.println(" --->");
stop;
}
||
call met(int: 5);
}
}
public static void main(String[]
args)
{
rejo2 ag = new rejo2();
Ros ros = new Ros(args);
ros.load(ag);
for(int i=1; i<=20; i++){
System.out.println("i("+i+"):
");
ros.react();
}
}
}
Example 2
public class rejo1
{
public reactive met(int i)
{
repeat(i)
stop;
gen "e";
}
public reactive rmain(String[] args)
{
loop{
wait "e";
System.out.println(" --->");
stop;
}
}
public static void main(String[] args)
{
rejo1 ag = new rejo1();
Machine machine = Jre.SafeMachine();
machine.add(ag.rmain(args));
machine.add(ag.met(5));
for(int i=1;
i<=20; i++){
System.out.println("i("+i+"):
");
machine.react();
}
}
}