All Packages Class Hierarchy This Package Previous Next Index
Class jcsp.util.buildingblocks.ints.SuccessorInt
java.lang.Object
|
+----jcsp.util.buildingblocks.ints.SuccessorInt
- public final class SuccessorInt
- extends Object
- implements CSProcess
Process Diagram
______________
in | | out
-->--| SuccessorInt |-->--
|______________|
Description
The SuccessorInt class is a process which has an infinite loop that waits
an int to be sent down the in ChannelInt. The process then
adds one to the int then writes the result down the out ChannelInt.
Channel Protocols
Input Channels |
int |
ChannelInt |
int
|
Output Channels |
out |
ChannelInt |
int
|
Example
The following example shows how to use the SuccessorInt process in a small program.
The program also uses some of the other building block processes. The
program generates a sequence of numbers and adds one to them and prints
this on the screen.
import jcsp.lang.*;
import jcsp.lang.ints.*;
import jcsp.util.ints.*;
public class SuccessorExample {
public static void main(String[] argv) {
ChannelInt a = new One2OneChannelInt();
ChannelInt b = new One2OneChannelInt();
new Parallel(new CSProcess[] {
new NosInt(a),
new SuccessorInt(a, b),
new PrinterInt(b, "", "\n")
}).run();
}
}
- Author:
- P.D.Austin
-
SuccessorInt(ChannelInputInt, ChannelOutputInt)
- Construct a new SuccessorInt process with the input ChannelInt in and the
output ChannelInt out.
-
run()
- The main body of this process.
SuccessorInt
public SuccessorInt(ChannelInputInt in,
ChannelOutputInt out)
- Construct a new SuccessorInt process with the input ChannelInt in and the
output ChannelInt out.
- Parameters:
- in - The input ChannelInt
- out - The output ChannelInt
run
public void run()
- The main body of this process.
All Packages Class Hierarchy This Package Previous Next Index