annotate src/alice/test/topology/movement/CheckMyName.java @ 94:38f4021353c5 working

"setKey" is in the instance
author sugi
date Mon, 18 Jun 2012 17:10:23 +0900
parents 6601f8854126
children df786bf8f036
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);
87
899b2b78ac75 minor change
sugi
parents: 83
diff changeset
12 Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
899b2b78ac75 minor change
sugi
parents: 83
diff changeset
13
94
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
14
81
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
15 @Override
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
16 public void run(){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
17
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
18 String name = host.asString();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
19 Matcher matcher = pattern.matcher(name);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
20
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
21 matcher.find();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
22 String type = matcher.group(1);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
23 int cliNum = new Integer(matcher.group(2));
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
24
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
25 if (type.equals("cli")){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
26 System.out.println("cli"+cliNum);
93
6601f8854126 can KeyInputCodeSegment
sugi
parents: 92
diff changeset
27
88
33a19ca88e43 Singleton is removed .
sugi
parents: 87
diff changeset
28 MakeFrame frame = new MakeFrame();
93
6601f8854126 can KeyInputCodeSegment
sugi
parents: 92
diff changeset
29
94
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
30 MakeObject obj3 = new MakeObject(frame);
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
31 frame.register(obj3);
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
32 new CheckFishLocation(obj3,"fish3X");
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
33
89
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
34 MakeObject obj = new MakeObject(frame);
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
35 frame.register(obj);
94
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
36 new CheckFishLocation(obj,"fish1X");
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
37
81
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
38 }else if(type.equals("node")){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
39 System.out.println("node0");
94
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
40 ods.update("local", "fish3X", 0);
88
33a19ca88e43 Singleton is removed .
sugi
parents: 87
diff changeset
41 ods.update("local", "fish1X", -1000);
94
38f4021353c5 "setKey" is in the instance
sugi
parents: 93
diff changeset
42
81
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
43
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
44 }
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
45 }
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
46 }