public final class Merge2
Merges two strictly increasing Integer input streams into one strictly increasing output 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.ints.*; public final class Merge2Example { public static void main (String[] argv) { final One2OneChannel[] a = Channel.createOne2One (4); final One2OneChannel[] b = Channel.createOne2One (3, new InfiniteBuffer ()); final One2OneChannel c = Channel.createOne2One (); final One2OneChannel d = Channel.createOne2One (); final One2OneChannel e = Channel.createOne2One (); new Parallel ( new CSProcess[] { new Mult (2, a[0].in (), b[0].out ()), new Mult (3, a[1].in (), b[1].out ()), new Mult (5, a[2].in (), b[2].out ()), new Merge2 (b[0].in (), b[1].in (), c.out ()), new Merge2 (c.in (), b[2].in (), d.out ()), new Prefix (1, d.in (), e.out ()), new Delta (e.in (), Channel.getOutputArray (a)), new Printer (a[3].in (), "--> ", "\n") } ).run (); } }
Constructor and description |
---|
Merge2
(ChannelInput in0, ChannelInput in1, ChannelOutput out) Construct a new Merge2 process with the input channels in0 and in1 and the output channel out. |
Construct a new Merge2 process with the input channels in0 and in1 and the output channel out. The ordering of the input channels makes no difference to the behaviour of this process.
in0
- an input channelin1
- an 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