CSP for Java
(JCSP) 1.1-rc4

org.jcsp.plugNplay.ints
Class PrinterInt

java.lang.Object
  extended by org.jcsp.plugNplay.ints.PrinterInt
All Implemented Interfaces:
CSProcess

public class PrinterInt
extends 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 in MergeInt.

Author:
P.H. Welch and P.D. Austin
See Also:
Parallel

Constructor Summary
PrinterInt(ChannelInputInt in)
          Construct a new PrinterInt with System.out as its PrintStream and empty prefix and postfix strings.
PrinterInt(ChannelInputInt in, PrintStream printStream)
          Construct a new PrinterInt with empty prefix and postfix strings.
PrinterInt(ChannelInputInt in, PrintStream printStream, String prefix, String postfix)
          Construct a new PrinterInt.
PrinterInt(ChannelInputInt in, String prefix, String postfix)
          Construct a new PrinterInt with System.out as its PrintStream.
 
Method Summary
 void run()
          The main body of this process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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,
                  String prefix,
                  String postfix)
Construct a new PrinterInt with System.out as its PrintStream.

Parameters:
in - the channel from which to read
prefix - the string to write in front of each integer
postfix - the string to write after each integer

PrinterInt

public PrinterInt(ChannelInputInt in,
                  PrintStream printStream)
Construct a new PrinterInt with empty prefix and postfix strings.

Parameters:
in - the channel from which to read
printStream - the stream to which to write

PrinterInt

public PrinterInt(ChannelInputInt in,
                  PrintStream printStream,
                  String prefix,
                  String postfix)
Construct a new PrinterInt.

Parameters:
in - he channel from which to read
printStream - the stream to which to write
prefix - the string to write in front of each integer
postfix - the string to write after each integer
Method Detail

run

public void run()
The main body of this process.

Specified by:
run in interface CSProcess

CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.