Mercurial > hg > Database > Alice
diff src/main/java/alice/test/topology/aquarium/fx/CheckMyName.java @ 419:aefbe41fcf12 dispose
change tab to space
author | sugi |
---|---|
date | Tue, 15 Jul 2014 16:00:22 +0900 (2014-07-15) |
parents | d28b1216d615 |
children | 6e304a7a60e7 |
line wrap: on
line diff
--- a/src/main/java/alice/test/topology/aquarium/fx/CheckMyName.java Tue Jul 15 06:15:53 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/CheckMyName.java Tue Jul 15 16:00:22 2014 +0900 @@ -9,47 +9,47 @@ import alice.datasegment.Receiver; public class CheckMyName extends CodeSegment { - private Receiver host = ids.create(CommandType.PEEK); - private Pattern pattern = Pattern.compile("^(node|cli|local)([0-9]+)$"); - private int INNER_WIDTH = 10; - - public CheckMyName(){ - host.setKey("host"); - } + private Receiver host = ids.create(CommandType.PEEK); + private Pattern pattern = Pattern.compile("^(node|cli|local)([0-9]+)$"); + private int INNER_WIDTH = 10; + + public CheckMyName(){ + host.setKey("host"); + } - @Override - public void run() { - String name = host.asString(); - Matcher matcher = pattern.matcher(name); - matcher.find(); + @Override + public void run() { + String name = host.asString(); + Matcher matcher = pattern.matcher(name); + matcher.find(); + + // use view scope + int num = new Integer(matcher.group(2)); + // scope: A_n = 5 + 10(n - 1); + int median = INNER_WIDTH * num; + ods.put("median", median); // node0 median : 0 + // node1 median : 10 + // node2 median : 20 - // use view scope - int num = new Integer(matcher.group(2)); - // scope: A_n = 5 + 10(n - 1); - int median = INNER_WIDTH * num; - ods.put("median", median); // node0 median : 0 - // node1 median : 10 - // node2 median : 20 - - if (num == 0){ - // only root node create fishInfoList registered all fishInfo - // fishInfoList send children for checking all Fish object in own scene - new RegisterList(); - ods.put("registeredList", new ArrayList<FishInfo>()); - } - - new CheckAllFishInfoExist(); + if (num == 0){ + // only root node create fishInfoList registered all fishInfo + // fishInfoList send children for checking all Fish object in own scene + new RegisterList(); + ods.put("registeredList", new ArrayList<FishInfo>()); + } + + new CheckAllFishInfoExist(); - FishInfo fishInfo = new FishInfo(median,0,0); - fishInfo.setName(name); - - ods.put("OwnFishP", fishInfo.clone()); - ods.put("fishData", fishInfo); + FishInfo fishInfo = new FishInfo(median,0,0); + fishInfo.setName(name); + + ods.put("OwnFishP", fishInfo.clone()); + ods.put("fishData", fishInfo); - new CreateObject(); - new AddObject(); - - String[] args = {name}; - Aquarium.main(args); - } + new CreateObject(); + new AddObject(); + + String[] args = {name}; + Aquarium.main(args); + } }