annotate src/alice/test/topology/movement/CheckMyName.java @ 89:e269cedd8bae working

Test two fish
author sugi
date Tue, 05 Jun 2012 00:01:27 +0900
parents 33a19ca88e43
children 19f3bd33277d
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
81
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
14 @Override
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
15 public void run(){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
16
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
17 String name = host.asString();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
18 Matcher matcher = pattern.matcher(name);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
19
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
20 matcher.find();
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
21 String type = matcher.group(1);
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
22 int cliNum = new Integer(matcher.group(2));
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
23
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
24 if (type.equals("cli")){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
25 System.out.println("cli"+cliNum);
88
33a19ca88e43 Singleton is removed .
sugi
parents: 87
diff changeset
26 MakeFrame frame = new MakeFrame();
89
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
27 MakeObject obj = new MakeObject(frame);
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
28 frame.register(obj);
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
29 checkLocation cs = new checkLocation(obj,"fish1X");
83
909e1c9bc6fc set range
sugi
parents: 81
diff changeset
30 cs.host.setKey("local","host");
88
33a19ca88e43 Singleton is removed .
sugi
parents: 87
diff changeset
31 cs.nowX.setKey("parent","fish1X");
33a19ca88e43 Singleton is removed .
sugi
parents: 87
diff changeset
32
89
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
33 MakeObject obj2 = new MakeObject(frame);
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
34 frame.register(obj2);
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
35 checkLocation cs2 = new checkLocation(obj2,"fish2X");
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
36 cs2.host.setKey("local","host");
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
37 cs2.nowX.setKey("parent","fish2X");
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
38
81
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
39
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
40 }else if(type.equals("node")){
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
41 System.out.println("node0");
88
33a19ca88e43 Singleton is removed .
sugi
parents: 87
diff changeset
42 ods.update("local", "fish1X", -1000);
89
e269cedd8bae Test two fish
sugi
parents: 88
diff changeset
43 ods.update("local", "fish2X", -1000);
81
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 }
02dfb6c72632 This is movement test
sugi
parents:
diff changeset
47 }