changeset 250:38154e695025

Refactor
author sugi
date Tue, 11 Jun 2013 16:58:35 +0900
parents 2a8bcf09bd06
children 88be2824a989
files src/alice/datasegment/Command.java
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/datasegment/Command.java	Tue Jun 11 16:53:22 2013 +0900
+++ b/src/alice/datasegment/Command.java	Tue Jun 11 16:58:35 2013 +0900
@@ -1,9 +1,12 @@
 package alice.datasegment;
 
+import java.io.IOException;
 import java.util.concurrent.BlockingQueue;
 import org.msgpack.type.Value;
 
 import alice.codesegment.CodeSegment;
+import alice.codesegment.SingletonMessage;
+import alice.daemon.CommandMessage;
 
 public class Command {
 	public CommandType type;
@@ -60,5 +63,15 @@
 		}
 		return this.type + "\t" + key + "\t" + val + "\tindex=" + index + "\tcs=" + csName;
 	}
+	public CommandMessage convert() {
+		if (val==null&&obj!=null){
+			try {
+				this.val = SingletonMessage.getInstance().unconvert(obj);
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return new CommandMessage(type.id, index, seq, key, val);
+	}
 	
 }