Mercurial > hg > Members > sugi > javafx
view src/alice/test/topology/aquarium/fx/PositionController.java @ 23:b77c2c6db854
minor change
author | e095732 |
---|---|
date | Mon, 01 Jul 2013 20:02:03 +0900 |
parents | 4e5507afb41f |
children |
line wrap: on
line source
package alice.test.topology.aquarium.fx; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class PositionController extends CodeSegment{ private Receiver data1 = ids.create(CommandType.PEEK); private Receiver data2 = ids.create(CommandType.PEEK); public PositionController(String key){ data1.setKey(key); data2.setKey("MAXSIZE"); } public PositionController(String key ,int index){ data1.setKey(key, index); data2.setKey("MAXSIZE"); } @Override public void run() { int maxsize = data2.asInteger(); //System.out.println(data.val); synchronized(this){ try { // TODO // Waiting should be done in Alice kernel // ids.create(CommandType.WAIT); wait(20); FishData fd = data1.asClass(FishData.class); if(fd.getX()+2.0>maxsize){ fd.SetXYZ(0, fd.getY(), fd.getZ()); } else { fd.SetXYZ(fd.getX()+3.0, fd.getY(), fd.getZ()); } new PositionController(data1.key, data1.index); ods.update("local", data1.key, fd); } catch (InterruptedException e) { e.printStackTrace(); } } } }