public final class Xor
Bitwise xors two Integer streams to one stream.
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. |
import org.jcsp.lang.*; import org.jcsp.util.*; public final class XorExample { public static void main (String[] argv) { final One2OneChannel a = Channel.createOne2One (); final One2OneChannel b = Channel.createOne2One (); final One2OneChannel c = Channel.createOne2One (); new Parallel ( new CSProcess[] { new Numbers (a.out ()), new Xor (a.in (), b.in (), c.out ()), new CSProcess () { public void run () { Integer xorVal = new Integer (Integer.MAX_VALUE); while (true) { b.out ().write (xorVal); } } } new Printer (c.in ()), } ).run (); } }
Constructor and description |
---|
Xor
(ChannelInput in1, ChannelInput in2, ChannelOutput out) Construct a new Xor process with the input Channels in1 and in2 and the output Channel out. |
Construct a new Xor 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.
in1
- The first input Channelin2
- The second input Channelout
- The output ChannelJCSP for Java 1.8 generated 14-10-2016 by Jon Kerridge, Edinburgh Napier University - j dot kerridge at napier dot ac dot uk