changeset 212:b5daccf36104 working

add Receiver state pattern
author one
date Wed, 27 Mar 2013 17:30:52 +0900
parents b8f72b378f18
children 3f20b6401823
files src/alice/codesegment/InputDataSegment.java src/alice/codesegment/OutputDataSegment.java src/alice/codesegment/ReceiveLocalData.java src/alice/datasegment/LocalDataSegmentManager.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/codesegment/local/TestCodeSegment.java src/alice/test/codesegment/local/bitonicsort/MakeData.java src/alice/test/codesegment/local/bitonicsort/OddPhase.java src/alice/test/codesegment/local/bitonicsort/SetTask.java src/alice/test/codesegment/local/bitonicsort/ShowData.java src/alice/test/codesegment/remote/RemoteIncrement.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/CheckMyName.java src/alice/test/topology/aquarium/RefreshWindow.java src/alice/test/topology/aquarium/SendLocation.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/aquarium/TakePnum.java src/alice/test/topology/fish/AsignStartX.java src/alice/test/topology/fish/CheckMyName.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/CheckMyName.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/CheckMyName.java src/alice/test/topology/share/LookUpData.java src/alice/test/topology/share/SendData.java src/alice/topology/manager/IncomingHosts.java src/alice/topology/node/ConfigurationFinish.java src/alice/topology/node/IncomingAbstractHostName.java src/alice/topology/node/IncomingConnectionInfo.java src/alice/topology/node/IncomingReverseKey.java
diffstat 46 files changed, 207 insertions(+), 242 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/codesegment/InputDataSegment.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/codesegment/InputDataSegment.java	Wed Mar 27 17:30:52 2013 +0900
@@ -5,6 +5,7 @@
 import alice.datasegment.Command;
 import alice.datasegment.CommandType;
 import alice.datasegment.DataSegment;
