Mercurial > hg > Database > Alice
view src/alice/test/topology/share/CheckLocalIndex.java @ 217:b5c642ba998e working
change as** method and remove "local" key in TEST
author | sugi |
---|---|
date | Wed, 27 Mar 2013 20:02:38 +0900 |
parents | 21bd8af1cf26 |
children | 68f6e0fa4a89 |
line wrap: on
line source
package alice.test.topology.share; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.test.topology.aquarium.Routing; import alice.test.topology.aquarium.RoutingTable; public class CheckLocalIndex extends CodeSegment { private Receiver data = ids.create(CommandType.PEEK); private Receiver list = ids.create(CommandType.PEEK); private Receiver host = ids.create(CommandType.PEEK); private String key; public CheckLocalIndex(String key, int index){ this.key = key; this.host.setKey("host"); this.list.setKey("list"); this.data.setKey(this.key, index); } @Override public void run() { RoutingTable rt = this.list.asClass(RoutingTable.class); int count = 0; boolean flag = false; for (Routing r : rt.table) { if (r.name.equals("parent"))flag=true; if (!r.name.equals(this.data.from)){ ods.update(r.name, this.key, this.data.getVal()); count++; } } if (count==0&&flag){ ods.put("parent", "data", this.data.getVal()); } new CheckLocalIndex(this.key, this.data.index); } }