changeset 120:0178acc8ea2c working

Merge with f84e1684c6be0e4d8fd57ccbec029c03704a5b6c
author sugi
date Thu, 26 Jul 2012 15:47:30 +0900
parents 3fcd88d356cb (current diff) f84e1684c6be (diff)
children bddb8be357f6
files src/alice/test/topology/fishmodel/beta/GetMaxNum.java src/alice/test/topology/fishmodel/beta/UpdateNum.java
diffstat 10 files changed, 52 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/fishBeta_run.sh	Thu Jul 26 02:31:26 2012 +0900
+++ b/scripts/fishBeta_run.sh	Thu Jul 26 15:47:30 2012 +0900
@@ -9,7 +9,7 @@
 cnt=0
 while [ $cnt -lt $max ]
 do
-    java -cp ../Alice.jar alice.test.topology.fishmodel.beta.FishMovementTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/modelbeta${cnt}.log -level debug > ./output/std_modelbeta${cnt}.log &
+    java -cp  ../Alice.jar alice.test.topology.fishmodel.beta.FishMovementTopology -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/modelbeta${cnt}.log -level debug > ./output/std_modelbeta${cnt}.log &
     cnt=`expr $cnt + 1`
 done
 wait
--- a/src/alice/codesegment/InputDataSegment.java	Thu Jul 26 02:31:26 2012 +0900
+++ b/src/alice/codesegment/InputDataSegment.java	Thu Jul 26 15:47:30 2012 +0900
@@ -15,7 +15,7 @@
  */
 public class InputDataSegment {
 	
-	private CodeSegment cs;
+	public CodeSegment cs;
 	private AtomicInteger count = new AtomicInteger(1); // 1 for no input data segments
 	private AtomicInteger keyCount = new AtomicInteger(0); // number of DataSegments
 	
@@ -76,6 +76,9 @@
 	public void receive() {
 		if (count.decrementAndGet() == 0) {
 			CodeSegmentManager.submit(cs);
+			cs.ods.cs = null;
+			cs = null; // TODO
+			
 		}
 	}
 	
--- a/src/alice/codesegment/OutputDataSegment.java	Thu Jul 26 02:31:26 2012 +0900
+++ b/src/alice/codesegment/OutputDataSegment.java	Thu Jul 26 15:47:30 2012 +0900
@@ -10,7 +10,7 @@
 
 public class OutputDataSegment {
 	
-	CodeSegment cs;
+	public CodeSegment cs;
 	
 	public OutputDataSegment(CodeSegment codeSegment) {
 		this.cs = codeSegment;
--- a/src/alice/test/codesegment/local/StartCodeSegment.java	Thu Jul 26 02:31:26 2012 +0900
+++ b/src/alice/test/codesegment/local/StartCodeSegment.java	Thu Jul 26 15:47:30 2012 +0900
@@ -1,8 +1,7 @@
 package alice.test.codesegment.local;
 
 import alice.codesegment.CodeSegment;
-import alice.test.topology.fishmodel.beta.Routing;
-import alice.test.topology.fishmodel.beta.RoutingTable;
+import alice.test.topology.fishmodel.alpha.FishPoint;
 
 public class StartCodeSegment extends CodeSegment {
 
@@ -16,12 +15,10 @@
 										  
 		*/
 		new TestCodeSegment();
-		RoutingTable RT = new RoutingTable();
-		Routing newMember = new Routing("local");
-		RT.table.add(newMember);
+		
 		System.out.println("create TestCodeSegment");
-		ods.update("local", "key1", RT);
-		//ods.update("local", "key1", new FishPoint()); // bind string data to datasegment local.key1
+		//ods.update("local", "key1", 0);
+		ods.update("local", "key1", new FishPoint(0.0f,0.0f)); // bind string data to datasegment local.key1
 													// this startup TestCodeSegment.
  	}
 
--- a/src/alice/test/codesegment/local/TestCodeSegment.java	Thu Jul 26 02:31:26 2012 +0900
+++ b/src/alice/test/codesegment/local/TestCodeSegment.java	Thu Jul 26 15:47:30 2012 +0900
@@ -3,11 +3,12 @@
 import alice.codesegment.CodeSegment;
 import alice.datasegment.CommandType;
 import alice.datasegment.Receiver;
-import alice.test.topology.fishmodel.beta.Routing;
-import alice.test.topology.fishmodel.beta.RoutingTable;
+import alice.test.topology.fishmodel.alpha.FishPoint;
 
 public class TestCodeSegment extends CodeSegment {
 	
+	static int count = 0;
+	
 	// create input datasegment arg1
 	Receiver arg1 = ids.create(CommandType.PEEK);
 	public TestCodeSegment(){
@@ -19,24 +20,19 @@
 	
 	@Override
 	public void run() {
-		RoutingTable RT = arg1.asClass(RoutingTable.class);
-		Routing newRouting = new Routing(this.arg1.from);
-		
-		RT.table.add(newRouting);
-		System.out.println("index = " + arg1.index);
+		FishPoint fp = this.arg1.asClass(FishPoint.class);
+		//System.out.println("index = " + arg1.index);
+		System.out.println("count = " + count);
 		System.out.println("data = " + arg1.val);
 		System.out.println(arg1.val.getType());
 		
-		for (Routing r : RT.table) {
-			System.out.println("name;"+r.name);
-		}
-		
-		
+		/*
 		if (arg1.index == 10) {
 			System.exit(0);
 			return;
 		}
-		
+		*/
+		//FP.setXY(FP.getX()+1.0f,FP.getY());
 		/*
 		TestCodeSegment cs = new TestCodeSegment();
 		cs.arg1.setKey("key1", arg1.index);
@@ -44,7 +40,13 @@
 		
 		new TestCodeSegment(arg1.index);
 		// DataSegment.get("local").update
-		ods.update("local", "key1", RT);
+		
+		if (count++>1000) {
+			System.out.println(count);
+			
+		}
+		ods.update("local", "key1", fp);
+		
 	}
 
 }
--- a/src/alice/test/topology/fishmodel/alpha/AutoIncrement.java	Thu Jul 26 02:31:26 2012 +0900
+++ b/src/alice/test/topology/fishmodel/alpha/AutoIncrement.java	Thu Jul 26 15:47:30 2012 +0900
@@ -8,6 +8,9 @@
 	
 	public Receiver position = ids.create(CommandType.PEEK);	
 	String key;
+	float max = 3.3f;
+	float min = -1.3f;
+	
 	
 	public AutoIncrement(String key,int index){
 		
@@ -15,15 +18,21 @@
 		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>9.0f){
-			FP.setXY(-1.0f, FP.getY());
-		} else if (FP.getX()+0.01< -1.0f){
-			FP.setXY(9.0f, FP.getY());
+		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());
@@ -31,16 +40,17 @@
 		
 		
 		ods.update("local", key, FP);
-		
+		/*
 		try {
 			wait(200);
 		} catch (InterruptedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-		
+		*/
 		new AutoIncrement(this.key,this.position.index);
-		
+		//Init();
+		//java.lang.System.gc();
 	}
 	
 }
--- a/src/alice/test/topology/fishmodel/alpha/SendLocation.java	Thu Jul 26 02:31:26 2012 +0900
+++ b/src/alice/test/topology/fishmodel/alpha/SendLocation.java	Thu Jul 26 15:47:30 2012 +0900
@@ -10,6 +10,8 @@
 	public Receiver position = ids.create(CommandType.PEEK);
 	float x;
 	float y;
+	float max = 3.3f;
+	float min = -1.3f;
 	
 	public SendLocation(float x,float y){
 		this.x = x;
@@ -20,14 +22,17 @@
 	public void run() {
 		FishPoint FP = this.position.asClass(FishPoint.class);
 		
-		if (FP.getX()+this.x>9.0f){
+		FP.setXY(FP.getX()+this.x, FP.getY()+this.y);
+		/*
+		if (FP.getX()+this.x>max){
 			FP.setXY(-1.0f, FP.getY()+this.y);
-		} else if (FP.getX()+this.x< -1){
-			FP.setXY(9.0f, FP.getY()+this.y);
+		} else if (FP.getX()+this.x< min){
+			FP.setXY(max, FP.getY()+this.y);
 		}
 		else {
 			FP.setXY(FP.getX()+this.x, FP.getY()+this.y);
 		}
+		*/
 		
 		ods.update("local", "fish", FP);
 		
--- a/src/alice/test/topology/fishmodel/beta/GetMaxNum.java	Thu Jul 26 02:31:26 2012 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-package alice.test.topology.fishmodel.beta;
-
-import alice.codesegment.CodeSegment;
-import alice.datasegment.CommandType;
-import alice.datasegment.Receiver;
-
-
-public class GetMaxNum extends CodeSegment{
-	
-	private Receiver member = ids.create(CommandType.PEEK);
-	int nowMax;
-	public GetMaxNum(int range,int index){
-		this.nowMax = range;
-		this.member.setKey("local","num",index);
-	}
-	
-	@Override
-	public void run(){
-		if (this.member.index > this.nowMax){
-			new UpdateNum("num",this.member);
-			new GetMaxNum(this.member.asInteger(),this.member.index);
-			
-		} else {
-			
-			new GetMaxNum(this.nowMax,this.member.index);
-		}
-		
-					
-	}
-	
-
-}
--- a/src/alice/test/topology/fishmodel/beta/UpdateNum.java	Thu Jul 26 02:31:26 2012 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-package alice.test.topology.fishmodel.beta;
-
-import alice.codesegment.CodeSegment;
-import alice.datasegment.CommandType;
-import alice.datasegment.Receiver;
-
-public class UpdateNum extends CodeSegment {
-	
-	private Receiver list = ids.create(CommandType.PEEK);
-	private Receiver data;
-	String key;
-	
-	public UpdateNum(String key,Receiver data){
-		this.key = key;
-		this.data = data;
-		this.list.setKey("local", "list");
-	}
-
-	@Override
-	public void run() {
-		RoutingTable RT = this.list.asClass(RoutingTable.class);
-		for (Routing r : RT.table) {
-			if (!r.name.equals(this.data.from)){
-				ods.update(r.name, this.key, this.data.val);
-			}
-			
-		}
-	}
-
-}
--- a/src/alice/topology/node/Start.java	Thu Jul 26 02:31:26 2012 +0900
+++ b/src/alice/topology/node/Start.java	Thu Jul 26 15:47:30 2012 +0900
@@ -22,6 +22,7 @@
 		if (startCS == null)
 			return;
 		startCS.execute();
+		
 	}
 
 }