class Plus implements CSProcess{
ChannelInputInt in1;
ChannelInputInt in2;
ChannelOutputInt out;
ProcessReadInt r1;
ProcessReadInt r2;
public Plus(ChannelInputInt in1,
ChannelInputInt in2,
ChannelOutputInt out){
this.in1 = in1;
this.in2 = in2;
this.out = out;
r1 = new ProcessReadInt(in1);
r2 = new ProcessReadInt(in2);
}
public void run(){
while(true){
new Parallel( new CSProcess[]{r1, r2}).run();
out.write(r1.value + r2.value);
} } }
Previous slide | Next slide | Back to first slide | View graphic version |