Mercurial > hg > Database > Alice
diff src/main/java/alice/test/topology/fish/CheckMyName.java @ 419:aefbe41fcf12 dispose
change tab to space
author | sugi |
---|---|
date | Tue, 15 Jul 2014 16:00:22 +0900 |
parents | 8f71c3e6f11d |
children | 15eeb439830c |
line wrap: on
line diff
--- a/src/main/java/alice/test/topology/fish/CheckMyName.java Tue Jul 15 06:15:53 2014 +0900 +++ b/src/main/java/alice/test/topology/fish/CheckMyName.java Tue Jul 15 16:00:22 2014 +0900 @@ -8,51 +8,51 @@ import alice.datasegment.Receiver; public class CheckMyName extends CodeSegment { - - private Receiver host = ids.create(CommandType.PEEK); - - public CheckMyName(){ - host.setKey("host"); - } - - @Override - public void run() { - String name = host.asString(); - Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); - Matcher matcher = pattern.matcher(name); - - matcher.find(); - String type = matcher.group(1); - int num = new Integer(matcher.group(2)); - - if (type.equals("cli")) { - System.out.println("********************I am cli" + num); - ods.update("local", "width", 400); - - GetStartX cs = new GetStartX(); - cs.startX.setKey("local", "startX"); - - } else if (type.equals("node")) { - System.out.println("********************I am node" + num); - WidthReceiver cs = new WidthReceiver(); - cs.widths.setKey("local", "widths"); - cs.routing.setKey("local", "routing"); - - PeekStartX cs2 = new PeekStartX(0); - cs2.startX.setKey("local", "startX"); - - ods.put("local", "routing", new RoutingTable()); - if (num == 0) { // First node ("node0") check - StartStartX cs3 = new StartStartX(); - cs3.width.setKey("local", "width"); - //ods.update("local", "startX", 0); - return; - } - } - - SendWidth cs = new SendWidth(); - cs.width.setKey("local", "width"); + + private Receiver host = ids.create(CommandType.PEEK); + + public CheckMyName(){ + host.setKey("host"); + } + + @Override + public void run() { + String name = host.asString(); + Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); + Matcher matcher = pattern.matcher(name); + + matcher.find(); + String type = matcher.group(1); + int num = new Integer(matcher.group(2)); + + if (type.equals("cli")) { + System.out.println("********************I am cli" + num); + ods.update("local", "width", 400); - } + GetStartX cs = new GetStartX(); + cs.startX.setKey("local", "startX"); + + } else if (type.equals("node")) { + System.out.println("********************I am node" + num); + WidthReceiver cs = new WidthReceiver(); + cs.widths.setKey("local", "widths"); + cs.routing.setKey("local", "routing"); + + PeekStartX cs2 = new PeekStartX(0); + cs2.startX.setKey("local", "startX"); + + ods.put("local", "routing", new RoutingTable()); + if (num == 0) { // First node ("node0") check + StartStartX cs3 = new StartStartX(); + cs3.width.setKey("local", "width"); + //ods.update("local", "startX", 0); + return; + } + } + + SendWidth cs = new SendWidth(); + cs.width.setKey("local", "width"); + + } }