view src/alice/test/topology/movement/CheckMyName.java @ 88:33a19ca88e43 working

Singleton is removed .
author sugi
date Mon, 04 Jun 2012 16:08:53 +0900
parents 899b2b78ac75
children e269cedd8bae
line wrap: on
line source

package alice.test.topology.movement;

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 {
	Receiver host = ids.create(CommandType.PEEK);
	Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
	
	@Override
	public void run(){
		
		String name = host.asString();
		Matcher matcher = pattern.matcher(name);
		
		matcher.find();
		String type = matcher.group(1);
		int cliNum = new Integer(matcher.group(2));
		
		if (type.equals("cli")){
			System.out.println("cli"+cliNum);
			MakeFrame frame =  new MakeFrame();
			MakeObject obj = null;
			checkLocation cs = new checkLocation(frame,obj);
			cs.host.setKey("local","host");
			cs.nowX.setKey("parent","fish1X");
						
					
		}else if(type.equals("node")){
			System.out.println("node0");
			ods.update("local", "fish1X", -1000);
			
		}
	}
}