changeset 214:fec0726bb126 working

remove error
author one
date Wed, 27 Mar 2013 18:16:34 +0900
parents 3f20b6401823
children 1fd7067f0044
files src/alice/codesegment/OutputDataSegment.java src/alice/codesegment/ReceiveLocalData.java src/alice/datasegment/ReceiveRemoteData.java src/alice/datasegment/Receiver.java src/alice/datasegment/ReceiverData.java src/alice/test/codesegment/api/FlipTest.java src/alice/test/codesegment/api/TakeCodeSegment.java src/alice/test/codesegment/api/UpdateCodeSegment.java src/alice/test/topology/aquarium/AddRoutingTable.java src/alice/test/topology/aquarium/AutoIncrement.java src/alice/test/topology/aquarium/CheckLocalIndex.java src/alice/test/topology/aquarium/SendMaxsize.java src/alice/test/topology/aquarium/SetLocation.java src/alice/test/topology/aquarium/TakeMynum.java src/alice/test/topology/fish/AsignStartX.java src/alice/test/topology/fish/GetStartX.java src/alice/test/topology/fish/PeekStartX.java src/alice/test/topology/fish/SendWidth.java src/alice/test/topology/fish/StartStartX.java src/alice/test/topology/fish/WidthReceiver.java src/alice/test/topology/ring/FirstRingMessagePassing.java src/alice/test/topology/ring/RingMessagePassing.java src/alice/test/topology/share/AutoIncrement.java src/alice/test/topology/share/CheckLocalIndex.java src/alice/test/topology/share/LookUpData.java src/alice/test/topology/share/SendData.java src/alice/topology/node/ConfigurationFinish.java src/alice/topology/node/IncomingConnectionInfo.java src/alice/topology/node/IncomingReverseKey.java
diffstat 29 files changed, 61 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/codesegment/OutputDataSegment.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/codesegment/OutputDataSegment.java	Wed Mar 27 18:16:34 2013 +0900
@@ -6,12 +6,8 @@
 import org.msgpack.type.Value;
 import org.msgpack.type.ValueFactory;
 
-import alice.datasegment.Command;
-import alice.datasegment.CommandType;
 import alice.datasegment.DataSegment;
-import alice.datasegment.DataSegmentKey;
 import alice.datasegment.Receiver;
-import alice.test.codesegment.local.bitonicsort.DataList;
 
 public class OutputDataSegment {
 	
@@ -35,7 +31,7 @@
 	}
 	
 	public void flip(Receiver receiver) {
-		DataSegment.getLocal().put(receiver.key, receiver.data.getObject());
+		DataSegment.getLocal().put(receiver.key, receiver.getVal());
 	}
 	
 	public void put(String key, Value val) {
--- a/src/alice/codesegment/ReceiveLocalData.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/codesegment/ReceiveLocalData.java	Wed Mar 27 18:16:34 2013 +0900
@@ -1,6 +1,10 @@
 package alice.codesegment;
 
+import java.io.IOException;
+
 import org.msgpack.type.ArrayValue;
+import org.msgpack.type.Value;
+
 import alice.datasegment.Receiver;
 import alice.datasegment.ReceiverData;
 
@@ -34,7 +38,12 @@
 	}
 
 	@Override
-	public Object getVal() {
-		return obj;
+	public Value getVal() {
+		try {
+			return SingletonMessage.getInstance().unconvert(obj);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
 	}
 }
--- a/src/alice/datasegment/ReceiveRemoteData.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/datasegment/ReceiveRemoteData.java	Wed Mar 27 18:16:34 2013 +0900
@@ -57,7 +57,7 @@
 	}
 
 	@Override
