Mercurial > hg > Database > Alice
changeset 204:c6a99216707a working
add flip API
author | sugi |
---|---|
date | Mon, 25 Mar 2013 18:49:01 +0900 |
parents | 020c47355fd1 |
children | 28469b1671e7 |
files | src/alice/codesegment/OutputDataSegment.java src/alice/datasegment/Receiver.java |
diffstat | 2 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 <T> void put(String key, T val,Boolean flag) { - if (flag){ + public <T> void put(String key, T val,Boolean covertFlag) { + if (covertFlag){ put(key, val); } else { DataSegment.getLocal().put(key, val); } } - public <T> void update(String key, T val,Boolean flag) { - if (flag){ + public <T> void update(String key, T val,Boolean covertFlag) { + if (covertFlag){ update(key, val); } else { DataSegment.getLocal().update(key, val);
--- 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 <T> 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){