commstime.java
来自「java连接mysql包!! !!! 支持」· Java 代码 · 共 55 行
JAVA
55 行
import jcsp.lang.*;
import jcsp.plugNplay.ints.*;
import jcsp.util.ints.*;
import phw.util.Ask;
class CommsTime {
public static void main (String argv []) {
System.out.println ("");
System.out.println ("Test of communication between JCSP processes");
System.out.println ("Based on occam CommsTime.occ by Peter Welch, University of Kent at Canterbury");
System.out.println ("Ported into Java by Oyvind Teig");
System.out.println ("Now using the JCSP library (phw/pda1)");
System.out.println ("");
SpuriousLog.start ();
final boolean pardelta = Ask.Boolean ("Parallel output from Delta? ");
final int nIterations = 10000;
System.out.println (nIterations + " iterations per timing ...\n");
One2OneChannelInt a = new One2OneChannelInt ();
One2OneChannelInt b = new One2OneChannelInt ();
One2OneChannelInt c = new One2OneChannelInt ();
One2OneChannelInt d = new One2OneChannelInt ();
if (pardelta) {
new Parallel (
new CSProcess[] {
new PrefixInt (0, c, a),
new Delta2Int (a, d, b),
new SuccessorInt (b, c),
new Consume (nIterations, d)
}
).run ();
} else {
new Parallel (
new CSProcess[] {
new PrefixInt (0, c, a),
new SeqDelta2Int (a, d, b),
new SuccessorInt (b, c),
new Consume (nIterations, d)
}
).run ();
}
System.out.println ("\n\n\nOnly gets here if all above parallel processes fail ...\n\n\n");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?