Mercurial > hg > Database > Alice
comparison src/main/java/alice/test/topology/share/CheckLocalIndex.java @ 419:aefbe41fcf12 dispose
change tab to space
author | sugi |
---|---|
date | Tue, 15 Jul 2014 16:00:22 +0900 |
parents | 8f71c3e6f11d |
children | 15eeb439830c 767d93626b88 |
comparison
equal
deleted
inserted
replaced
418:a269a019f5f8 | 419:aefbe41fcf12 |
---|---|
6 import alice.datasegment.CommandType; | 6 import alice.datasegment.CommandType; |
7 import alice.datasegment.Receiver; | 7 import alice.datasegment.Receiver; |
8 | 8 |
9 public class CheckLocalIndex extends CodeSegment { | 9 public class CheckLocalIndex extends CodeSegment { |
10 | 10 |
11 private Receiver data = ids.create(CommandType.PEEK); | 11 private Receiver data = ids.create(CommandType.PEEK); |
12 private Receiver list = ids.create(CommandType.PEEK); | 12 private Receiver list = ids.create(CommandType.PEEK); |
13 private Receiver host = ids.create(CommandType.PEEK); | 13 private Receiver host = ids.create(CommandType.PEEK); |
14 | 14 |
15 | 15 |
16 public CheckLocalIndex(String key, int index) { | 16 public CheckLocalIndex(String key, int index) { |
17 this.host.setKey("host"); | 17 this.host.setKey("host"); |
18 this.list.setKey("_CLIST"); | 18 this.list.setKey("_CLIST"); |
19 this.data.setKey(key, index); | 19 this.data.setKey(key, index); |
20 } | 20 } |
21 | 21 |
22 @Override | 22 @Override |
23 public void run() { | 23 public void run() { |
24 @SuppressWarnings("unchecked") | 24 @SuppressWarnings("unchecked") |
25 List<String> r = list.asClass(List.class); | 25 List<String> r = list.asClass(List.class); |
26 int count = 0; | 26 int count = 0; |
27 boolean flag = false; | 27 boolean flag = false; |
28 for (String node : r) { | 28 for (String node : r) { |
29 if (node.equals("parent")) { | 29 if (node.equals("parent")) { |
30 flag = true; | 30 flag = true; |
31 } | 31 } |
32 if (!node.equals(this.data.from)) { | 32 if (!node.equals(this.data.from)) { |
33 ods.update(node, data.key, data.getVal()); | 33 ods.update(node, data.key, data.getVal()); |
34 count++; | 34 count++; |
35 } | 35 } |
36 } | 36 } |
37 if (count == 0 && flag) { | 37 if (count == 0 && flag) { |
38 ods.put("parent", "data", data.getVal()); | 38 ods.put("parent", "data", data.getVal()); |
39 } | 39 } |
40 new CheckLocalIndex(data.key, data.index); | 40 new CheckLocalIndex(data.key, data.index); |
41 | 41 |
42 } | 42 } |
43 | 43 |
44 } | 44 } |