Class Nor

java.lang.Object
org.jcsp.plugNplay.Nor
All Implemented Interfaces:
CSProcess

public final class Nor extends Object implements CSProcess
Bitwise nors two Integer streams to one stream.

Process Diagram

    in0  _____
   -->--|     | out
    in1 | Nor |-->--
   -->--|_____|
 

Description

This is a process with an infinite loop that waits for a Object of type Number to be sent down each of its input channels. The loop body then calculates the bitwise NOR on the values of the two Numbers and writes the result as a new Integer to its output channel.

Channel Protocols

Input Channels
in1,in2 java.lang.Number Both Channels can accept data from any subclass of Number. It is possible to send Floats down one channel and Integers down the other. However all values will be converted to ints.
Output Channels
out java.lang.Integer The output will always be of type Integer.

Example

The following example shows the use of this process in a small program. The program also uses some of the other building block processes. It generates a sequence of numbers and calculates the negative value and prints this on the screen.
 import org.jcsp.lang.*;
 import org.jcsp.plugNplay.*;
 
 public class NorExample {
 
   public static void main (String[] argv) {
 
     fonal One2OneChannel a = Channel.one2one ();
     fonal One2OneChannel b = Channel.one2one ();
     fonal One2OneChannel c = Channel.one2one ();
     fonal One2OneChannel d = Channel.one2one ();
 
     new Parallel (
       new CSProcess[] {
         new Numbers (a.out ()),
         new Generate (b.out (), 0),
         new Nor (a.in (), b.in (), c.out ()),
         new Successor (c.in (), d.out ()),
         new Printer (d.in (), "--> ", "\n")
       }
     ).run ();
 
   }
 
 }
 
Author:
P.H. Welch and P.D. Austin
  • Constructor Details

    • Nor

      public Nor(ChannelInput in1, ChannelInput in2, ChannelOutput out)
      Construct a new Nor process with the input Channels in1 and in2 and the output Channel out. The ordering of the Channels in1 and in2 make no difference to the functionality of this process.
      Parameters:
      in1 - The first input Channel
      in2 - The second input Channel
      out - The output Channel
  • Method Details

    • run

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