Mercurial > hg > Database > Christie-sharp
changeset 49:6d733b2ea461
add OddEvenTest
author | riono <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 10 Jan 2022 03:16:33 +0900 |
parents | 6e5c0977d756 |
children | 476b6efeca5b |
files | Christie_net.csproj Test/Example/FizzBuzz/Counter.cs Test/Example/FizzBuzz/FizzBuzz.cs Test/Example/FizzBuzz/StartFizzBuzz.cs Test/Example/OddEven/EvenCodeGear.cs Test/Example/OddEven/OddCodeGear.cs Test/Example/OddEven/StarOddEven.cs |
diffstat | 7 files changed, 67 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Christie_net.csproj Mon Jan 10 00:56:00 2022 +0900 +++ b/Christie_net.csproj Mon Jan 10 03:16:33 2022 +0900 @@ -3,7 +3,7 @@ <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> - <StartupObject>Christie_net.Test.Example.RemoteTake.StartRemoteTake</StartupObject> + <StartupObject>Christie_net.Test.Example.OddEven.StarOddEven</StartupObject> </PropertyGroup> <ItemGroup>
--- a/Test/Example/FizzBuzz/Counter.cs Mon Jan 10 00:56:00 2022 +0900 +++ b/Test/Example/FizzBuzz/Counter.cs Mon Jan 10 03:16:33 2022 +0900 @@ -10,7 +10,7 @@ public override void Run(CodeGearManager cgm) { if (count <= 100) { GetDgm("FizzBuzz").Put("num", count); - //cgm.GetLocalDGM().Put("cunt", count+1); + cgm.GetLocalDGM().Put("cunt", count+1); cgm.Setup(new Counter()); } else {
--- a/Test/Example/FizzBuzz/FizzBuzz.cs Mon Jan 10 00:56:00 2022 +0900 +++ b/Test/Example/FizzBuzz/FizzBuzz.cs Mon Jan 10 03:16:33 2022 +0900 @@ -18,7 +18,7 @@ } else { Console.WriteLine(num); } - GetDgm("Counter").Put("count", num+1); + //GetDgm("Counter").Put("count", num+1); cgm.Setup(new FizzBuzz()); } }
--- a/Test/Example/FizzBuzz/StartFizzBuzz.cs Mon Jan 10 00:56:00 2022 +0900 +++ b/Test/Example/FizzBuzz/StartFizzBuzz.cs Mon Jan 10 03:16:33 2022 +0900 @@ -14,7 +14,7 @@ counter.Setup(new Counter()); fizzbuzz.Setup(new FizzBuzz()); counter.CreateRemoteDGM("FizzBuzz", "localhost", 10002); - fizzbuzz.CreateRemoteDGM("Counter", "localhost", 10001); + //fizzbuzz.CreateRemoteDGM("Counter", "localhost", 10001); counter.GetLocalDGM().Put("count", 1); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Test/Example/OddEven/EvenCodeGear.cs Mon Jan 10 03:16:33 2022 +0900 @@ -0,0 +1,23 @@ +using System; +using Christie_net.annotation; +using Christie_net.codegear; + +namespace Christie_net.Test.Example.OddEven { +public class EvenCodeGear : CodeGear { + [Take] private int even; + [Peek] private int finishCount; + + public override void Run(CodeGearManager cgm) { + Console.WriteLine(even + ":even"); + if (finishCount != even) { + GetDgm("odd").Put("odd", even+1); + cgm.Setup(new EvenCodeGear()); + } + + if (finishCount <= even) { + GetDgm("odd").Finish(); + cgm.GetLocalDGM().Finish(); + } + } +} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Test/Example/OddEven/OddCodeGear.cs Mon Jan 10 03:16:33 2022 +0900 @@ -0,0 +1,18 @@ +using System; +using Christie_net.annotation; +using Christie_net.codegear; + +namespace Christie_net.Test.Example.OddEven { +public class OddCodeGear : CodeGear { + [Take] public int odd; + [Peek] public int finishCount; + + public override void Run(CodeGearManager cgm) { + Console.WriteLine(odd + " : odd"); + if (finishCount + 1 != odd) { + GetDgm("even").Put("even", odd + 1); + cgm.Setup(new OddCodeGear()); + } + } +} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Test/Example/OddEven/StarOddEven.cs Mon Jan 10 03:16:33 2022 +0900 @@ -0,0 +1,22 @@ +using Christie_net.codegear; + +namespace Christie_net.Test.Example.OddEven { +public class StarOddEven : StartCodeGear { + public StarOddEven(CodeGearManager cgm) : base(cgm) { } + + public static void Main() { + 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); + } +} +} \ No newline at end of file