Mercurial > hg > Database > Christie
changeset 138:6b33e7dfb146
マージ example
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 28 Dec 2018 20:06:41 +0900 |
parents | f172c4540461 (current diff) cb2a15d5c915 (diff) |
children | 77169cd8a5e8 8caca9158f0f |
files | |
diffstat | 5 files changed, 104 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/HelloWorld/HelloWorldCodeGear.java Fri Dec 28 20:06:41 2018 +0900 @@ -0,0 +1,17 @@ +package christie.example.HelloWorld; + +import christie.annotation.Take; +import christie.codegear.CodeGear; +import christie.codegear.CodeGearManager; + +public class HelloWorldCodeGear extends CodeGear { + + @Take + String helloWorld; + + @Override + protected void run(CodeGearManager cgm) { + System.out.print(helloWorld + " "); + cgm.setup(new HelloWorldCodeGear()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/HelloWorld/StartHelloWorld.java Fri Dec 28 20:06:41 2018 +0900 @@ -0,0 +1,18 @@ +package christie.example.HelloWorld; + +import christie.codegear.CodeGearManager; +import christie.codegear.StartCodeGear; + +public class StartHelloWorld extends StartCodeGear { + + public StartHelloWorld(CodeGearManager cgm) { + super(cgm); + } + + public static void main(String[] args){ + CodeGearManager cgm = createCGM(10000); + cgm.setup(new HelloWorldCodeGear()); + cgm.getLocalDGM().put("helloWorld","hello"); + cgm.getLocalDGM().put("helloWorld","world"); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/OddEven/EvenCodeGear.java Fri Dec 28 20:06:41 2018 +0900 @@ -0,0 +1,22 @@ +package christie.example.OddEven; + +import christie.annotation.Peek; +import christie.annotation.Take; +import christie.codegear.CodeGear; +import christie.codegear.CodeGearManager; + +public class EvenCodeGear extends CodeGear { + @Take + int even; + + @Peek + int finishCount; + + @Override + protected void run(CodeGearManager cgm) { + if (finishCount == even) return; + System.out.println(even + " : even"); + getDGM("odd").put("odd", even + 1); + cgm.setup(new EvenCodeGear()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/OddEven/OddCodeGear.java Fri Dec 28 20:06:41 2018 +0900 @@ -0,0 +1,22 @@ +package christie.example.OddEven; + +import christie.annotation.Peek; +import christie.annotation.Take; +import christie.codegear.CodeGear; +import christie.codegear.CodeGearManager; + +public class OddCodeGear extends CodeGear { + @Take + int odd; + + @Peek + int finishCount; + + @Override + protected void run(CodeGearManager cgm) { + if (finishCount - 1 == odd) return; + System.out.println(odd + " : odd"); + getDGM("even").put("even", odd + 1); + cgm.setup(new OddCodeGear()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/christie/example/OddEven/StartOddEven.java Fri Dec 28 20:06:41 2018 +0900 @@ -0,0 +1,25 @@ +package christie.example.OddEven; + +import christie.codegear.CodeGearManager; +import christie.codegear.StartCodeGear; + +public class StartOddEven extends StartCodeGear { + + public StartOddEven(CodeGearManager cgm) { + super(cgm); + } + + public static void main(String[] args){ + int finishCount = 10; + CodeGearManager odd = createCGM(10001); + CodeGearManager even = createCGM(10002); + odd.setup(new OddCodeGear()); + even.setup(new EvenCodeGear()); + odd.createRemoteDGM("even","localhost",10002); + even.createRemoteDGM("odd","localhost", 10001); + odd.getLocalDGM().put("odd", 1); + odd.getLocalDGM().put("finishCount",finishCount); + even.getLocalDGM().put("finishCount", finishCount); + + } +}