comparison src/main/java/alice/test/topology/share/CheckLocalIndex.java @ 345:8f71c3e6f11d

Change directory structure Maven standard
author sugi
date Wed, 16 Apr 2014 18:26:07 +0900
parents
children aefbe41fcf12
comparison
equal deleted inserted replaced
344:9f97ec18f8c5 345:8f71c3e6f11d
1 package alice.test.topology.share;
2
3 import java.util.List;
4
5 import alice.codesegment.CodeSegment;
6 import alice.datasegment.CommandType;
7 import alice.datasegment.Receiver;
8
9 public class CheckLocalIndex extends CodeSegment {
10
11 private Receiver data = ids.create(CommandType.PEEK);
12 private Receiver list = ids.create(CommandType.PEEK);
13 private Receiver host = ids.create(CommandType.PEEK);
14
15
16 public CheckLocalIndex(String key, int index) {
17 this.host.setKey("host");
18 this.list.setKey("_CLIST");
19 this.data.setKey(key, index);
20 }
21
22 @Override
23 public void run() {
24 @SuppressWarnings("unchecked")
25 List<String> r = list.asClass(List.class);
26 int count = 0;
27 boolean flag = false;
28 for (String node : r) {
29 if (node.equals("parent")) {
30 flag = true;
31 }
32 if (!node.equals(this.data.from)) {
33 ods.update(node, data.key, data.getVal());
34 count++;
35 }
36 }
37 if (count == 0 && flag) {
38 ods.put("parent", "data", data.getVal());
39 }
40 new CheckLocalIndex(data.key, data.index);
41
42 }
43
44 }