comparison src/alice/test/topology/aquarium/AutoIncrement.java @ 143:0651fb36a369 working

demo for Open Source Conference
author sugi
date Thu, 20 Sep 2012 22:44:11 +0900
parents f995396f2af7
children 88cc33eeafa6
comparison
equal deleted inserted replaced
142:287aae21e7d8 143:0651fb36a369
21 @Override 21 @Override
22 public void run() { 22 public void run() {
23 max = this.number.asInteger()*2-1+0.3f; 23 max = this.number.asInteger()*2-1+0.3f;
24 FishPoint fp = this.position.asClass(FishPoint.class); 24 FishPoint fp = this.position.asClass(FishPoint.class);
25 if (fp.getX()+0.01>max){ 25 if (fp.getX()+0.01>max){
26 fp.setXY(min, fp.getY()); 26 fp.setXYZ(min, fp.getY(), fp.getZ());
27 } else if (fp.getX()+0.01< min){ 27 } else if (fp.getX()+0.01< min){
28 fp.setXY(max, fp.getY()); 28 fp.setXYZ(max, fp.getY(), fp.getZ());
29 } 29 }
30 else { 30 else {
31 fp.setXY(fp.getX()+0.01f, fp.getY()); 31 fp.setXYZ(fp.getX()+0.01f, fp.getY(), fp.getZ());
32 } 32 }
33 33
34 ods.update("local", key, fp); 34 ods.update("local", key, fp);
35 synchronized(this){ 35 synchronized(this){
36 try { 36 try {
37 // TODO 37 // TODO
38 // Waiting should be done in Alice kernel 38 // Waiting should be done in Alice kernel
39 // ids.create(CommandType.WAIT); 39 // ids.create(CommandType.WAIT);
40 40
41 wait(10); 41 wait(20);
42 } catch (InterruptedException e) { 42 } catch (InterruptedException e) {
43 e.printStackTrace(); 43 e.printStackTrace();
44 } 44 }
45 } 45 }
46 46