IntValues produces the list of integers (starting from an initial value) on its output.
public class IntValues extends ReactiveProcess
{
private Channel out;
private int from = 0;
public IntValues(Channel out,int from)
{
this.out = out;
this.from = from;
}
public IntValues(NrpMachine machine,String out,int from)
{
this.out = machine.getChannel(out);
this.from = from;
machine.add(this);
}
final public String toString(){
return "integers(" + out + "," + from + ")";
}
protected byte activation(Machine machine)
{
put(out,new Integer(from++),machine);
return STOP;
}
}