annotate src/alice/test/topology/aquarium/CheckMyName.java @ 270:23e53aaa8720

reconnect manager worked.
author sugi
date Wed, 21 Aug 2013 15:33:49 +0900
parents ba55adb8a042
children 3667ab045530
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
134
53aff28cde6b change package
sugi
parents: 133
diff changeset
1 package alice.test.topology.aquarium;
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
2
170
6a69891b7232 change view point
sugi
parents: 145
diff changeset
3 import java.util.Random;
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
4 import java.util.regex.Matcher;
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
5 import java.util.regex.Pattern;
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
6
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
7 import alice.codesegment.CodeSegment;
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
8 import alice.datasegment.CommandType;
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
9 import alice.datasegment.Receiver;
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
10
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
11
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
12 public class CheckMyName extends CodeSegment {
138
87f1a30a8c82 change range automatic
sugi
parents: 135
diff changeset
13 private Receiver host = ids.create(CommandType.PEEK);
87f1a30a8c82 change range automatic
sugi
parents: 135
diff changeset
14 private Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
87f1a30a8c82 change range automatic
sugi
parents: 135
diff changeset
15 private String key = "fish";
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
16
135
2f401fd70311 create No Graphic aquarium
sugi
parents: 134
diff changeset
17 public CheckMyName(){
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
18 host.setKey("host");
135
2f401fd70311 create No Graphic aquarium
sugi
parents: 134
diff changeset
19 }
2f401fd70311 create No Graphic aquarium
sugi
parents: 134
diff changeset
20
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
21 @Override
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
22 public void run(){
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
23 String name = host.asString();
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
24 Matcher matcher = pattern.matcher(name);
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
25
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
26 matcher.find();
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
27 String type = matcher.group(1);
110
aa9fc077c286 remove host from checkFishLocation
sugi
parents: 109
diff changeset
28 int num = new Integer(matcher.group(2));
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
29 ods.put("host_num", num*2);
170
6a69891b7232 change view point
sugi
parents: 145
diff changeset
30 MakeFrame frame = new MakeFrame(name,num*2);
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
31 ods.put("num", 1);
135
2f401fd70311 create No Graphic aquarium
sugi
parents: 134
diff changeset
32
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
33 if (type.equals("cli")){
110
aa9fc077c286 remove host from checkFishLocation
sugi
parents: 109
diff changeset
34 System.out.println("cli"+num);
259
ccce30f84380 use "_CLIST" Key
sugi
parents: 258
diff changeset
35 new TakeMynum();
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
36 }else if (type.equals("node")){
110
aa9fc077c286 remove host from checkFishLocation
sugi
parents: 109
diff changeset
37 System.out.println("node"+num);
aa9fc077c286 remove host from checkFishLocation
sugi
parents: 109
diff changeset
38 if (num != 0){
139
f995396f2af7 remove bug
sugi
parents: 138
diff changeset
39 new TakeMynum();
171
88cc33eeafa6 minor change
sugi
parents: 170
diff changeset
40 } else {
88cc33eeafa6 minor change
sugi
parents: 170
diff changeset
41 new SendMaxsize(0);
109
96674c803853 set background
sugi
parents: 107
diff changeset
42 }
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
43 }
171
88cc33eeafa6 minor change
sugi
parents: 170
diff changeset
44 new CheckLocalIndex("maxsize",0);
109
96674c803853 set background
sugi
parents: 107
diff changeset
45
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
46 ods.update(key, new FishPoint(-0.1f,-0.1f));
262
ba55adb8a042 fixed bug
sugi
parents: 259
diff changeset
47 new SetLocation(new MakeObject(frame), key, 0);
111
ba64a9d76e70 Add AutoIncrement
sugi
parents: 110
diff changeset
48 new CheckLocalIndex(key,1);
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
49 for (int i = 0; i < 3 ; i++){
112
912aed91d05b add TUNA object
sugi
parents: 111
diff changeset
50 key = "fish"+i;
133
26b4b18c51fa minor change
sugi
parents: 132
diff changeset
51 if (num == 0) new AutoIncrement(key,0);
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
52 ods.update(key, new FishPoint((float)Math.random(),
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
53 (float)Math.random(), (float)Math.random()));
262
ba55adb8a042 fixed bug
sugi
parents: 259
diff changeset
54 new SetLocation(new MakeObject(frame), key, 0);
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
55 new CheckLocalIndex(key,1);
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
56 }
270
23e53aaa8720 reconnect manager worked.
sugi
parents: 262
diff changeset
57 /*
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
58 for (int i = 3; i < 6 ; i++){
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
59 key = "fish"+i;
171
88cc33eeafa6 minor change
sugi
parents: 170
diff changeset
60 if (num == 1) new AutoIncrement(key,0);
170
6a69891b7232 change view point
sugi
parents: 145
diff changeset
61 Random rnd = new Random();
6a69891b7232 change view point
sugi
parents: 145
diff changeset
62 int tmp = rnd.nextInt(3);
6a69891b7232 change view point
sugi
parents: 145
diff changeset
63 int rand = tmp + 1;
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
64 ods.update(key, new FishPoint( (float)rand,
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
65 -(float)Math.random(), -(float)Math.random()));
262
ba55adb8a042 fixed bug
sugi
parents: 259
diff changeset
66 new SetLocation(new MakeObject(frame), key, 0);
143
0651fb36a369 demo for Open Source Conference
sugi
parents: 140
diff changeset
67 new CheckLocalIndex(key,1);
0651fb36a369 demo for Open Source Conference
sugi
parents: 140
diff changeset
68 }
0651fb36a369 demo for Open Source Conference
sugi
parents: 140
diff changeset
69
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
70 for (int i = 6; i < 9 ; i++){
143
0651fb36a369 demo for Open Source Conference
sugi
parents: 140
diff changeset
71 key = "fish"+i;
171
88cc33eeafa6 minor change
sugi
parents: 170
diff changeset
72 if (num == 2) new AutoIncrement(key,0);
170
6a69891b7232 change view point
sugi
parents: 145
diff changeset
73 Random rnd = new Random();
6a69891b7232 change view point
sugi
parents: 145
diff changeset
74 int tmp = rnd.nextInt(3);
6a69891b7232 change view point
sugi
parents: 145
diff changeset
75 int rand = tmp + 3;
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
76 ods.update(key, new FishPoint( (float)rand,
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
77 (float)Math.random(), -(float)Math.random()));
262
ba55adb8a042 fixed bug
sugi
parents: 259
diff changeset
78 new SetLocation(new MakeObject(frame), key, 0);
112
912aed91d05b add TUNA object
sugi
parents: 111
diff changeset
79 new CheckLocalIndex(key,1);
912aed91d05b add TUNA object
sugi
parents: 111
diff changeset
80 }
114
7dbaaa0de144 remove vector3f and add Matrix4d
sugi
parents: 113
diff changeset
81
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
82 for (int i = 9; i < 12 ; i++){
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
83 key = "fish"+i;
171
88cc33eeafa6 minor change
sugi
parents: 170
diff changeset
84 if (num == 3) new AutoIncrement(key,0);
170
6a69891b7232 change view point
sugi
parents: 145
diff changeset
85
6a69891b7232 change view point
sugi
parents: 145
diff changeset
86 Random rnd = new Random();
6a69891b7232 change view point
sugi
parents: 145
diff changeset
87 int tmp = rnd.nextInt(3);
6a69891b7232 change view point
sugi
parents: 145
diff changeset
88 int rand = tmp + 5;
6a69891b7232 change view point
sugi
parents: 145
diff changeset
89
217
b5c642ba998e change as** method and remove "local" key in TEST
sugi
parents: 212
diff changeset
90 ods.update(key, new FishPoint( (float)rand,
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
91 -(float)Math.random(), (float)Math.random()));
262
ba55adb8a042 fixed bug
sugi
parents: 259
diff changeset
92 new SetLocation(new MakeObject(frame), key, 0);
145
5f37b57ff32d add fish number
sugi
parents: 143
diff changeset
93 new CheckLocalIndex(key,1);
270
23e53aaa8720 reconnect manager worked.
sugi
parents: 262
diff changeset
94 }*/
171
88cc33eeafa6 minor change
sugi
parents: 170
diff changeset
95
107
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
96 }
a8f77957a477 create new model to share fish point
sugi
parents:
diff changeset
97 }