public final class And
Bitwise ands two Integer streams to one stream.
Input Channels | ||
---|---|---|
in0, in1 | 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 class AndExample { public static void main (String[] argv) { One2OneChannel a = Channel.createOne2One (); One2OneChannel b = Channel.createOne2One (); One2OneChannel c = Channel.createOne2One (); new Parallel ( new CSProcess[] { new Numbers (a.out ()), new And (a.in (), b.in (), c.out ()), new Printer (c.in ()), new CSProcess () { public void run () { Integer andVal = new Integer (Integer.MAX_VALUE - 1); while (true) { b.out ().write (andVal); } } } } ).run (); } }
Constructor and description |
---|
And
(ChannelInput in0, ChannelInput in1, ChannelOutput out) Construct a new And process with the input Channels in0 and in1 and the output Channel out. |
Construct a new And process with the input Channels in0 and in1 and the output Channel out. The ordering of the Channels in0 and in1 make no difference to the functionality of this process.
in0
- the first input Channelin1
- 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