Mercurial > hg > Members > tatsuki > Alice
diff src/alice/test/topology/movement/CheckMyName.java @ 81:02dfb6c72632 working
This is movement test
author | sugi |
---|---|
date | Thu, 24 May 2012 00:20:16 +0900 |
parents | |
children | 909e1c9bc6fc |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/movement/CheckMyName.java Thu May 24 00:20:16 2012 +0900 @@ -0,0 +1,39 @@ +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); + @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 cliNum = new Integer(matcher.group(2)); + + if (type.equals("cli")){ + System.out.println("cli"+cliNum); + + FishMovement.getInstance(); + + SendLocation cs = new SendLocation(); + cs.nowX.setKey("parent","fishX"); + cs.nowY.setKey("parent","fishY"); + + }else if(type.equals("node")){ + System.out.println("node0"); + ods.update("local", "fishX", 10); + ods.update("local", "fishY", 10); + + } + } +}