Mercurial > hg > Database > Alice
diff src/alice/test/topology/fishmodel/alpha/AutoIncrement.java @ 132:1044a79ce4ef working
delete cs from OutputCodeSegment
author | sugi |
---|---|
date | Tue, 14 Aug 2012 19:43:10 +0900 |
parents | 669dba7cbb69 |
children | 26b4b18c51fa |
line wrap: on
line diff
--- a/src/alice/test/topology/fishmodel/alpha/AutoIncrement.java Tue Aug 14 12:55:28 2012 +0900 +++ b/src/alice/test/topology/fishmodel/alpha/AutoIncrement.java Tue Aug 14 19:43:10 2012 +0900 @@ -11,44 +11,37 @@ float max = 3.3f; float min = -1.3f; - - public AutoIncrement(String key,int index){ - + public AutoIncrement(String key){ this.key = key; this.position.setKey("local", key); - - } - - public void Init(){ - this.ods = null; - this.position = null; - } @Override - public synchronized void run() { - FishPoint FP = this.position.asClass(FishPoint.class); - - if (FP.getX()+0.01>max){ - FP.setXY(min, FP.getY()); - } else if (FP.getX()+0.01< min){ - FP.setXY(max, FP.getY()); + public void run() { + FishPoint fp = this.position.asClass(FishPoint.class); + if (fp.getX()+0.01>max){ + fp.setXY(min, fp.getY()); + } else if (fp.getX()+0.01< min){ + fp.setXY(max, fp.getY()); } else { - FP.setXY(FP.getX()+0.01f, FP.getY()); + fp.setXY(fp.getX()+0.01f, fp.getY()); } + ods.update("local", key, fp); + synchronized(this){ + try { + // TODO + // Waiting should be done in Alice kernel + // ids.create(CommandType.WAIT); + + wait(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } - 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); + new AutoIncrement(this.key); } }