changeset 94:38f4021353c5 working

"setKey" is in the instance
author sugi
date Mon, 18 Jun 2012 17:10:23 +0900
parents 6601f8854126
children 7982324d4329
files src/alice/test/topology/movement/CheckFishLocation.java src/alice/test/topology/movement/CheckMyName.java
diffstat 2 files changed, 16 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/topology/movement/CheckFishLocation.java	Tue Jun 05 16:33:28 2012 +0900
+++ b/src/alice/test/topology/movement/CheckFishLocation.java	Mon Jun 18 17:10:23 2012 +0900
@@ -10,15 +10,16 @@
 
 public class CheckFishLocation extends CodeSegment{
 	
-	public Receiver nowX = ids.create(CommandType.PEEK);
-	public Receiver host = ids.create(CommandType.PEEK);
-	MakeFrame frame;
+	private Receiver nowX = ids.create(CommandType.PEEK);
+	private Receiver host = ids.create(CommandType.PEEK);
 	MakeObject obj;
 	Pattern pattern = Pattern.compile("^(cli)([0-9]+)$");
 	
 	public CheckFishLocation(MakeObject MO ,String str){
 		this.obj = MO;
 		this.nowX.key = str;
+		this.host.setKey("local","host");
+		this.nowX.setKey("parent",this.nowX.key,this.nowX.index);
 	}
 	
 	@Override
@@ -28,7 +29,6 @@
 		matcher.find();
 		int num = new Integer(matcher.group(2));
 		
-		
 		float startX = 2*num - 3.0f;
 		float endX = 2*num -0.9f;
 		float x = (float)this.nowX.asInteger()/1000;
@@ -39,9 +39,9 @@
 				ods.update("parent", this.nowX.key, this.nowX.asInteger()+1);
 		}
 				
-		CheckFishLocation cs = new CheckFishLocation(this.obj,this.nowX.key);
-		cs.nowX.setKey("parent",this.nowX.key,this.nowX.index);
-		cs.host.setKey("local","host");
+		new CheckFishLocation(this.obj,this.nowX.key);
+
+		
 						
 	}
 	
--- a/src/alice/test/topology/movement/CheckMyName.java	Tue Jun 05 16:33:28 2012 +0900
+++ b/src/alice/test/topology/movement/CheckMyName.java	Mon Jun 18 17:10:23 2012 +0900
@@ -11,6 +11,7 @@
 	Receiver host = ids.create(CommandType.PEEK);
 	Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
 	
+	
 	@Override
 	public void run(){
 		
@@ -26,30 +27,19 @@
 			
 			MakeFrame frame =  new MakeFrame();
 			
+			MakeObject obj3 = new MakeObject(frame);
+			frame.register(obj3);
+			new CheckFishLocation(obj3,"fish3X");
+			
 			MakeObject obj = new MakeObject(frame);
 			frame.register(obj);
-			CheckFishLocation cs = new CheckFishLocation(obj,"fish1X");
-			cs.host.setKey("local","host");
-			cs.nowX.setKey("parent","fish1X");
-						
-			MakeObject obj2 = new MakeObject(frame);
-			frame.register(obj2);
-			CheckFishLocation cs2 = new CheckFishLocation(obj2,"fish2X");
-			cs2.host.setKey("local","host");
-			cs2.nowX.setKey("parent","fish2X");
-			
-			MakeObject obj3 = new MakeObject(frame);
-			frame.register(obj3);
-			CheckFishLocation cs3 = new CheckFishLocation(obj3,"fish3X");
-			cs3.host.setKey("local","host");
-			cs3.nowX.setKey("parent","fish3X");
-			
-			
+			new CheckFishLocation(obj,"fish1X");
+									
 		}else if(type.equals("node")){
 			System.out.println("node0");
+			ods.update("local", "fish3X", 0);
 			ods.update("local", "fish1X", -1000);
-			ods.update("local", "fish2X", -1000);
-			ods.update("local", "fish3X", 0);
+	
 			
 		}
 	}