Package org.jcsp.plugNplay.ints
Class PrinterInt
- java.lang.Object
-
- org.jcsp.plugNplay.ints.PrinterInt
-
- All Implemented Interfaces:
CSProcess
public class PrinterInt extends java.lang.Object implements CSProcess
Prints each int from its input channel to a PrintStream.Process Diagram
Description
PrinterInt is a process for printing each int from its in channel to a PrintStream object (by default, System.out).For convenience, PrinterInt may be configured with prefix and postfix strings with which to decorate its output.
Channel Protocols
Input Channels in int All channels in this package carry integers. Example
See the example inMergeInt
.- See Also:
Parallel
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelInputInt
in
The channel from which to readprivate java.lang.String
postfix
The string to write after each integerprivate java.lang.String
prefix
The string to write in front of each integerprivate java.io.PrintStream
printStream
The stream to which to write
-
Constructor Summary
Constructors Constructor Description PrinterInt(ChannelInputInt in)
Construct a new PrinterInt with System.out as its PrintStream and empty prefix and postfix strings.PrinterInt(ChannelInputInt in, java.io.PrintStream printStream)
Construct a new PrinterInt with empty prefix and postfix strings.PrinterInt(ChannelInputInt in, java.io.PrintStream printStream, java.lang.String prefix, java.lang.String postfix)
Construct a new PrinterInt.PrinterInt(ChannelInputInt in, java.lang.String prefix, java.lang.String postfix)
Construct a new PrinterInt with System.out as its PrintStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
run()
The main body of this process.
-
-
-
Field Detail
-
in
private ChannelInputInt in
The channel from which to read
-
printStream
private java.io.PrintStream printStream
The stream to which to write
-
prefix
private java.lang.String prefix
The string to write in front of each integer
-
postfix
private java.lang.String postfix
The string to write after each integer
-
-
Constructor Detail
-
PrinterInt
public PrinterInt(ChannelInputInt in)
Construct a new PrinterInt with System.out as its PrintStream and empty prefix and postfix strings.- Parameters:
in
- the channel from which to read
-
PrinterInt
public PrinterInt(ChannelInputInt in, java.lang.String prefix, java.lang.String postfix)
Construct a new PrinterInt with System.out as its PrintStream.- Parameters:
in
- the channel from which to readprefix
- the string to write in front of each integerpostfix
- the string to write after each integer
-
PrinterInt
public PrinterInt(ChannelInputInt in, java.io.PrintStream printStream)
Construct a new PrinterInt with empty prefix and postfix strings.- Parameters:
in
- the channel from which to readprintStream
- the stream to which to write
-
PrinterInt
public PrinterInt(ChannelInputInt in, java.io.PrintStream printStream, java.lang.String prefix, java.lang.String postfix)
Construct a new PrinterInt.- Parameters:
in
- he channel from which to readprintStream
- the stream to which to writeprefix
- the string to write in front of each integerpostfix
- the string to write after each integer
-
-