comparison src/alice/test/topology/fishmodel/alpha/CheckMyName.java @ 107:a8f77957a477 working

create new model to share fish point
author sugi
date Tue, 10 Jul 2012 02:30:25 +0900
parents src/alice/test/topology/movement/CheckMyName.java@993a9f194615
children aa9fc077c286
comparison
equal deleted inserted replaced
106:c84a2b4a877a 107:a8f77957a477
1 package alice.test.topology.fishmodel.alpha;
2
3 import java.util.regex.Matcher;
4 import java.util.regex.Pattern;
5
6 import alice.codesegment.CodeSegment;
7 import alice.datasegment.CommandType;
8 import alice.datasegment.Receiver;
9 import alice.test.topology.share.CheckLocalIndex;
10 import alice.test.topology.share.CheckParentIndex;
11
12 public class CheckMyName extends CodeSegment {
13 Receiver host = ids.create(CommandType.PEEK);
14 Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
15 String key = "fish";
16
17 @Override
18 public void run(){
19
20 String name = host.asString();
21 Matcher matcher = pattern.matcher(name);
22
23 matcher.find();
24 String type = matcher.group(1);
25 int cliNum = new Integer(matcher.group(2));
26
27 if (type.equals("cli")){
28 System.out.println("cli"+cliNum);
29 ods.update("local", key, new FishPoint(0.0f,0.0f));
30 MakeFrame frame = new MakeFrame();
31
32 MakeObject obj3 = new MakeObject(frame);
33 frame.register(obj3);
34 new CheckFishLocation(obj3,key,0);
35 new CheckLocalIndex(key,0);
36 new CheckParentIndex(key,0);
37 /*
38 MakeObject obj = new MakeObject(frame);
39 frame.register(obj);
40 new CheckFishLocation(obj,"fish1X");
41 */
42 }else if(type.equals("node")){
43 System.out.println("node0");
44
45 ods.update("local", key, new FishPoint(0.0f,0.0f));
46 //ods.update("local", "fish1X", new FishPoint(-1.0f,0.0f));
47 if(cliNum == 0){
48 new LookData(key,0);
49 } else {
50 new CheckLocalIndex(key,0);
51 new CheckParentIndex(key,0);
52
53 }
54
55
56
57 }
58 }
59 }