annotate src/jungle/test/codesegment/practice/TestCodeSegment.java @ 2:20498c88a70d

add Container
author one
date Sun, 09 Jun 2013 13:53:16 +0900
parents
children 49c0eaa4dce2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
20498c88a70d add Container
one
parents:
diff changeset
1 package jungle.test.codesegment.practice;
20498c88a70d add Container
one
parents:
diff changeset
2
20498c88a70d add Container
one
parents:
diff changeset
3 import alice.codesegment.CodeSegment;
20498c88a70d add Container
one
parents:
diff changeset
4 import alice.datasegment.CommandType;
20498c88a70d add Container
one
parents:
diff changeset
5 import alice.datasegment.Receiver;
20498c88a70d add Container
one
parents:
diff changeset
6 import org.msgpack.type.Value;
20498c88a70d add Container
one
parents:
diff changeset
7
20498c88a70d add Container
one
parents:
diff changeset
8 public class TestCodeSegment extends CodeSegment {
20498c88a70d add Container
one
parents:
diff changeset
9
20498c88a70d add Container
one
parents:
diff changeset
10 // create input datasegment arg1
20498c88a70d add Container
one
parents:
diff changeset
11 Receiver arg1 = ids.create(CommandType.PEEK);
20498c88a70d add Container
one
parents:
diff changeset
12
20498c88a70d add Container
one
parents:
diff changeset
13 @Override
20498c88a70d add Container
one
parents:
diff changeset
14 public void run() {
20498c88a70d add Container
one
parents:
diff changeset
15 System.out.println("type = " + arg1.type);
20498c88a70d add Container
one
parents:
diff changeset
16 System.out.println("index = " + arg1.index);
20498c88a70d add Container
one
parents:
diff changeset
17 System.out.println("data = " + arg1.getVal());
20498c88a70d add Container
one
parents:
diff changeset
18 System.out.println(((Value)arg1.getVal()).getType());
20498c88a70d add Container
one
parents:
diff changeset
19
20498c88a70d add Container
one
parents:
diff changeset
20 if (arg1.index == 10) {
20498c88a70d add Container
one
parents:
diff changeset
21 System.exit(0);
20498c88a70d add Container
one
parents:
diff changeset
22 return;
20498c88a70d add Container
one
parents:
diff changeset
23 }
20498c88a70d add Container
one
parents:
diff changeset
24
20498c88a70d add Container
one
parents:
diff changeset
25 TestCodeSegment cs = new TestCodeSegment();
20498c88a70d add Container
one
parents:
diff changeset
26 cs.arg1.setKey("key1", arg1.index);
20498c88a70d add Container
one
parents:
diff changeset
27
20498c88a70d add Container
one
parents:
diff changeset
28 // DataSegment.get("local").update
20498c88a70d add Container
one
parents:
diff changeset
29 ods.update("local", "key1", "String data");
20498c88a70d add Container
one
parents:
diff changeset
30 }
20498c88a70d add Container
one
parents:
diff changeset
31
20498c88a70d add Container
one
parents:
diff changeset
32 }