+import alice.datasegment.ReceiveRemoteData;
 import alice.datasegment.Receiver;
 
 /**
@@ -54,17 +55,15 @@
 	public void take(Receiver receiver, String key, int index) {
 		DataSegment.getLocal().take(receiver, key, index, cs);
 	}
-	
-	public void flip(Command cmd) {
-		DataSegment.getLocal().flip(cmd);
-	}
 
 	public void reply(Receiver receiver, Command reply) {
 		receiver.index = reply.index;
-		receiver.val = reply.val;
 		receiver.from = reply.reverseKey;
-		receiver.obj = reply.obj;
-		receiver.setCommand(reply);
+		if (!reply.reverseKey.equals("local")) {
+			receiver.setData(new ReceiveRemoteData(reply.val));
+		} else {
+			receiver.setData(new ReceiveLocalData(reply.obj));
+		}
 		receive();
 	}
 
--- a/src/alice/codesegment/OutputDataSegment.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/codesegment/OutputDataSegment.java	Wed Mar 27 17:30:52 2013 +0900
@@ -36,8 +36,8 @@
 	
 	public void flip(Receiver receiver) {
 		//DataSegment.getLocal().put(receiver.key, receiver.val,receiver.obj);
-		DataSegmentKey key = DataSegment.getLocal().getDataSegmentKey(receiver.key);
-		key.runCommand(new Command(CommandType.PUT,null,null, receiver.val,receiver.obj, 0,0,null,null, "local"));
+		DataSegmentKey key = DataSegment.getLocal().getDataSegmentKey(receiver.data.key);
+		key.runCommand(new Command(CommandType.PUT,null,null, receiver.data.val,receiver.data.obj, 0,0,null,null, "local"));
 	}
 	
 	public void put(String key, Value val) {
@@ -57,22 +57,9 @@
 	}
 	
 	public <T> void put(String key, T val) {
-		try {
-			DataSegment.getLocal().put(key, SingletonMessage.getInstance().unconvert(val));
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
+		DataSegment.getLocal().put(key, (Object)val);
 	}
 	
-	public void put(Receiver receiver, String key, Object obj, boolean flag) {
-		DataSegment.getLocal().put(receiver, key, obj);
-	}
-	
-	public void update(Receiver receiver, String key, Object obj, boolean flag) {
-		DataSegment.getLocal().update(receiver, key, obj);
-	}
-	
-	
 	public void update(String key, Value val) {
 		DataSegment.getLocal().update(key, val);
 	}
@@ -90,13 +77,7 @@
 	}
 	
 	public <T> void update(String key, T val) {
-		try {
-			long t = System.currentTimeMillis();
-			DataSegment.getLocal().update(key, SingletonMessage.getInstance().unconvert(val));
-			System.out.println(System.currentTimeMillis() - t);
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
+		DataSegment.getLocal().update(key, (Object)val);
 	}
 	
 	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/alice/codesegment/ReceiveLocalData.java	Wed Mar 27 17:30:52 2013 +0900
@@ -0,0 +1,35 @@
+package alice.codesegment;
+
+import org.msgpack.type.ArrayValue;
+import alice.datasegment.Receiver;
+import alice.datasegment.ReceiverData;
+
+public class ReceiveLocalData implements ReceiverData {
+	private Object obj;
+
+	public ReceiveLocalData(Object obj2) {
+		this.obj = obj2;
+	}
+
+	public String asString(Receiver receiver) {
+		return (String) obj;
+	}
+
+	public int asInteger(Receiver receiver) {
+		return (Integer) obj;
+	}
+
+	public Float asFloat(Receiver receiver) {
+		return (Float) obj;
+	}
+
+	public ArrayValue asArray(Receiver receiver){
+		return (ArrayValue) obj;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public <T> T asClass(Receiver receiver, Class<T> clazz) {
+		return (T) obj;
+
+	}
+}
--- a/src/alice/datasegment/LocalDataSegmentManager.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/datasegment/LocalDataSegmentManager.java	Wed Mar 27 17:30:52 2013 +0900
@@ -135,49 +135,6 @@
 	public void close() {
 		
 	}
-	
 
-	public void flip(Command cmd){
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(cmd.key);
-		addCommand(dataSegmentKey, cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	public void put(Command cmd){
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(cmd.key);
-		addCommand(dataSegmentKey, cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	public void update(Command cmd){
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(cmd.key);
-		addCommand(dataSegmentKey, cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-
-
-
-	public void put(Receiver receiver, String key, Object obj) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = receiver.getCommand();
-		cmd.setElement(CommandType.PUT, key, null, obj);
-		addCommand(dataSegmentKey, cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-		
-	}
-	
-	public void update(Receiver receiver, String key, Object obj) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = receiver.getCommand();
-		cmd.setElement(CommandType.UPDATE, key, null, obj);
-		addCommand(dataSegmentKey, cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-		
-	}
 	
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/alice/datasegment/ReceiveRemoteData.java	Wed Mar 27 17:30:52 2013 +0900
@@ -0,0 +1,60 @@
+package alice.datasegment;
+
+import java.io.IOException;
+
+import org.msgpack.type.ArrayValue;
+import org.msgpack.type.Value;
+import org.msgpack.type.ValueType;
+
+import alice.codesegment.SingletonMessage;
+
+public class ReceiveRemoteData implements ReceiverData {
+	public Value val;
+
+	public ReceiveRemoteData() {
+	}
+
+	public ReceiveRemoteData(Value val2) {
+		this.val = val2;
+	}
+
+	public String asString(Receiver receiver) {
+		if (val.getType() == ValueType.RAW) {
+			return val.asRawValue().getString();
+		}
+		return null;
+	}
+
+	public int asInteger(Receiver receiver) {
+		if (val.getType() == ValueType.INTEGER) {
+			return val.asIntegerValue().getInt();
+		}
+		return 0;
+	}
+
+	public Float asFloat(Receiver receiver) {
+		if (val.getType() == ValueType.FLOAT) {
+			return val.asFloatValue().getFloat();
+		}
+		return 0.0f;
+	}
+
+	public ArrayValue asArray(Receiver receiver){
+		if (val.getType() == ValueType.ARRAY){
+			return val.asArrayValue();
+		}
+		return null;
+	}
+	
+	public <T> T asClass(Receiver receiver, Class<T> clazz) {
+		try {
+			return SingletonMessage.getInstance().convert(val, clazz);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+
+	}
+	
+	
+}
\ No newline at end of file
--- a/src/alice/datasegment/Receiver.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/datasegment/Receiver.java	Wed Mar 27 17:30:52 2013 +0900
@@ -1,14 +1,7 @@
 package alice.datasegment;
 
-import java.io.IOException;
-
-import org.msgpack.type.ArrayValue;
-import org.msgpack.type.Value;
-import org.msgpack.type.ValueFactory;
-import org.msgpack.type.ValueType;
 
 import alice.codesegment.InputDataSegment;
-import alice.codesegment.SingletonMessage;
 
 /**
  * MessagePack implementation and DataSegment Receiver
@@ -16,51 +9,21 @@
  *
  */
 public class Receiver {
+	public ReceiverData data = new ReceiveRemoteData();
 	public InputDataSegment ids;
 	public int index;
-	public Value val;
-	public Object obj;
 	public String from;
 	public CommandType type;
-	
-	public String managerKey; // for debugging
-	public String key; 		  // for debugging
-	private Command cmd;      // for flip
-	
+	public String managerKey;
+	public String key;
+
 	public Receiver(InputDataSegment ids, CommandType type) {
 		this.ids = ids;
 		this.type = type;
 		ids.regist();
-	}
-	
-	public void setCommand(Command cmd) {
-		this.cmd = cmd;
 		
 	}
 	
-	public void flip(CommandType type, String key, int val){
-		flip(type, key, ValueFactory.createIntegerValue(val));
-	}
-	
-	public void flip(CommandType type, String key, String val){
-		flip(type, key, ValueFactory.createRawValue(val));
-	}
-	
-	public void flip(CommandType type, String key, byte[] val){
-		flip(type, key, ValueFactory.createRawValue(val, true));
-	}
-	
-	public void flip(CommandType type, String key, Object obj, Boolean covertFlag){
-		cmd.setElement(type, key, null, obj);
-		ids.flip(cmd);
-	}
-	
-	
-	public void flip(CommandType type, String key, Value val){
-		cmd.setElement(type, key, val, null);
-		ids.flip(cmd);
-	}
-	
 	public void setKey(String managerKey, String key) {
 		this.managerKey = managerKey;
 		setKey(managerKey, key, 0);
@@ -99,46 +62,10 @@
 		}
 		ids.setKey();
 	}
