diff src/main/java/jp/ac/u_ryukyu/alicevnc/CheckMyName.java @ 86:4a8755a30aa8 default tip

add topology manager number to 'host' key
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Wed, 10 Feb 2016 22:54:46 +0900
parents 3a27a0727705
children
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/CheckMyName.java	Sat Jan 30 21:12:23 2016 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/CheckMyName.java	Wed Feb 10 22:54:46 2016 +0900
@@ -7,24 +7,28 @@
 
 public class CheckMyName extends CodeSegment {
 
+    private int topMNumber;
     private Receiver info = ids.create(CommandType.PEEK);
 
-    public CheckMyName(){
-        info.setKey("host");
+    public CheckMyName(int topMNumber){
+        this.topMNumber = topMNumber;
+        for (int i = 1; i <= topMNumber; i++) {
+            info.setKey("host"+i);
+        }
     }
 
     @Override
     public void run() {
-        System.out.println("CheckMyName host index:" + DataSegment.getLocal().getDSindex("host"));
+        //System.out.println("CheckMyName host index:" + DataSegment.getLocal().getDSindex("host"));
         if ("node0".equals(info.asString())) {
             new CreateWindow("local");
-            new NegotiateVNCServer();
+            new NegotiateVNCServer(topMNumber);
         } else {
             new CreateWindow("parent");
         }
 
-        new ReceiveAliceVNCMessage();
-        new SendChangeRequest();
+        new ReceiveAliceVNCMessage(topMNumber);
+        new SendChangeRequest(topMNumber);
     }
 
 }