Package org.jcsp.plugNplay.ints
Class SignInt
- java.lang.Object
-
- org.jcsp.plugNplay.ints.SignInt
-
- All Implemented Interfaces:
CSProcess
public final class SignInt extends java.lang.Object implements CSProcess
Converts each input int to a String, prefixing it with a user-defined sign.Process Diagram
Description
Sign converts each input int to a String, prefixing it with a user-defined sign.Channel Protocols
Input Channels in int Almost all channels in this package carry integers. Output Channels out java.lang.String The output will be of type String. Example
The following example shows how to use SignInt in a small program.import org.jcsp.lang.*; import org.jcsp.plugNplay.ints.*; import org.jcsp.plugNplay.*; public class SignIntExample { public static void main (String[] argv) { final One2OneChannelInt[] a = Channel.one2oneIntArray (3); final One2OneChannel[] b = Channel.one2oneArray (3); final One2OneChannel c = Channel.one2one (); new Parallel ( new CSProcess[] { new NumbersInt (a[0].out ()), new FibonacciInt (a[1].out ()), new SquaresInt (a[2].out ()), new SignInt ("Numbers ", a[0].in (), b[0].out ()), new SignInt (" Fibonacci ", a[1].in (), b[1].out ()), new SignInt (" Squares ", a[2].in (), b[2].out ()), new Plex (Channel.getInputArray (b), c.out ()), new Printer (c.in (), "", "\n") } ).run (); } }
- See Also:
Sign
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelInputInt
in
The input Channelprivate ChannelOutput
out
The output Channelprivate java.lang.String
sign
The user-defined sign to attach to each item
-
Constructor Summary
Constructors Constructor Description SignInt(java.lang.String sign, ChannelInputInt in, ChannelOutput out)
Construct a new Sign process with the input Channel in and the output Channel out.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
run()
The main body of this process.
-
-
-
Field Detail
-
sign
private final java.lang.String sign
The user-defined sign to attach to each item
-
in
private final ChannelInputInt in
The input Channel
-
out
private final ChannelOutput out
The output Channel
-
-
Constructor Detail
-
SignInt
public SignInt(java.lang.String sign, ChannelInputInt in, ChannelOutput out)
Construct a new Sign process with the input Channel in and the output Channel out.- Parameters:
sign
- the user-defined signature to attach to each item.in
- the input Channel.out
- the output Channel.
-
-