annotate src/alice/test/topology/aquarium/SetLocation.java @ 140:b51d3bf971e7 working

add function (refresh)
author sugi
date Thu, 20 Sep 2012 01:32:46 +0900
parents 87f1a30a8c82
children 0651fb36a369
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
134
53aff28cde6b change package
sugi
parents: 127
diff changeset
1 package alice.test.topology.aquarium;
91
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
2
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
3 import alice.codesegment.CodeSegment;
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
4 import alice.datasegment.CommandType;
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
5 import alice.datasegment.Receiver;
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
6
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
7
111
ba64a9d76e70 Add AutoIncrement
sugi
parents: 110
diff changeset
8 public class SetLocation extends CodeSegment{
91
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
9
97
df786bf8f036 add FishPoint.java and Test
sugi
parents: 94
diff changeset
10 private Receiver position = ids.create(CommandType.PEEK);
138
87f1a30a8c82 change range automatic
sugi
parents: 134
diff changeset
11 private MakeObject obj;
87f1a30a8c82 change range automatic
sugi
parents: 134
diff changeset
12 private String key;
110
aa9fc077c286 remove host from checkFishLocation
sugi
parents: 107
diff changeset
13 int range;
91
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
14
127
117dad267a9b add apiTest put
sugi
parents: 115
diff changeset
15 public SetLocation(MakeObject obj ,String key,int index,int range){
117dad267a9b add apiTest put
sugi
parents: 115
diff changeset
16 this.obj = obj;
105
993a9f194615 success share TEST
sugi
parents: 97
diff changeset
17 this.key = key;
110
aa9fc077c286 remove host from checkFishLocation
sugi
parents: 107
diff changeset
18 this.range = range;
105
993a9f194615 success share TEST
sugi
parents: 97
diff changeset
19 this.position.setKey("local",key,index);
91
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
20 }
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
21
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
22 @Override
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
23 public void run(){
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
24
127
117dad267a9b add apiTest put
sugi
parents: 115
diff changeset
25 FishPoint fp = this.position.asClass(FishPoint.class);
117dad267a9b add apiTest put
sugi
parents: 115
diff changeset
26 //obj.setLocation(fp.getX() - 2*range, fp.getY());
114
7dbaaa0de144 remove vector3f and add Matrix4d
sugi
parents: 111
diff changeset
27
115
9845b74063ec share max number
sugi
parents: 114
diff changeset
28 float startX = 2*range - 1.5f;
9845b74063ec share max number
sugi
parents: 114
diff changeset
29 float endX = 2*range + 1.5f;
127
117dad267a9b add apiTest put
sugi
parents: 115
diff changeset
30 if (startX <= fp.getX() && fp.getX() < endX)
117dad267a9b add apiTest put
sugi
parents: 115
diff changeset
31 obj.setLocation(fp.getX() - 2*range, fp.getY());
115
9845b74063ec share max number
sugi
parents: 114
diff changeset
32
140
b51d3bf971e7 add function (refresh)
sugi
parents: 138
diff changeset
33 new SetLocation(this.obj, this.key, this.position.index, this.range);
110
aa9fc077c286 remove host from checkFishLocation
sugi
parents: 107
diff changeset
34
91
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
35 }
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
36
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
37
19f3bd33277d add KeyInput
sugi
parents:
diff changeset
38 }