All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jcsp.util.buildingblocks.ints.NandInt

java.lang.Object
   |
   +----jcsp.util.buildingblocks.ints.NandInt

public final class NandInt
extends Object
implements CSProcess

Process Diagram

    in1  _________
   -->--|         | out
    in2 | NandInt |-->--
   -->--|_________|
 

Description

The NandInt class is a process which has an infinite loop that waits an int to be sent down each of the in1 and in2 ChannelInts. The process then calculates the bitwise NAND on the two int then write the result down the out ChannelInt.

Channel Protocols

Input Channels
in1,in2 ChannelInt int
Output Channels
out ChannelInt int

Example

The following example shows how to use the NandInt process in a small program. The program also uses some of the other building block processes. The program generates a sequence of numbers and calculates the negative value and prints this on the screen.
 import jcsp.lang.*;
 import jcsp.lang.ints.*;
 import jcsp.util.ints.*;
 public class NandExample {
   public static void main(String[] argv) {
     ChannelInt a = new One2OneChannelInt();
     ChannelInt b = new One2OneChannelInt();
     ChannelInt c = new One2OneChannelInt();
     ChannelInt d = new One2OneChannelInt();
     new Parallel(new CSProcess[]  {
       new NosInt(a),
       new NandInt(a, b, c),
       new SuccessorInt(c, d),
       new PrinterInt(d, "", "\n"),
       new CSProcess() {
         public void run() {
           int nandVal = Integer.MAX_VALUE;
           while (true) {
             b.write(nandVal);
           }
         }
       }
     }).run();
   }
 }
 

Author:
P.D.Austin

Constructor Index

 o NandInt(ChannelInputInt, ChannelInputInt, ChannelOutputInt)
Construct a new NandInt process with the input ChannelInts in1 and in2 and the output ChannelInt out.

Method Index

 o run()
The main body of this process.

Constructors

 o NandInt
 public NandInt(ChannelInputInt in1,
                ChannelInputInt in2,
                ChannelOutputInt out)
Construct a new NandInt process with the input ChannelInts in1 and in2 and the output ChannelInt out. The ordering of the ChannelInts in1 and in2 make no difference to the functionality of this process.

Parameters:
in1 - The first input ChannelInt
in2 - The second input ChannelInt
out - The output ChannelInt

Methods

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


All Packages  Class Hierarchy  This Package  Previous  Next  Index