-	public Object getVal() {
+	public Value getVal() {
 		return val;
 	}
 	
--- a/src/alice/datasegment/Receiver.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/datasegment/Receiver.java	Wed Mar 27 18:16:34 2013 +0900
@@ -1,11 +1,7 @@
 package alice.datasegment;
 
 
-import java.io.IOException;
-
 import alice.codesegment.InputDataSegment;
-import alice.codesegment.SingletonMessage;
-import alice.test.codesegment.local.bitonicsort.SortConfig;
 
 /**
  * MessagePack implementation and DataSegment Receiver
--- a/src/alice/datasegment/ReceiverData.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/datasegment/ReceiverData.java	Wed Mar 27 18:16:34 2013 +0900
@@ -1,6 +1,7 @@
 package alice.datasegment;
 
 import org.msgpack.type.ArrayValue;
+import org.msgpack.type.Value;
 
 public interface ReceiverData {
 
@@ -9,6 +10,6 @@
 	public Float asFloat(Receiver receiver) ;
 	public ArrayValue asArray(Receiver receiver);
 	public <T> T asClass(Receiver receiver, Class<T> clazz);
-	public Object getVal();
+	public Value getVal();
 	
 }
\ No newline at end of file
--- a/src/alice/test/codesegment/api/FlipTest.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/codesegment/api/FlipTest.java	Wed Mar 27 18:16:34 2013 +0900
@@ -22,19 +22,6 @@
 	@Override
 	public void run() {
 
-		System.out.println(arg1.data.obj);
-
-
-		Integer num = (Integer) arg1.data.obj;
-		
-		num++;
-		//System.out.println(arg1.obj);
-		//arg1.flip(CommandType.UPDATE, arg1.key, num, false);
-		ods.update(arg1.data.key, num, false);
-
-		//System.out.println(arg1.obj);
-		//flag = true;
-		new FlipTest(arg1.data.key,arg1.data.index);
 	}
 
 
--- a/src/alice/test/codesegment/api/TakeCodeSegment.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/codesegment/api/TakeCodeSegment.java	Wed Mar 27 18:16:34 2013 +0900
@@ -13,7 +13,7 @@
 	}	
 	@Override
 	public void run() {
-		new TakeCodeSegment(ds1.data.key);
+		new TakeCodeSegment(ds1.key);
 		
 	}
 }
--- a/src/alice/test/codesegment/api/UpdateCodeSegment.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/codesegment/api/UpdateCodeSegment.java	Wed Mar 27 18:16:34 2013 +0900
@@ -13,8 +13,8 @@
 	@Override
 	public void run() {
 		UpdateCodeSegment cs1 = new UpdateCodeSegment();
-		cs1.ds1.setKey("key", ds1.data.index);
-		Value[] array = ds1.data.val.asArrayValue().getElementArray();
+		cs1.ds1.setKey("key", ds1.index);
+		Value[] array = ((Value)ds1.getVal()).asArrayValue().getElementArray();
 		int val = array[0].asIntegerValue().getInt();
 		if (val % 10 == 0)
 			System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "MB");
--- a/src/alice/test/topology/aquarium/AddRoutingTable.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/aquarium/AddRoutingTable.java	Wed Mar 27 18:16:34 2013 +0900
@@ -18,10 +18,10 @@
 	@Override
 	public void run() {
 		//System.out.println("add "+this.mail.from);
-		routing.table.add(new Routing(this.mail.data.from));
+		routing.table.add(new Routing(this.mail.from));
 		
 		ods.update("local", "list", this.routing);
-		new AddRoutingTable(this.routing, this.mail.data.index);
+		new AddRoutingTable(this.routing, this.mail.index);
 		
 	}
 	
--- a/src/alice/test/topology/aquarium/AutoIncrement.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/aquarium/AutoIncrement.java	Wed Mar 27 18:16:34 2013 +0900
@@ -29,7 +29,7 @@
 			fp.setXYZ(fp.getX()+0.01f, fp.getY(), fp.getZ());
 		}
 		
-		ods.update("local", position.data.key, fp);
+		ods.update("local", position.key, fp);
 		synchronized(this){
 			try {
 				// TODO
@@ -42,7 +42,7 @@
 			}
 		}
 		
-		new AutoIncrement(this.position.data.key, this.position.data.index);
+		new AutoIncrement(this.position.key, this.position.index);
 	}
 	
 }
--- a/src/alice/test/topology/aquarium/CheckLocalIndex.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/aquarium/CheckLocalIndex.java	Wed Mar 27 18:16:34 2013 +0900
@@ -19,12 +19,12 @@
 	public void run() {
 		RoutingTable rt = this.list.data.asClass(this.list, RoutingTable.class);
 		for (Routing r : rt.table) {
-			if (!r.name.equals(this.data.data.from)){
-				ods.update(r.name, data.data.key, this.data.data.val);
+			if (!r.name.equals(this.data.from)){
+				ods.update(r.name, data.key, this.data.getVal());
 			}
 			
 		}
-		new CheckLocalIndex(data.data.key, this.data.data.index);
+		new CheckLocalIndex(data.key, this.data.index);
 		
 	}
 
--- a/src/alice/test/topology/aquarium/SendMaxsize.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/aquarium/SendMaxsize.java	Wed Mar 27 18:16:34 2013 +0900
@@ -16,7 +16,7 @@
 	public void run() {
 		int size = max.data.asInteger(max);
 		ods.update("local","maxsize",size);
-		new SendMaxsize(this.max.data.index);
+		new SendMaxsize(this.max.index);
 	}
 
 }
--- a/src/alice/test/topology/aquarium/SetLocation.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/aquarium/SetLocation.java	Wed Mar 27 18:16:34 2013 +0900
@@ -21,7 +21,7 @@
 	public void run(){
 		FishPoint fp = this.position.data.asClass(this.position, FishPoint.class);
 		obj.setLocation(fp.getX(), fp.getY(), fp.getZ());
-		new SetLocation(obj, position.data.key, position.data.index, range);
+		new SetLocation(obj, position.key, position.index, range);
 					
 	}
 	
--- a/src/alice/test/topology/aquarium/TakeMynum.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/aquarium/TakeMynum.java	Wed Mar 27 18:16:34 2013 +0900
@@ -20,7 +20,7 @@
 	public void run() {
 		new TakePnum(this.mynum);
 		ods.put("local", "num", 0);
-		new TakeMynum(this.mynum.data.index+1);
+		new TakeMynum(this.mynum.index+1);
 	}
 
 }
--- a/src/alice/test/topology/fish/AsignStartX.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/fish/AsignStartX.java	Wed Mar 27 18:16:34 2013 +0900
@@ -19,12 +19,12 @@
 	public void run() {
 		System.out.println("AsignStartX: " + startX);
 		
-		RoutingTable routing = this.routing.data.asClass(this.routing, RoutingTable.class);
+		RoutingTable routing = this.routing.asClass(this.routing, RoutingTable.class);
 		int x = startX;
-		System.out.println("RoutingTable: " + this.routing.data.val);
-		if (this.index >= this.routing.data.index) {
+		System.out.println("RoutingTable: " + this.routing.getVal());
+		if (this.index >= this.routing.index) {
 			AsignStartX cs = new AsignStartX(startX, index);
-			cs.routing.setKey("local", "routing", this.routing.data.index);
+			cs.routing.setKey("local", "routing", this.routing.index);
 			return;
 		}
 		for (Routing r : routing.table) {
@@ -33,7 +33,7 @@
 			System.out.println("Assign: " + r.name + ".startX = " + x);
 			x += r.width;
 		}
-		PeekStartX cs = new PeekStartX(this.routing.data.index);
+		PeekStartX cs = new PeekStartX(this.routing.index);
 		cs.startX.setKey("local", "startX", this.index);
 	}
 
--- a/src/alice/test/topology/fish/GetStartX.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/fish/GetStartX.java	Wed Mar 27 18:16:34 2013 +0900
@@ -15,7 +15,7 @@
 		System.out.println("GetStartX: " + startX);
 		
 		GetStartX cs = new GetStartX();
-		cs.startX.setKey("local", "startX", this.startX.data.index);
+		cs.startX.setKey("local", "startX", this.startX.index);
 	}
 
 }
--- a/src/alice/test/topology/fish/PeekStartX.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/fish/PeekStartX.java	Wed Mar 27 18:16:34 2013 +0900
@@ -16,8 +16,8 @@
 	@Override
 	public void run() {
 		int startX = this.startX.data.asInteger(this.startX);
-		AsignStartX cs = new AsignStartX(startX, this.startX.data.index);
-		cs.routing.setKey("local", "routing", this.startX.data.index);
+		AsignStartX cs = new AsignStartX(startX, this.startX.index);
+		cs.routing.setKey("local", "routing", this.startX.index);
 	}
 
 }
--- a/src/alice/test/topology/fish/SendWidth.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/fish/SendWidth.java	Wed Mar 27 18:16:34 2013 +0900
@@ -16,7 +16,7 @@
 		System.out.println("send widths: " + width);
 		
 		SendWidth cs = new SendWidth();
-		cs.width.setKey("local", "width", this.width.data.index);
+		cs.width.setKey("local", "width", this.width.index);
 	}
 
 }
--- a/src/alice/test/topology/fish/StartStartX.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/fish/StartStartX.java	Wed Mar 27 18:16:34 2013 +0900
@@ -12,7 +12,7 @@
 	public void run() {
 		ods.update("local", "startX", 0);
 		StartStartX cs = new StartStartX();
-		cs.width.setKey("local", "width", this.width.data.index);
+		cs.width.setKey("local", "width", this.width.index);
 	}
 
 }
--- a/src/alice/test/topology/fish/WidthReceiver.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/fish/WidthReceiver.java	Wed Mar 27 18:16:34 2013 +0900
@@ -14,9 +14,9 @@
 	
 	@Override
 	public void run() {
-		int width = this.widths.data.asInteger(this.widths);
-		String from = this.widths.data.from;
-		RoutingTable routing = this.routing.data.asClass(this.routing, RoutingTable.class);
+		int width = this.widths.asInteger(this.widths);
+		String from = this.widths.from;
+		RoutingTable routing = this.routing.asClass(this.routing, RoutingTable.class);
 		Routing newRouting = new Routing(from, width);
 		boolean update = false;
 		for (Routing r : routing.table) {
@@ -47,7 +47,7 @@
 		ods.update("local", "routing", routing);
 		
 		WidthReceiver cs = new WidthReceiver();
-		cs.widths.setKey("local", "widths", this.widths.data.index);
+		cs.widths.setKey("local", "widths", this.widths.index);
 		cs.routing.setKey("local", "routing");
 		//cs.routing.setKey("local", "routing", this.routing.index);
 	}
--- a/src/alice/test/topology/ring/FirstRingMessagePassing.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/ring/FirstRingMessagePassing.java	Wed Mar 27 18:16:34 2013 +0900
@@ -27,8 +27,8 @@
 	
 	@Override
 	public void run() {
-		ods.put("right", "c", ds1.data.val); // copy whole DataSegment to the right
-		if (ds1.data.index > count) {        // after count time update of ds1
+		ods.put("right", "c", ds1.getVal()); // copy whole DataSegment to the right
+		if (ds1.index > count) {        // after count time update of ds1
 			ods.put("right", "finish", ValueFactory.createNilValue());
 			long endTime = System.nanoTime();
 			long time = endTime - startTime;
--- a/src/alice/test/topology/ring/RingMessagePassing.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/ring/RingMessagePassing.java	Wed Mar 27 18:16:34 2013 +0900
@@ -10,7 +10,7 @@
 
 	@Override
 	public void run() {
-		ods.put("right", "c", this.ds1.data.val);
+		ods.put("right", "c", this.ds1.getVal());
 		RingMessagePassing cs = new RingMessagePassing();
 		cs.ds1.setKey("c");
 	}
--- a/src/alice/test/topology/share/AutoIncrement.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/share/AutoIncrement.java	Wed Mar 27 18:16:34 2013 +0900
@@ -24,7 +24,7 @@
 			}
 		}
 		ods.update("local", key, new DataInfo(System.nanoTime()));
-		new AutoIncrement(this.key ,this.position.data.index);
+		new AutoIncrement(this.key ,this.position.index);
 	}
 	
 }
--- a/src/alice/test/topology/share/CheckLocalIndex.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/share/CheckLocalIndex.java	Wed Mar 27 18:16:34 2013 +0900
@@ -27,16 +27,16 @@
 		boolean flag = false;
 		for (Routing r : rt.table) {
 			if (r.name.equals("parent"))flag=true;
-			if (!r.name.equals(this.data.data.from)){
-				ods.update(r.name, this.key, this.data.data.val);
+			if (!r.name.equals(this.data.from)){
+				ods.update(r.name, this.key, this.data.getVal());
 				count++;
 			}
 			
 		}
 		if (count==0&&flag){
-			ods.put("parent", "data", this.data.data.val);
+			ods.put("parent", "data", this.data.getVal());
 		}
-		new CheckLocalIndex(this.key, this.data.data.index);
+		new CheckLocalIndex(this.key, this.data.index);
 		
 	}
 
--- a/src/alice/test/topology/share/LookUpData.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/share/LookUpData.java	Wed Mar 27 18:16:34 2013 +0900
@@ -23,7 +23,7 @@
 
 	@Override
 	public void run(){
-		new LookUpData(this.key,this.data.data.index);
+		new LookUpData(this.key,this.data.index);
 		DataInfo di = data.data.asClass(data, DataInfo.class);
 		System.out.println(System.nanoTime()-di.getTime());
 
--- a/src/alice/test/topology/share/SendData.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/test/topology/share/SendData.java	Wed Mar 27 18:16:34 2013 +0900
@@ -13,8 +13,8 @@
 	
 	@Override
 	public void run(){
-		new SendData(this.data.data.index);
-		ods.put("parent", "data", this.data.data.val);
+		new SendData(this.data.index);
+		ods.put("parent", "data", this.data.getVal());
 	}
 	
 }
\ No newline at end of file
--- a/src/alice/topology/node/ConfigurationFinish.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/topology/node/ConfigurationFinish.java	Wed Mar 27 18:16:34 2013 +0900
@@ -18,7 +18,7 @@
 	
 	@Override
 	public void run() {
-		if (reverseCount.data.val.equals(configNodeNum.data.val)) {
+		if (reverseCount.getVal().equals(configNodeNum.getVal())) {
 			ods.put("manager", "done", ValueFactory.createNilValue());
 
 			Start cs = new Start(startCS);
@@ -28,7 +28,7 @@
 		}
 		
 		ConfigurationFinish cs3 = new ConfigurationFinish(startCS);
-		cs3.reverseCount.setKey("local", "reverseCount", this.reverseCount.data.index);
+		cs3.reverseCount.setKey("local", "reverseCount", this.reverseCount.index);
 		cs3.configNodeNum.setKey("local", "configNodeNum");
 	}
 
--- a/src/alice/topology/node/IncomingConnectionInfo.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/topology/node/IncomingConnectionInfo.java	Wed Mar 27 18:16:34 2013 +0900
@@ -19,12 +19,12 @@
 
 	@Override
 	public void run() {
-		if (this.hostInfo.data.val == null) {
+		if (this.hostInfo.getVal() == null) {
 			ods.put("local", "configNodeNum", count);
 			return;
 		}
 		
-		HostMessage hostInfo = this.hostInfo.data.asClass(this.hostInfo, HostMessage.class);
+		HostMessage hostInfo = this.hostInfo.asClass(this.hostInfo, HostMessage.class);
 		DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
 		ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
 
--- a/src/alice/topology/node/IncomingReverseKey.java	Wed Mar 27 17:56:08 2013 +0900
+++ b/src/alice/topology/node/IncomingReverseKey.java	Wed Mar 27 18:16:34 2013 +0900
@@ -4,6 +4,7 @@
 import alice.datasegment.CommandType;
 import alice.datasegment.DataSegment;
 import alice.datasegment.Receiver;
+import org.msgpack.type.Value;
 
 public class IncomingReverseKey extends CodeSegment {
 
@@ -12,11 +13,11 @@
 	
 	@Override
 	public void run() {
-		String reverseKey = this.reverseKey.data.val.asRawValue().getString();
-		String from = this.reverseKey.data.from;
+		String reverseKey = ((Value)this.reverseKey.getVal()).asRawValue().getString();
+		String from = this.reverseKey.from;
 		DataSegment.getAccept(from).reverseKey = reverseKey;
 		
-		int reverseCount = this.reverseCount.data.asInteger(this.reverseCount);
+		int reverseCount = this.reverseCount.asInteger(this.reverseCount);
 		reverseCount++;
 		ods.update("local", "reverseCount", reverseCount);