public static void Main(String[] argv) { int nUnits = 8; Console.WriteLine("Enter number of units: "); nUnits = (int)Console.Read(); //Ask.Int("\nnUnits = ", 3, 10); // make the buttons One2OneChannel[] _event = Channel.one2oneArray(nUnits); One2OneChannel[] configure = Channel.one2oneArray(nUnits); // construct an array of front-ends to a single alting barrier AltingBarrier[] group = AltingBarrier.create(nUnits); // make the gadgets AltingBarrierExampleProcess[] gadgets = new AltingBarrierExampleProcess[nUnits]; for (int i = 0; i < gadgets.Length; i++) { gadgets[i] = new AltingBarrierExampleProcess(_event[i].In(), group[i], configure[i].Out()); } //new CSPParallel( // new IamCSProcess[] // { // buttons, new CSPParallel(gadgets) // } //).run(); }
public static void Main(String[] argv) { int nUnits = 8; Console.WriteLine("Enter number of units: "); nUnits = Int32.Parse(Console.ReadLine()); // make the buttons One2OneChannel[] a = Channel.one2oneArray(nUnits); One2OneChannel[] b = Channel.one2oneArray(nUnits); ProcessesArray processesArray = new ProcessesArray( nUnits, Channel.getInputArray(b), Channel.getOutputArray(a) ); // construct an array of front-ends to a single alting barrier AltingBarrier[] group = AltingBarrier.create(nUnits); // make the gadgets AltingBarrierExampleProcess[] barriers = new AltingBarrierExampleProcess[nUnits]; for (int i = 0; i < barriers.Length; i++) { barriers[i] = new AltingBarrierExampleProcess(a[i].In(), group[i], b[i].Out(), i + 65); } // run everything new CSPParallel( new IamCSProcess[] { processesArray, new CSPParallel(barriers) } ).run(); }