view src/main/java/jp/ac/u_ryukyu/alicevnc/CheckMyName.java @ 34:aace9df1462e

refactor
author sugi
date Thu, 13 Nov 2014 16:09:09 +0900
parents 556e27a53219
children 9354e8a1d03b
line wrap: on
line source

package jp.ac.u_ryukyu.alicevnc;

import alice.codesegment.CodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.Receiver;

public class CheckMyName extends CodeSegment {

    private Receiver info = ids.create(CommandType.PEEK);

    public CheckMyName(){
        info.setKey("host");
    }

    @Override
    public void run() {
        if ("node0".equals(info.asString())) {
            new CreateWindow("local");
            new NegotiateVNCServer();
        } else {
            new CreateWindow("parent");
        }

        new ReceiveAliceVNCMessage();
        new SendChangeRequest();
    }

}