view src/main/java/alice/test/codesegment/local/TestCodeSegment.java @ 548:b44a2bf16eb3 dispose

add IDS ODS constructor & work TestLocalAlice
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Tue, 25 Aug 2015 19:54:30 +0900
parents e91a574b69de
children 9f577ff4f7ea
line wrap: on
line source

package alice.test.codesegment.local;

import alice.codesegment.CodeSegment;
import alice.daemon.AliceDaemon;
import alice.datasegment.CommandType;
import alice.datasegment.Receiver;
import org.msgpack.type.Value;

public class TestCodeSegment extends CodeSegment {

    // create input datasegment arg1
    Receiver arg1 = ids.create(CommandType.PEEK);//peek用Receiverを生成

    @Override
    public void run() {
        System.out.println("in TestCodeSegment");
        System.out.println("type = " + arg1.type);
        int num = arg1.asInteger();
        System.out.println("data = " + num);

        if (num++ == 10) {
            System.exit(0);
            return;
        }

        TestCodeSegment cs = new TestCodeSegment();
        cs.arg1.setKey("key1", this);//Receiverに値をpeekしてくる

        // DataSegment.get("local").update
        ods.update("local", "key1", num);
    }

}