annotate src/alice/test/topology/fishmodel/alpha/SendLocation.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/SendLocation.java@993a9f194615
children 9845b74063ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107
a8f77957a477 create new model to share fish point
sugi
parents: 105
diff changeset
1 package alice.test.topology.fishmodel.alpha;
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;
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
13
97
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
14 public SendLocation(float x,float y){
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
15 this.x = x;
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
16 this.y = y;
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
17 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
18
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
19 @Override
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
20 public void run() {
97
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
21 FishPoint FP = this.position.asClass(FishPoint.class);
df786bf8f036 add FishPoint.java and Test
sugi
parents: 93
diff changeset
22 FP.setXY(FP.getX()+this.x, FP.getY()+this.y);
105
993a9f194615 success share TEST
sugi
parents: 97
diff changeset
23 ods.update("local", "fish", FP);
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
24
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
25 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
26
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
27 }