changeset 171:88cc33eeafa6 working

minor change
author sugi
date Fri, 11 Jan 2013 19:27:35 +0900
parents 6a69891b7232
children abe00abb2fd8
files src/alice/test/topology/aquarium/AutoIncrement.java src/alice/test/topology/aquarium/CheckMyName.java src/alice/test/topology/aquarium/SendMaxsize.java
diffstat 3 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/topology/aquarium/AutoIncrement.java	Thu Dec 27 14:38:42 2012 +0900
+++ b/src/alice/test/topology/aquarium/AutoIncrement.java	Fri Jan 11 19:27:35 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	Thu Dec 27 14:38:42 2012 +0900
+++ b/src/alice/test/topology/aquarium/CheckMyName.java	Fri Jan 11 19:27:35 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	Fri Jan 11 19:27:35 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);
+	}
+
+}