-	
-	public String asString() {
-		if (val.getType() == ValueType.RAW) {
-			return val.asRawValue().getString();
-		}
-		return null;
-	}
 
-	public int asInteger() {
-		if (val.getType() == ValueType.INTEGER) {
-			return val.asIntegerValue().getInt();
-		}
-		return 0;
-	}
-	
-	public Float asFloat() {
-		if (val.getType() == ValueType.FLOAT) {
-			return val.asFloatValue().getFloat();
-		}
-		return 0.0f;
-	}
-	
-	public ArrayValue asArray(){
-		if (val.getType() == ValueType.ARRAY){
-			return val.asArrayValue();
-		}
-		return null;
-	}
-	
-	public <T> T asClass(Class<T> clazz) {
-		try {
-			return SingletonMessage.getInstance().convert(val, clazz);
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		return null;
-	}
-
-	public Command getCommand() {
-		return this.cmd;
+	public void setData(ReceiverData r) {
+		data = r;
+		
 	}
 	
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/alice/datasegment/ReceiverData.java	Wed Mar 27 17:30:52 2013 +0900
@@ -0,0 +1,5 @@
+package alice.datasegment;
+
+public interface ReceiverData {
+
+}
\ No newline at end of file
--- a/src/alice/test/codesegment/api/FlipTest.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/api/FlipTest.java	Wed Mar 27 17:30:52 2013 +0900
@@ -22,19 +22,19 @@
 	@Override
 	public void run() {
 
-		System.out.println(arg1.obj);
+		System.out.println(arg1.data.obj);
 
 
-		Integer num = (Integer) arg1.obj;
+		Integer num = (Integer) arg1.data.obj;
 		
 		num++;
 		//System.out.println(arg1.obj);
 		//arg1.flip(CommandType.UPDATE, arg1.key, num, false);
-		ods.update(arg1.key, num, false);
+		ods.update(arg1.data.key, num, false);
 
 		//System.out.println(arg1.obj);
 		//flag = true;
-		new FlipTest(arg1.key,arg1.index);
+		new FlipTest(arg1.data.key,arg1.data.index);
 	}
 
 
--- a/src/alice/test/codesegment/api/TakeCodeSegment.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/api/TakeCodeSegment.java	Wed Mar 27 17:30:52 2013 +0900
@@ -13,7 +13,7 @@
 	}	
 	@Override
 	public void run() {
-		new TakeCodeSegment(ds1.key);
+		new TakeCodeSegment(ds1.data.key);
 		
 	}
 }
