Constant Process Next: Integer ListUp: Reactive ProcessesPrevious: ReactiveProcess Class

Constant Process

Const  puts an integer constant on its output channel, at each instant.

public class Const extends ReactiveProcess
{
  private Channel out;
  private int val;

  public Const(Channel out,int val){ 
    this.out = out; this.val = val; 
  }

  public Const(NrpMachine machine,String out,int val) { 
    this.out = machine.getChannel(out); 
    this.val = val; 
    machine.add(this);
  }

  final public String toString(){ 
    return "const(" + val + "," + out + ")"; 
  }

  protected byte activation(Machine machine)
  {
    put(out,new Integer(val),machine);
    return STOP;
  }
}