view src/alice/test/codesegment/remote/RemoteIncrement.java @ 32:2bfb796b0fa1

change method to create DataSegmentReceiver
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 17 Jan 2012 20:49:26 +0900
parents 2ca2d961a8d2
children 20c67f673224
line wrap: on
line source

package alice.test.codesegment.remote;

import org.msgpack.type.ValueFactory;

import alice.codesegment.CodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.DataSegmentReceiver;

public class RemoteIncrement extends CodeSegment {

	public DataSegmentReceiver num = ids.createReceiver(CommandType.TAKE);

	@Override
	public void run() {
		int num = this.num.val.asIntegerValue().getInt();
		System.out.println("[CodeSegment] " + num++);
		if (num == 10) System.exit(0);

		RemoteIncrement cs = new RemoteIncrement();
		cs.num.setKey("remote", "num");
		
		ods.put("local", "num", ValueFactory.createIntegerValue(num));
	}

}