Mercurial > hg > Members > tatsuki > Alice
diff src/alice/test/topology/fishmodel/alpha/AutoIncrement.java @ 111:ba64a9d76e70 working
Add AutoIncrement
author | sugi |
---|---|
date | Tue, 17 Jul 2012 17:23:55 +0900 |
parents | |
children | 912aed91d05b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/fishmodel/alpha/AutoIncrement.java Tue Jul 17 17:23:55 2012 +0900 @@ -0,0 +1,34 @@ +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); + FP.setXY(FP.getX()+0.01f, FP.getY()); + ods.update("local", key, FP); + try { + wait(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + new AutoIncrement(this.key,this.position.index); + + } + +}