Mercurial > hg > Database > Alice
changeset 559:1c7732a88920 dispose
add IncrementTest
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 23 Nov 2015 19:50:29 +0900 |
parents | 0259a8aba18c |
children | 8688b613b1d4 |
files | src/main/java/alice/test/codesegment/local/Increment/Increment.java src/main/java/alice/test/codesegment/local/Increment/StartIncrement.java src/main/java/alice/test/codesegment/local/Increment/TestIncrement.java src/main/java/alice/test/codesegment/local/TestCodeSegment.java |
diffstat | 4 files changed, 70 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/codesegment/local/Increment/Increment.java Mon Nov 23 19:50:29 2015 +0900 @@ -0,0 +1,34 @@ +package alice.test.codesegment.local.Increment; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +/** + * Created by e125769 on 11/22/15. + */ +public class Increment extends CodeSegment { + Receiver info = ids.create(CommandType.TAKE); + String process; + + Increment(String process){ + info.setKey("num"); + this.process = process; + } + + @Override + public void run() { + int num = info.asInteger(); + System.out.println(process + " : " + num); + + ++num; + + if (num == 10) { + System.exit(0); + return; + } + + ods.put("num", num); + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/codesegment/local/Increment/StartIncrement.java Mon Nov 23 19:50:29 2015 +0900 @@ -0,0 +1,20 @@ +package alice.test.codesegment.local.Increment; + +import alice.codesegment.CodeSegment; + +/** + * Created by e125769 on 11/22/15. + */ +public class StartIncrement extends CodeSegment { + + @Override + public void run() { + ods.put("num", 0); + + for (int i = 0; i < 10; i++){ + Increment cs1 = new Increment("process1"); + Increment cs2 = new Increment("process2"); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/codesegment/local/Increment/TestIncrement.java Mon Nov 23 19:50:29 2015 +0900 @@ -0,0 +1,16 @@ +package alice.test.codesegment.local.Increment; + +import alice.daemon.AliceDaemon; +import alice.daemon.Config; + +/** + * Created by e125769 on 11/22/15. + */ +public class TestIncrement { + + public static void main(String args[]) { + new AliceDaemon(new Config(args)).listen(); // logger off + new StartIncrement().execute(); + } + +}
--- a/src/main/java/alice/test/codesegment/local/TestCodeSegment.java Sat Nov 21 18:23:51 2015 +0900 +++ b/src/main/java/alice/test/codesegment/local/TestCodeSegment.java Mon Nov 23 19:50:29 2015 +0900 @@ -15,7 +15,6 @@ System.out.println("type = " + arg1.type); System.out.println("index = " + arg1.index); System.out.println("data = " + arg1.getVal()); - System.out.println(((Value)arg1.getVal()).getType());//←伝統。なくてもいい。 if (arg1.index == 10) { System.exit(0);