changeset 174:abe00abb2fd8 working

Merge with 88cc33eeafa63e8d3675c4e31065e358701d5929
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 14 Jan 2013 19:22:36 +0900
parents 23d6a775a643 (current diff) 88cc33eeafa6 (diff)
children d7816b9b72e9
files
diffstat 3 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/topology/aquarium/AutoIncrement.java	Mon Jan 14 19:21:13 2013 +0900
+++ b/src/alice/test/topology/aquarium/AutoIncrement.java	Mon Jan 14 19:22:36 2013 +0900
@@ -14,7 +14,7 @@
 	
 	public AutoIncrement(String key,int index){
 		this.key = key;
-		this.number.setKey("local","num");
+		this.number.setKey("local","maxsize");
 		this.position.setKey("local", key,index);
 	}
 
--- a/src/alice/test/topology/aquarium/CheckMyName.java	Mon Jan 14 19:21:13 2013 +0900
+++ b/src/alice/test/topology/aquarium/CheckMyName.java	Mon Jan 14 19:22:36 2013 +0900
@@ -48,11 +48,14 @@
 				ods.put("parent", "member", name);
 				new TakeMynum();
 				
+			} else {
+				new SendMaxsize(0);
 			}
 			ods.put("local", "list", routing);
 			new AddRoutingTable(routing,0);
 			
 		}
+		new CheckLocalIndex("maxsize",0);
 		
 		ods.update("local", key, new FishPoint(-0.1f,-0.1f));
 		new SetLocation(new MakeObject(frame), key, 0, num);
@@ -68,7 +71,7 @@
 		
 		for (int i = 3; i < 6 ; i++){
 			key = "fish"+i;
-			if (num == 0) new AutoIncrement(key,0);
+			if (num == 1) new AutoIncrement(key,0);
 			Random rnd = new Random();
 			int tmp = rnd.nextInt(3);
 			int rand = tmp + 1;
@@ -80,7 +83,7 @@
 		
 		for (int i = 6; i < 9 ; i++){
 			key = "fish"+i;
-			if (num == 0) new AutoIncrement(key,0);
+			if (num == 2) new AutoIncrement(key,0);
 			Random rnd = new Random();
 			int tmp = rnd.nextInt(3); 
 			int rand = tmp + 3;
@@ -92,7 +95,7 @@
 		
 		for (int i = 9; i < 12 ; i++){
 			key = "fish"+i;
-			if (num == 0) new AutoIncrement(key,0);
+			if (num == 3) new AutoIncrement(key,0);
 			
 			Random rnd = new Random();
 			int tmp = rnd.nextInt(3); 
@@ -103,5 +106,6 @@
 			new SetLocation(new MakeObject(frame), key, 0, num);
 			new CheckLocalIndex(key,1);
 		}
+		
 	}
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/alice/test/topology/aquarium/SendMaxsize.java	Mon Jan 14 19:22:36 2013 +0900
@@ -0,0 +1,22 @@
+package alice.test.topology.aquarium;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class SendMaxsize extends CodeSegment{
+
+	private Receiver max = ids.create(CommandType.PEEK);
+	
+	public SendMaxsize(int index){
+		this.max.setKey("local", "num", index);
+	}
+	
+	@Override
+	public void run() {
+		int size = max.asInteger();
+		ods.update("local","maxsize",size);
+		new SendMaxsize(this.max.index);
+	}
+
+}