# HG changeset patch # User e095732 # Date 1359908604 -32400 # Node ID 4e5507afb41f0e06316c073aafb482247734bcd9 # Parent 9bacc8b30c4bb7b18a20edb4bd7153c1587b6917 "MAXSIZE" change automatically diff -r 9bacc8b30c4b -r 4e5507afb41f scripts/share_run.sh --- a/scripts/share_run.sh Sun Feb 03 18:34:16 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/bash -max=$1 -child_num=$2 -ruby ./topology/treen.rb $1 $2 > ./topology/tree.dot -dot -Tpng ./topology/tree.dot > ./topology/tree.png -#open ./topology/tree.png -java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot & - -cnt=0 -while [ $cnt -lt $max ] -do - java -version:1.6 -showversion -cp ../Alice.jar alice.test.topology.share.ShareTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` > ./output/std_share${cnt}.log & - cnt=`expr $cnt + 1` -done -wait diff -r 9bacc8b30c4b -r 4e5507afb41f scripts/topology/tree.dot --- a/scripts/topology/tree.dot Sun Feb 03 18:34:16 2013 +0900 +++ b/scripts/topology/tree.dot Mon Feb 04 01:23:24 2013 +0900 @@ -1,4 +1,6 @@ digraph test { node0 -> cli1 [label="child0"] + node0 -> cli2 [label="child1"] cli1 -> node0 [label="parent"] + cli2 -> node0 [label="parent"] } diff -r 9bacc8b30c4b -r 4e5507afb41f scripts/topology/tree.png Binary file scripts/topology/tree.png has changed diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/CalculateMaxSize.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/fx/CalculateMaxSize.java Mon Feb 04 01:23:24 2013 +0900 @@ -0,0 +1,31 @@ +package alice.test.topology.aquarium.fx; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class CalculateMaxSize extends CodeSegment{ + + private Receiver data1 = ids.create(CommandType.PEEK); + private Receiver data2 = ids.create(CommandType.PEEK); + + public CalculateMaxSize(){ + data1.setKey("CHILDNUM"); + data2.setKey("width"); + } + + public CalculateMaxSize(int index){ + data1.setKey("CHILDNUM", index); + data2.setKey("width"); + } + + @Override + public void run() { + int childnum = data1.asInteger(); + int width = data2.asInteger(); + int maxsize = childnum * width + width; + ods.update("local", "MAXSIZE", maxsize); + System.out.println(maxsize); + new CalculateMaxSize(data1.index); + } +} diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/CheckMyName.java --- a/src/alice/test/topology/aquarium/fx/CheckMyName.java Sun Feb 03 18:34:16 2013 +0900 +++ b/src/alice/test/topology/aquarium/fx/CheckMyName.java Mon Feb 04 01:23:24 2013 +0900 @@ -20,7 +20,8 @@ String name = host.asString(); Matcher matcher = pattern.matcher(name); matcher.find(); - + System.out.println(name); + new Share("MAXSIZE"); int num = new Integer(matcher.group(2)); ods.put("local", "mynum", num); diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/CountMessage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/fx/CountMessage.java Mon Feb 04 01:23:24 2013 +0900 @@ -0,0 +1,26 @@ +package alice.test.topology.aquarium.fx; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class CountMessage extends CodeSegment{ + + private Receiver data1 = ids.create(CommandType.TAKE); + private Receiver data2 = ids.create(CommandType.PEEK); + + + public CountMessage(){ + data1.setKey("CHILD"); + data2.setKey("CHILDNUM"); + } + + @Override + public void run() { + int childnum = data2.asInteger(); + ods.update("local", "CHILDNUM", childnum+1); + new CountMessage(); + + } + +} diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/OtherNode.java --- a/src/alice/test/topology/aquarium/fx/OtherNode.java Sun Feb 03 18:34:16 2013 +0900 +++ b/src/alice/test/topology/aquarium/fx/OtherNode.java Mon Feb 04 01:23:24 2013 +0900 @@ -18,11 +18,13 @@ public void run() { ods.put("local", "list", new RoutingTable("parent")); new RegistRoutingTable(); + ods.put("local", "MAXSIZE", 800); ods.put("parent", "member", "ADD_MEM"); - + ods.put("parent", "CHILD", "ADD"); int startX = data1.asInteger() * data2.asInteger(); ods.put("local", "startX", startX); - + new SendMessage(); + new Share("MAXSIZE"); Aquarium aqua = new Aquarium(); aqua.run(); } diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/PositionController.java --- a/src/alice/test/topology/aquarium/fx/PositionController.java Sun Feb 03 18:34:16 2013 +0900 +++ b/src/alice/test/topology/aquarium/fx/PositionController.java Mon Feb 04 01:23:24 2013 +0900 @@ -6,19 +6,22 @@ public class PositionController extends CodeSegment{ - private Receiver data = ids.create(CommandType.PEEK); - private double max = 1600; // should be DS + private Receiver data1 = ids.create(CommandType.PEEK); + private Receiver data2 = ids.create(CommandType.PEEK); public PositionController(String key){ - this.data.setKey(key); + data1.setKey(key); + data2.setKey("MAXSIZE"); } public PositionController(String key ,int index){ - this.data.setKey(key, index); + data1.setKey(key, index); + data2.setKey("MAXSIZE"); } @Override public void run() { + int maxsize = data2.asInteger(); //System.out.println(data.val); synchronized(this){ try { @@ -28,16 +31,16 @@ wait(20); - FishData fd = data.asClass(FishData.class); - if(fd.getX()+2.0>max){ + 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(data.key, data.index); - ods.update("local", data.key, fd); + new PositionController(data1.key, data1.index); + ods.update("local", data1.key, fd); } catch (InterruptedException e) { e.printStackTrace(); } diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/RegistRoutingTable.java --- a/src/alice/test/topology/aquarium/fx/RegistRoutingTable.java Sun Feb 03 18:34:16 2013 +0900 +++ b/src/alice/test/topology/aquarium/fx/RegistRoutingTable.java Mon Feb 04 01:23:24 2013 +0900 @@ -18,11 +18,9 @@ public void run() { RoutingTable routing = rdata.asClass(RoutingTable.class); routing.table.add(new RoutingData(data.from)); - System.out.println(routing.toString()); ods.update("local", "list", routing); new RegistRoutingTable(); - } } diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/SendMessage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/fx/SendMessage.java Mon Feb 04 01:23:24 2013 +0900 @@ -0,0 +1,21 @@ +package alice.test.topology.aquarium.fx; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class SendMessage extends CodeSegment{ + + private Receiver data1 = ids.create(CommandType.TAKE); + + public SendMessage(){ + data1.setKey("CHILD"); + } + + @Override + public void run() { + ods.put("parent", "CHILD", "ADD"); + new SendMessage(); + } + +} diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/SetTranslation.java --- a/src/alice/test/topology/aquarium/fx/SetTranslation.java Sun Feb 03 18:34:16 2013 +0900 +++ b/src/alice/test/topology/aquarium/fx/SetTranslation.java Mon Feb 04 01:23:24 2013 +0900 @@ -34,11 +34,11 @@ int startX = data2.asInteger(); int width = data3.asInteger(); FishData fd = data1.asClass(FishData.class); - if (startX<=fd.getX()&& fd.getX()<=startX+width){ + //if (startX<=fd.getX()&& fd.getX()<=startX+width){ iv.setTranslateX(fd.getX() - startX); iv.setTranslateY(fd.getY()); iv.setTranslateZ(fd.getZ()); - } + //} new SetTranslation(iv, data1.key, data1.index); } diff -r 9bacc8b30c4b -r 4e5507afb41f src/alice/test/topology/aquarium/fx/TopNode.java --- a/src/alice/test/topology/aquarium/fx/TopNode.java Sun Feb 03 18:34:16 2013 +0900 +++ b/src/alice/test/topology/aquarium/fx/TopNode.java Mon Feb 04 01:23:24 2013 +0900 @@ -17,11 +17,18 @@ @Override public void run() { ods.put("local", "list", new RoutingTable()); + ods.put("local", "MAXSIZE", 800); + new RegistRoutingTable(); + + int startX = data1.asInteger() * data2.asInteger(); ods.put("local", "startX", startX); - + ods.put("local", "CHILDNUM", 0); + new CalculateMaxSize(); + new CountMessage(); + new Share("MAXSIZE"); Aquarium aqua = new Aquarium(); aqua.run(); }