ReactiveProcess Class Next: Constant ProcessUp: Reactive ProcessesPrevious: Reactive Processes

ReactiveProcess Class

The abstract class ReactiveProcess  of reactive processes extends Instruction. It defines a fix method which returns TERM is its channel parameter is not empty, STOP it it is empty (which is known only at the end of the current instant), and SUSP otherwise.

The newMove method of Machine is called when an object is put into a channel.

abstract public class ReactiveProcess extends Instruction
{
  protected byte fix(Channel chan,Machine machine)
  {
    if (!chan.isEmpty()) return TERM;
    if (machine.isEndOfInstant()) return STOP;
    return SUSP;
  }

  protected void put(Channel chan,Object obj,Machine machine)
  {
    chan.put(obj);
    machine.newMove();
  }
}