view src/alice/test/topology/aquarium/fx/CheckMyName.java @ 18:4e5507afb41f

"MAXSIZE" change automatically
author e095732
date Mon, 04 Feb 2013 01:23:24 +0900
parents e027d228c455
children a1e4a3aafdd1
line wrap: on
line source

package alice.test.topology.aquarium.fx;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

public class CheckMyName extends CodeSegment{
	private Receiver host = ids.create(CommandType.PEEK);
	private Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
	
	public CheckMyName(){
		host.setKey("local","host");
	}
	
	@Override
	public void run() {
		String name = host.asString();
		Matcher matcher = pattern.matcher(name);
		matcher.find();
		System.out.println(name);
		new Share("MAXSIZE");
		int num = new Integer(matcher.group(2));
		
		ods.put("local", "mynum", num);
		ods.put("local", "width", 800);
		ods.put("local", "objCnt", 5);
		
		if (num==0) {
			new TopNode().execute();
		} else {
			new OtherNode();
		}
		
	}
}