--- a/src/alice/test/codesegment/api/UpdateCodeSegment.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/api/UpdateCodeSegment.java	Wed Mar 27 17:30:52 2013 +0900
@@ -13,8 +13,8 @@
 	@Override
 	public void run() {
 		UpdateCodeSegment cs1 = new UpdateCodeSegment();
-		cs1.ds1.setKey("key", ds1.index);
-		Value[] array = ds1.val.asArrayValue().getElementArray();
+		cs1.ds1.setKey("key", ds1.data.index);
+		Value[] array = ds1.data.val.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/codesegment/local/TestCodeSegment.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/local/TestCodeSegment.java	Wed Mar 27 17:30:52 2013 +0900
@@ -11,17 +11,17 @@
 	
 	@Override
 	public void run() {
-		System.out.println("index = " + arg1.index);
-		System.out.println("data = " + arg1.val);
-		System.out.println(arg1.val.getType());
+		System.out.println("index = " + arg1.data.index);
+		System.out.println("data = " + arg1.data.val);
+		System.out.println(arg1.data.val.getType());
 		
-		if (arg1.index == 10) {
+		if (arg1.data.index == 10) {
 			System.exit(0);
 			return;
 		}
 		
 		TestCodeSegment cs = new TestCodeSegment();
-		cs.arg1.setKey("key1", arg1.index);
+		cs.arg1.setKey("key1", arg1.data.index);
 		
 		// DataSegment.get("local").update
 		ods.update("local", "key1", "String data");
--- a/src/alice/test/codesegment/local/bitonicsort/MakeData.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/MakeData.java	Wed Mar 27 17:30:52 2013 +0900
@@ -19,8 +19,8 @@
 	@Override
 	public void run() {
 		// This conversion over head should be remove.
-		SortConfig conf = info1.asClass(SortConfig.class);
-		DataList list = (DataList)info2.obj;
+		SortConfig conf = info1.data.asClass(info1, SortConfig.class);
+		DataList list = (DataList)info2.data.obj;
 		int size = conf.getLength();
 		Random rnd = new Random();
 		for (int i = 0; i < size; i++){
--- a/src/alice/test/codesegment/local/bitonicsort/OddPhase.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/OddPhase.java	Wed Mar 27 17:30:52 2013 +0900
@@ -27,15 +27,16 @@
 	
 	@Override
 	public void run() {
-		RangeInfo info = info0.asClass(RangeInfo.class);
-		int sort_count = info5.asInteger();
-		int count = info6.asInteger();
+		RangeInfo info = info0.data.asClass(info0, RangeInfo.class);
+		int sort_count = info5.data.asInteger(info5);
+		int count = info6.data.asInteger(info6);
 		//System.out.println("count is " +count);
 		
 		int i = info.range;
-		if (count<sort_count){		
-			DataList list1 = (DataList)info1.obj;
-			DataList list2 = (DataList)info2.obj;
+		if (count<sort_count){
+			DataList list3 =  info1.data.asClass(info1, DataList.class);
+			DataList list1 = (DataList)info1.data.obj;
+			DataList list2 = (DataList)info2.data.obj;
 			
 			Sort.quickSort(list1,0,list1.table.length-1);
 			Sort.quickSort(list2,0,list2.table.length-1);
@@ -49,13 +50,13 @@
 			if (i+2 < SetInfo.array.length){
 				String f = (count%2==1) ? SetInfo.array[i] : SetInfo.array[i+1];
 				String b = (count%2==1) ? SetInfo.array[i+1] : SetInfo.array[i+2];
-				new OddPhase(info0.key, f, b,count,info6.key);
+				new OddPhase(info0.data.key, f, b,count,info6.data.key);
 			}
 		} else {
 			ods.put(SetInfo.result[i*2], info1);
 			ods.put(SetInfo.result[i*2+1], info2);
 		}
-		ods.update(info6.key, count+1);
+		ods.update(info6.data.key, count+1);
 		
 		
 	}
--- a/src/alice/test/codesegment/local/bitonicsort/SetTask.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/SetTask.java	Wed Mar 27 17:30:52 2013 +0900
@@ -16,8 +16,8 @@
 	
 	@Override
 	public void run() {
-		SortConfig conf = info1.asClass(SortConfig.class);
-		DataList list = (DataList)info2.obj;
+		SortConfig conf = info1.data.asClass(info1, SortConfig.class);
+		DataList list = (DataList)info2.data.obj;
 		
 		int sort_count = conf.getSplitNum()*2;
 		ods.put("sort_count", sort_count*2);
--- a/src/alice/test/codesegment/local/bitonicsort/ShowData.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/ShowData.java	Wed Mar 27 17:30:52 2013 +0900
@@ -22,11 +22,11 @@
 	@Override
 	public void run() {
 		System.out.println(System.currentTimeMillis() -SetTask.t +" ms");
-		int cnt = info0.asInteger();
+		int cnt = info0.data.asInteger(info0);
 		int size = 0;
 		
 		for (int i= 0;i < cnt; i++){
-			DataList dlist = (DataList)info[i].obj;
+			DataList dlist = (DataList)info[i].data.obj;
 			size += dlist.table.length;
 		}
 		
@@ -34,7 +34,7 @@
 		
 		int start = 0;
 		for (int i= 0;i < cnt; i++){
-			DataList dlist = (DataList)info[i].obj;	
+			DataList dlist = (DataList)info[i].data.obj;	
 			System.arraycopy(dlist.table, 0, list.table, start, dlist.table.length);
 			start += dlist.table.length;
 		}
--- a/src/alice/test/codesegment/remote/RemoteIncrement.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/codesegment/remote/RemoteIncrement.java	Wed Mar 27 17:30:52 2013 +0900
@@ -13,7 +13,7 @@
 	 */
 	@Override
 	public void run() {
-		int num = this.num.asInteger();
+		int num = this.num.data.asInteger(this.num);
 		System.out.println("[CodeSegment] " + num++);
 		if (num == 10) System.exit(0);
 
--- a/src/alice/test/topology/aquarium/AddRoutingTable.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/AddRoutingTable.java	Wed Mar 27 17:30:52 2013 +0900
@@ -18,10 +18,10 @@
 	@Override
 	public void run() {
 		//System.out.println("add "+this.mail.from);
-		routing.table.add(new Routing(this.mail.from));
+		routing.table.add(new Routing(this.mail.data.from));
 		
 		ods.update("local", "list", this.routing);
-		new AddRoutingTable(this.routing, this.mail.index);
+		new AddRoutingTable(this.routing, this.mail.data.index);
 		
 	}
 	
--- a/src/alice/test/topology/aquarium/AutoIncrement.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/AutoIncrement.java	Wed Mar 27 17:30:52 2013 +0900
@@ -18,8 +18,8 @@
 
 	@Override
 	public void run() {
-		max = this.number.asInteger()*2-1+0.3f;
-		FishPoint fp = this.position.asClass(FishPoint.class);
+		max = this.number.data.asInteger(this.number)*2-1+0.3f;
+		FishPoint fp = this.position.data.asClass(this.position, FishPoint.class);
 		if (fp.getX()+0.01>max){
 			fp.setXYZ(min, fp.getY(), fp.getZ());
 		} else if (fp.getX()+0.01< min){
@@ -29,7 +29,7 @@
 			fp.setXYZ(fp.getX()+0.01f, fp.getY(), fp.getZ());
 		}
 		
-		ods.update("local", position.key, fp);
+		ods.update("local", position.data.key, fp);
 		synchronized(this){
 			try {
 				// TODO
@@ -42,7 +42,7 @@
 			}
 		}
 		
-		new AutoIncrement(this.position.key, this.position.index);
+		new AutoIncrement(this.position.data.key, this.position.data.index);
 	}
 	
 }
--- a/src/alice/test/topology/aquarium/CheckLocalIndex.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/CheckLocalIndex.java	Wed Mar 27 17:30:52 2013 +0900
@@ -17,14 +17,14 @@
 	
 	@Override
 	public void run() {
-		RoutingTable rt = this.list.asClass(RoutingTable.class);
+		RoutingTable rt = this.list.data.asClass(this.list, RoutingTable.class);
 		for (Routing r : rt.table) {
-			if (!r.name.equals(this.data.from)){
-				ods.update(r.name, data.key, this.data.val);
+			if (!r.name.equals(this.data.data.from)){
+				ods.update(r.name, data.data.key, this.data.data.val);
 			}
 			
 		}
-		new CheckLocalIndex(data.key, this.data.index);
+		new CheckLocalIndex(data.data.key, this.data.data.index);
 		
 	}
 
--- a/src/alice/test/topology/aquarium/CheckMyName.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/CheckMyName.java	Wed Mar 27 17:30:52 2013 +0900
@@ -21,7 +21,7 @@
 	@Override
 	public void run(){
 		
-		String name = host.asString();
+		String name = host.data.asString(host);
 		Matcher matcher = pattern.matcher(name);
 		
 		matcher.find();
--- a/src/alice/test/topology/aquarium/RefreshWindow.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/RefreshWindow.java	Wed Mar 27 17:30:52 2013 +0900
@@ -17,7 +17,7 @@
 		
 		frame.getJFrame().dispose();
 		ObjectList list = frame.getList();
-		frame = new MakeFrame(this.host.asString(),host.asInteger());
+		frame = new MakeFrame(this.host.data.asString(this.host),host.data.asInteger(host));
 		for (MakeObject obj : list.table) {
 			this.frame.register(obj);
 		}
--- a/src/alice/test/topology/aquarium/SendLocation.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/SendLocation.java	Wed Mar 27 17:30:52 2013 +0900
@@ -21,7 +21,7 @@
 	
 	@Override
 	public void run() {
-		FishPoint fp = this.position.asClass(FishPoint.class);
+		FishPoint fp = this.position.data.asClass(this.position, FishPoint.class);
 		fp.setXYZ(fp.getX()+x, fp.getY()+y, fp.getZ()+z);
 		ods.update("local", "fish", fp);
 		
--- a/src/alice/test/topology/aquarium/SendMaxsize.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/SendMaxsize.java	Wed Mar 27 17:30:52 2013 +0900
@@ -14,9 +14,9 @@
 	
 	@Override
 	public void run() {
-		int size = max.asInteger();
+		int size = max.data.asInteger(max);
 		ods.update("local","maxsize",size);
-		new SendMaxsize(this.max.index);
+		new SendMaxsize(this.max.data.index);
 	}
 
 }
--- a/src/alice/test/topology/aquarium/SetLocation.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/SetLocation.java	Wed Mar 27 17:30:52 2013 +0900
@@ -19,9 +19,9 @@
 	
 	@Override
 	public void run(){
-		FishPoint fp = this.position.asClass(FishPoint.class);
+		FishPoint fp = this.position.data.asClass(this.position, FishPoint.class);
 		obj.setLocation(fp.getX(), fp.getY(), fp.getZ());
-		new SetLocation(obj, position.key, position.index, range);
+		new SetLocation(obj, position.data.key, position.data.index, range);
 					
 	}
 	
--- a/src/alice/test/topology/aquarium/TakeMynum.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/TakeMynum.java	Wed Mar 27 17:30:52 2013 +0900
@@ -20,7 +20,7 @@
 	public void run() {
 		new TakePnum(this.mynum);
 		ods.put("local", "num", 0);
-		new TakeMynum(this.mynum.index+1);
+		new TakeMynum(this.mynum.data.index+1);
 	}
 
 }
--- a/src/alice/test/topology/aquarium/TakePnum.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/aquarium/TakePnum.java	Wed Mar 27 17:30:52 2013 +0900
@@ -18,7 +18,7 @@
 	@Override
 	public void run() {
 		ods.update("parent", "num", 
-				this.pnum.asInteger()+this.mynum.asInteger());
+				this.pnum.data.asInteger(this.pnum)+this.mynum.data.asInteger(this.mynum));
 	}
 
 }
--- a/src/alice/test/topology/fish/AsignStartX.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/fish/AsignStartX.java	Wed Mar 27 17:30:52 2013 +0900
@@ -19,12 +19,12 @@
 	public void run() {
 		System.out.println("AsignStartX: " + startX);
 		
-		RoutingTable routing = this.routing.asClass(RoutingTable.class);
+		RoutingTable routing = this.routing.data.asClass(this.routing, RoutingTable.class);
 		int x = startX;
-		System.out.println("RoutingTable: " + this.routing.val);
-		if (this.index >= this.routing.index) {
+		System.out.println("RoutingTable: " + this.routing.data.val);
+		if (this.index >= this.routing.data.index) {
 			AsignStartX cs = new AsignStartX(startX, index);
-			cs.routing.setKey("local", "routing", this.routing.index);
+			cs.routing.setKey("local", "routing", this.routing.data.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.index);
+		PeekStartX cs = new PeekStartX(this.routing.data.index);
 		cs.startX.setKey("local", "startX", this.index);
 	}
 
--- a/src/alice/test/topology/fish/CheckMyName.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/fish/CheckMyName.java	Wed Mar 27 17:30:52 2013 +0900
@@ -17,7 +17,7 @@
 	
 	@Override
 	public void run() {
-		String name = host.asString();
+		String name = host.data.asString(host);
 		Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
 		Matcher matcher = pattern.matcher(name);
 		
--- a/src/alice/test/topology/fish/GetStartX.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/fish/GetStartX.java	Wed Mar 27 17:30:52 2013 +0900
@@ -10,12 +10,12 @@
 	
 	@Override
 	public void run() {
-		int startX = this.startX.asInteger();
+		int startX = this.startX.data.asInteger(this.startX);
 		
 		System.out.println("GetStartX: " + startX);
 		
 		GetStartX cs = new GetStartX();
-		cs.startX.setKey("local", "startX", this.startX.index);
+		cs.startX.setKey("local", "startX", this.startX.data.index);
 	}
 
 }
--- a/src/alice/test/topology/fish/PeekStartX.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/fish/PeekStartX.java	Wed Mar 27 17:30:52 2013 +0900
@@ -15,9 +15,9 @@
 	
 	@Override
 	public void run() {
-		int startX = this.startX.asInteger();
-		AsignStartX cs = new AsignStartX(startX, this.startX.index);
-		cs.routing.setKey("local", "routing", this.startX.index);
+		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);
 	}
 
 }
--- a/src/alice/test/topology/fish/SendWidth.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/fish/SendWidth.java	Wed Mar 27 17:30:52 2013 +0900
@@ -10,13 +10,13 @@
 
 	@Override
 	public void run() {
-		int width = this.width.asInteger();
+		int width = this.width.data.asInteger(this.width);
 		ods.put("parent", "widths", width);
 		
 		System.out.println("send widths: " + width);
 		
 		SendWidth cs = new SendWidth();
-		cs.width.setKey("local", "width", this.width.index);
+		cs.width.setKey("local", "width", this.width.data.index);
 	}
 
 }
--- a/src/alice/test/topology/fish/StartStartX.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/fish/StartStartX.java	Wed Mar 27 17:30:52 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.index);
+		cs.width.setKey("local", "width", this.width.data.index);
 	}
 
 }
--- a/src/alice/test/topology/fish/WidthReceiver.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/fish/WidthReceiver.java	Wed Mar 27 17:30:52 2013 +0900
@@ -14,9 +14,9 @@
 	
 	@Override
 	public void run() {
-		int width = this.widths.asInteger();
-		String from = this.widths.from;
-		RoutingTable routing = this.routing.asClass(RoutingTable.class);
+		int width = this.widths.data.asInteger(this.widths);
+		String from = this.widths.data.from;
+		RoutingTable routing = this.routing.data.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.index);
+		cs.widths.setKey("local", "widths", this.widths.data.index);
 		cs.routing.setKey("local", "routing");
 		//cs.routing.setKey("local", "routing", this.routing.index);
 	}
--- a/src/alice/test/topology/ring/CheckMyName.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/ring/CheckMyName.java	Wed Mar 27 17:30:52 2013 +0900
@@ -19,7 +19,7 @@
 	
 	@Override
 	public void run() {
-		String host = this.ds1.asString();
+		String host = this.ds1.data.asString(this.ds1);
 		logger.debug(host);
 		if (host.equals("node0")) {
 			ods.put("local", "c", new byte[conf.size]);
--- a/src/alice/test/topology/ring/FirstRingMessagePassing.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/ring/FirstRingMessagePassing.java	Wed Mar 27 17:30:52 2013 +0900
@@ -27,8 +27,8 @@
 	
 	@Override
 	public void run() {
-		ods.put("right", "c", ds1.val); // copy whole DataSegment to the right
-		if (ds1.index > count) {        // after count time update of ds1
+		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", "finish", ValueFactory.createNilValue());
 			long endTime = System.nanoTime();
 			long time = endTime - startTime;
--- a/src/alice/test/topology/ring/RingMessagePassing.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/ring/RingMessagePassing.java	Wed Mar 27 17:30:52 2013 +0900
@@ -10,7 +10,7 @@
 
 	@Override
 	public void run() {
-		ods.put("right", "c", this.ds1.val);
+		ods.put("right", "c", this.ds1.data.val);
 		RingMessagePassing cs = new RingMessagePassing();
 		cs.ds1.setKey("c");
 	}
--- a/src/alice/test/topology/share/AutoIncrement.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/share/AutoIncrement.java	Wed Mar 27 17:30:52 2013 +0900
@@ -24,7 +24,7 @@
 			}
 		}
 		ods.update("local", key, new DataInfo(System.nanoTime()));
-		new AutoIncrement(this.key ,this.position.index);
+		new AutoIncrement(this.key ,this.position.data.index);
 	}
 	
 }
--- a/src/alice/test/topology/share/CheckLocalIndex.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/share/CheckLocalIndex.java	Wed Mar 27 17:30:52 2013 +0900
@@ -22,21 +22,21 @@
 	
 	@Override
 	public void run() {
-		RoutingTable rt = this.list.asClass(RoutingTable.class);
+		RoutingTable rt = this.list.data.asClass(this.list, RoutingTable.class);
 		int count = 0;
 		boolean flag = false;
 		for (Routing r : rt.table) {
 			if (r.name.equals("parent"))flag=true;
-			if (!r.name.equals(this.data.from)){
-				ods.update(r.name, this.key, this.data.val);
+			if (!r.name.equals(this.data.data.from)){
+				ods.update(r.name, this.key, this.data.data.val);
 				count++;
 			}
 			
 		}
 		if (count==0&&flag){
-			ods.put("parent", "data", this.data.val);
+			ods.put("parent", "data", this.data.data.val);
 		}
-		new CheckLocalIndex(this.key, this.data.index);
+		new CheckLocalIndex(this.key, this.data.data.index);
 		
 	}
 
--- a/src/alice/test/topology/share/CheckMyName.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/share/CheckMyName.java	Wed Mar 27 17:30:52 2013 +0900
@@ -23,7 +23,7 @@
 	@Override
 	public void run(){
 		
-		String name = host.asString();
+		String name = host.data.asString(host);
 		Matcher matcher = pattern.matcher(name);
 		
 		matcher.find();
--- a/src/alice/test/topology/share/LookUpData.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/test/topology/share/LookUpData.java	Wed Mar 27 17:30:52 2013 +0900
@@ -23,8 +23,8 @@
 
 	@Override
 	public void run(){
-		new LookUpData(this.key,this.data.index);
-		DataInfo di = data.asClass(DataInfo.class);
+		new LookUpData(this.key,this.data.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 16:39:51 2013 +0900
+++ b/src/alice/test/topology/share/SendData.java	Wed Mar 27 17:30:52 2013 +0900
@@ -13,8 +13,8 @@
 	
 	@Override
 	public void run(){
-		new SendData(this.data.index);
-		ods.put("parent", "data", this.data.val);
+		new SendData(this.data.data.index);
+		ods.put("parent", "data", this.data.data.val);
 	}
 	
 }
\ No newline at end of file
--- a/src/alice/topology/manager/IncomingHosts.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/topology/manager/IncomingHosts.java	Wed Mar 27 17:30:52 2013 +0900
@@ -24,7 +24,7 @@
 
 	@Override
 	public void run() {
-		HostMessage host = this.host.asClass(HostMessage.class);
+		HostMessage host = this.host.data.asClass(this.host, HostMessage.class);
 		String nodeName = nodeNames.poll();
 		// Manager connect to Node
 		DataSegment.connect(nodeName, "", host.name, host.port);
--- a/src/alice/topology/node/ConfigurationFinish.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/topology/node/ConfigurationFinish.java	Wed Mar 27 17:30:52 2013 +0900
@@ -18,7 +18,7 @@
 	
 	@Override
 	public void run() {
-		if (reverseCount.val.equals(configNodeNum.val)) {
+		if (reverseCount.data.val.equals(configNodeNum.data.val)) {
 			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.index);
+		cs3.reverseCount.setKey("local", "reverseCount", this.reverseCount.data.index);
 		cs3.configNodeNum.setKey("local", "configNodeNum");
 	}
 
--- a/src/alice/topology/node/IncomingAbstractHostName.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/topology/node/IncomingAbstractHostName.java	Wed Mar 27 17:30:52 2013 +0900
@@ -14,7 +14,7 @@
 
 	@Override
 	public void run() {
-		String absName = this.absName.asString();
+		String absName = this.absName.data.asString(this.absName);
 		IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, 0);
 		cs.hostInfo.setKey("manager", absName);
 	}
--- a/src/alice/topology/node/IncomingConnectionInfo.java	Wed Mar 27 16:39:51 2013 +0900
+++ b/src/alice/topology/node/IncomingConnectionInfo.java	Wed Mar 27 17:30:52 2013 +0900
@@ -19,12 +19,12 @@
 
 	@Override
 	public void run() {
-		if (this.hostInfo.val == null) {
+		if (this.hostInfo.data.val == null) {
 			ods.put("local", "configNodeNum", count);
 			return;
 		}
 		
-		HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
+		HostMessage hostInfo = this.hostInfo.data.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 16:39:51 2013 +0900
+++ b/src/alice/topology/node/IncomingReverseKey.java	Wed Mar 27 17:30:52 2013 +0900
@@ -12,11 +12,11 @@
 	
 	@Override
 	public void run() {
-		String reverseKey = this.reverseKey.val.asRawValue().getString();
-		String from = this.reverseKey.from;
+		String reverseKey = this.reverseKey.data.val.asRawValue().getString();
+		String from = this.reverseKey.data.from;
 		DataSegment.getAccept(from).reverseKey = reverseKey;
 		
-		int reverseCount = this.reverseCount.asInteger();
+		int reverseCount = this.reverseCount.data.asInteger(this.reverseCount);
 		reverseCount++;
 		ods.update("local", "reverseCount", reverseCount);