annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
1 package alice.test.topology.movement;
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
2
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
3 import java.util.regex.Matcher;
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
4 import java.util.regex.Pattern;
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
5
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
6 import alice.codesegment.CodeSegment;
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
7 import alice.datasegment.CommandType;
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
8 import alice.datasegment.Receiver;
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
9
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
10 public class CheckMyName extends CodeSegment {
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
11 Receiver host = ids.create(CommandType.PEEK);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
12 @Override
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
13 public void run(){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
14
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
15 String name = host.asString();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
16 Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
17 Matcher matcher = pattern.matcher(name);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
18
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
19 matcher.find();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
20 String type = matcher.group(1);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
21 int cliNum = new Integer(matcher.group(2));
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
22
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
23 if (type.equals("cli")){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
24 System.out.println("cli"+cliNum);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
25
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
26 FishMovement.getInstance();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
27
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
28 SendLocation cs = new SendLocation();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
29 cs.nowX.setKey("parent","fishX");
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
30 cs.nowY.setKey("parent","fishY");
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
31
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
32 }else if(type.equals("node")){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
33 System.out.println("node0");
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
34 ods.update("local", "fishX", 10);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
35 ods.update("local", "fishY", 10);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
36
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
37 }
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
38 }
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
39 }