Mercurial > hg > Members > tatsuki > Alice
changeset 139:f995396f2af7 working
remove bug
author | sugi |
---|---|
date | Tue, 18 Sep 2012 16:19:50 +0900 |
parents | 87f1a30a8c82 |
children | b51d3bf971e7 |
files | image/black.jpg src/alice/test/topology/aquarium/AutoIncrement.java src/alice/test/topology/aquarium/CheckMyName.java src/alice/test/topology/aquarium/MemberNum.java src/alice/test/topology/aquarium/TakeMynum.java src/alice/test/topology/aquarium/TakePnum.java |
diffstat | 6 files changed, 56 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/test/topology/aquarium/AutoIncrement.java Tue Sep 18 11:46:38 2012 +0900 +++ b/src/alice/test/topology/aquarium/AutoIncrement.java Tue Sep 18 16:19:50 2012 +0900 @@ -20,7 +20,7 @@ @Override public void run() { - max = this.number.asInteger()*2+1+0.3f; + max = this.number.asInteger()*2-1+0.3f; FishPoint fp = this.position.asClass(FishPoint.class); if (fp.getX()+0.01>max){ fp.setXY(min, fp.getY());
--- a/src/alice/test/topology/aquarium/CheckMyName.java Tue Sep 18 11:46:38 2012 +0900 +++ b/src/alice/test/topology/aquarium/CheckMyName.java Tue Sep 18 16:19:50 2012 +0900 @@ -29,7 +29,7 @@ MakeFrame frame = new MakeFrame(name); RoutingTable routing = new RoutingTable(); - ods.put("local", "num", 0); + ods.put("local", "num", 1); if (type.equals("cli")){ System.out.println("cli"+num); @@ -38,14 +38,14 @@ new AddRoutingTable(routing,0); ods.put("parent", "member", name); - new MemberNum(); + new TakeMynum(); }else if (type.equals("node")){ System.out.println("node"+num); if (num != 0){ routing.table.add(new Routing("parent")); ods.put("parent", "member", name); - new MemberNum(); + new TakeMynum(); } ods.put("local", "list", routing);
--- a/src/alice/test/topology/aquarium/MemberNum.java Tue Sep 18 11:46:38 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -package alice.test.topology.aquarium; - -import alice.codesegment.CodeSegment; -import alice.datasegment.CommandType; -import alice.datasegment.Receiver; - -public class MemberNum extends CodeSegment { - // this CodeSegment has bug - - private Receiver number = ids.create(CommandType.TAKE); - - public MemberNum(){ - this.number.setKey("parent", "num"); - } - - @Override - public void run() { - ods.update("parent", "num", this.number.asInteger()+1); - } - -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/TakeMynum.java Tue Sep 18 16:19:50 2012 +0900 @@ -0,0 +1,28 @@ +package alice.test.topology.aquarium; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class TakeMynum extends CodeSegment { + // this CodeSegment has bug + + private Receiver mynum = ids.create(CommandType.TAKE); + + public TakeMynum(){ + this.mynum.setKey("local", "num"); + } + + public TakeMynum(int index){ + this.mynum.setKey("local", "num", index); + } + + @Override + public void run() { + new TakePnum(this.mynum); + ods.put("local", "num", 0); + new TakeMynum(this.mynum.index+1); + } + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/TakePnum.java Tue Sep 18 16:19:50 2012 +0900 @@ -0,0 +1,24 @@ +package alice.test.topology.aquarium; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class TakePnum extends CodeSegment { + // this CodeSegment has bug + + private Receiver pnum = ids.create(CommandType.TAKE); + private Receiver mynum; + + public TakePnum(Receiver data){ + this.pnum.setKey("parent", "num"); + this.mynum = data; + } + + @Override + public void run() { + ods.update("parent", "num", + this.pnum.asInteger()+this.mynum.asInteger()); + } + +}