annotate src/alice/test/topology/aquarium/SendLocation.java @ 134:53aff28cde6b working

change package
author sugi
date Wed, 15 Aug 2012 17:11:57 +0900
parents src/alice/test/topology/fishmodel/alpha/SendLocation.java@1044a79ce4ef
children 87f1a30a8c82
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
134
53aff28cde6b change package
sugi
parents: 132
diff changeset
1 package alice.test.topology.aquarium;
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
2
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
3 import alice.codesegment.CodeSegment;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
4 import alice.datasegment.CommandType;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
5 import alice.datasegment.Receiver;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
6
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
7
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
8 public class SendLocation extends CodeSegment {
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
9
97
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
10 public Receiver position = ids.create(CommandType.PEEK);
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
11 float x;
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
12 float y;
119
f84e1684c6be put NULL in CS
sugi
parents: 115
diff changeset
13 float max = 3.3f;
f84e1684c6be put NULL in CS
sugi
parents: 115
diff changeset
14 float min = -1.3f;
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
15
97
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
16 public SendLocation(float x,float y){
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
17 this.x = x;
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
18 this.y = y;
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
19 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
20
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
21 @Override
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
22 public void run() {
127
117dad267a9b add apiTest put
sugi
parents: 119
diff changeset
23 FishPoint fp = this.position.asClass(FishPoint.class);
115
9845b74063ec share max number
sugi
parents: 107
diff changeset
24
127
117dad267a9b add apiTest put
sugi
parents: 119
diff changeset
25 fp.setXY(fp.getX()+this.x, fp.getY()+this.y);
119
f84e1684c6be put NULL in CS
sugi
parents: 115
diff changeset
26 /*
127
117dad267a9b add apiTest put
sugi
parents: 119
diff changeset
27 if (fp.getX()+this.x>max){
132
1044a79ce4ef delete cs from OutputCodeSegment
sugi
parents: 127
diff changeset
28 fp.setXY(-1.0f, fp.getY()+this.y);
127
117dad267a9b add apiTest put
sugi
parents: 119
diff changeset
29 } else if (fp.getX()+this.x< min){
117dad267a9b add apiTest put
sugi
parents: 119
diff changeset
30 fp.setXY(max, fp.getY()+this.y);
115
9845b74063ec share max number
sugi
parents: 107
diff changeset
31 }
9845b74063ec share max number
sugi
parents: 107
diff changeset
32 else {
127
117dad267a9b add apiTest put
sugi
parents: 119
diff changeset
33 fp.setXY(fp.getX()+this.x, fp.getY()+this.y);
115
9845b74063ec share max number
sugi
parents: 107
diff changeset
34 }
119
f84e1684c6be put NULL in CS
sugi
parents: 115
diff changeset
35 */
115
9845b74063ec share max number
sugi
parents: 107
diff changeset
36
127
117dad267a9b add apiTest put
sugi
parents: 119
diff changeset
37 ods.update("local", "fish", fp);
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
38
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
39 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
40
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
41 }