2
|
1 package jungle.test.codesegment.practice;
|
|
2
|
|
3 import alice.codesegment.CodeSegment;
|
|
4 import alice.datasegment.CommandType;
|
|
5 import alice.datasegment.Receiver;
|
|
6 import org.msgpack.type.Value;
|
|
7
|
|
8 public class TestCodeSegment extends CodeSegment {
|
|
9
|
|
10 // create input datasegment arg1
|
|
11 Receiver arg1 = ids.create(CommandType.PEEK);
|
|
12
|
|
13 @Override
|
|
14 public void run() {
|
|
15 System.out.println("type = " + arg1.type);
|
|
16 System.out.println("index = " + arg1.index);
|
|
17 System.out.println("data = " + arg1.getVal());
|
|
18 System.out.println(((Value)arg1.getVal()).getType());
|
|
19
|
|
20 if (arg1.index == 10) {
|
|
21 System.exit(0);
|
|
22 return;
|
|
23 }
|
|
24
|
|
25 TestCodeSegment cs = new TestCodeSegment();
|
|
26 cs.arg1.setKey("key1", arg1.index);
|
|
27
|
|
28 // DataSegment.get("local").update
|
|
29 ods.update("local", "key1", "String data");
|
|
30 }
|
|
31
|
|
32 }
|