CSP for Java
(JCSP) 1.0-rc4

jcsp.plugNplay.ints
Class SignInt

java.lang.Object
  |
  +--jcsp.plugNplay.ints.SignInt
All Implemented Interfaces:
CSProcess

public final class SignInt
extends Object
implements CSProcess

Converts each input int to a String, prefixing it with a user-defined sign.

Process Diagram

         ________________
    in  |                | out
   -->--| SignInt (sign) |-->--
        |________________|
 

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 jcsp.lang.*;
 import jcsp.plugNplay.ints.*;
 import jcsp.plugNplay.*;
 
 public final class SignIntExample {
 
   public static void main (String[] argv) {
 
     final One2OneChannelInt[] a = One2OneChannelInt.create (3);
     final One2OneChannel[] b = One2OneChannel.create (3);
     final One2OneChannel c = new One2OneChannel ();
 
     new Parallel (
       new CSProcess[] {
         new NumbersInt (a[0]),
         new FibonacciInt (a[1]),
         new SquaresInt (a[2]),
         new SignInt ("Numbers ", a[0], b[0]),
         new SignInt ("            Fibonacci ", a[1], b[1]),
         new SignInt ("                          Squares ", a[2], b[2]),
         new Plex (b, c),
         new Printer (c, "", "\n")
       }
     ).run ();
 
   }
 
 }
 

Author:
P.D.Austin
See Also:
Sign

Constructor Summary
SignInt(String sign, ChannelInputInt in, ChannelOutput out)
          Construct a new Sign process with the input Channel in and the output Channel out.
 
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

SignInt

public SignInt(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.
Method Detail

run

public void run()
The main body of this process.
Specified by:
run in interface CSProcess

CSP for Java
(JCSP) 1.0-rc4

Submit a bug or feature to jcsp-team@ukc.ac.uk
Version 1.0-rc4 of the JCSP API Specification (Copyright 1997-2000 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.