# HG changeset patch # User sugi # Date 1364204941 -32400 # Node ID c6a99216707a89bdc0a166e92986968c6ccdfca2 # Parent 020c47355fd1206782dabcde8ca4e723aab8f42d add flip API diff -r 020c47355fd1 -r c6a99216707a src/alice/codesegment/OutputDataSegment.java --- a/src/alice/codesegment/OutputDataSegment.java Mon Mar 25 17:46:50 2013 +0900 +++ b/src/alice/codesegment/OutputDataSegment.java Mon Mar 25 18:49:01 2013 +0900 @@ -13,16 +13,16 @@ /** * for local */ - public void put(String key, T val,Boolean flag) { - if (flag){ + public void put(String key, T val,Boolean covertFlag) { + if (covertFlag){ put(key, val); } else { DataSegment.getLocal().put(key, val); } } - public void update(String key, T val,Boolean flag) { - if (flag){ + public void update(String key, T val,Boolean covertFlag) { + if (covertFlag){ update(key, val); } else { DataSegment.getLocal().update(key, val); diff -r 020c47355fd1 -r c6a99216707a src/alice/datasegment/Receiver.java --- a/src/alice/datasegment/Receiver.java Mon Mar 25 17:46:50 2013 +0900 +++ b/src/alice/datasegment/Receiver.java Mon Mar 25 18:49:01 2013 +0900 @@ -4,6 +4,7 @@ import org.msgpack.type.ArrayValue; import org.msgpack.type.Value; +import org.msgpack.type.ValueFactory; import org.msgpack.type.ValueType; import alice.codesegment.InputDataSegment; @@ -31,8 +32,28 @@ ids.regist(); } - public void flip(CommandType type, String key, Object obj){ - ids.flip(type, key, null, obj); + public void flip(CommandType type, String key, int val){ + ids.flip(type, key, ValueFactory.createIntegerValue(val), null); + } + + public void flip(CommandType type, String key, String val){ + ids.flip(type, key, ValueFactory.createRawValue(val), null); + } + + public void flip(CommandType type, String key, byte[] val){ + ids.flip(type, key, ValueFactory.createRawValue(val, true), null); + } + + public void flip(CommandType type, String key, T val, Boolean covertFlag){ + if (covertFlag){ + try { + ids.flip(type, key, SingletonMessage.getInstance().unconvert(val), null); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + ids.flip(type, key, null, val); + } } public void flip(CommandType type, String key, Value val){