Mercurial > hg > Database > Alice
view src/alice/test/topology/fishmodel/alpha/AutoIncrement.java @ 115:9845b74063ec working
share max number
author | sugi |
---|---|
date | Sat, 21 Jul 2012 10:02:41 +0900 |
parents | 7dbaaa0de144 |
children | 248064474909 |
line wrap: on
line source
package alice.test.topology.fishmodel.alpha; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class AutoIncrement extends CodeSegment { public Receiver position = ids.create(CommandType.PEEK); String key; public AutoIncrement(String key,int index){ this.key = key; this.position.setKey("local", key); } @Override public synchronized void run() { FishPoint FP = this.position.asClass(FishPoint.class); if (FP.getX()+0.01>9.0f){ FP.setXY(-1.0f, FP.getY()); } else if (FP.getX()+0.01< -1.0f){ FP.setXY(9.0f, FP.getY()); } else { FP.setXY(FP.getX()+0.01f, FP.getY()); } ods.update("local", key, FP); try { wait(150); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } new AutoIncrement(this.key,this.position.index); } }