# HG changeset patch # User sugi # Date 1370937515 -32400 # Node ID 38154e695025aa544fcd6bcca0a678022f80f741 # Parent 2a8bcf09bd06ca6b579d97469cc70ca5dea11dc0 Refactor diff -r 2a8bcf09bd06 -r 38154e695025 src/alice/datasegment/Command.java --- 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); + } }