public final class Or
Bitwise ors 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 class OrExample { 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 Or (a.in (), b.in (), c.out ()), new Printer (c.in ()), new CSProcess () { public void run () { Integer orVal = new Integer (1); while (true) { b.out ().write (orVal); } } } } ).run (); }
Constructor and description |
---|
Or
(ChannelInput in1, ChannelInput in2, ChannelOutput out) Construct a new Or process with the input Channels in1 and in2 and the output Channel out. |
Construct a new Or 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