Mercurial > hg > Database > Alice
changeset 188:38d6a10be9c6 working
add FLIP API in Receiver class
author | e095732 |
---|---|
date | Thu, 07 Mar 2013 12:30:03 +0900 |
parents | 95e09be8be69 |
children | d2f5c885a367 |
files | src/alice/datasegment/Receiver.java |
diffstat | 1 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/datasegment/Receiver.java Thu Mar 07 11:42:13 2013 +0900 +++ b/src/alice/datasegment/Receiver.java Thu Mar 07 12:30:03 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; @@ -30,6 +31,32 @@ ids.regist(); } + // for same key + + public void flip(Value val){ + DataSegment.getLocal().flip(this.key, val); + } + + public void flip(int val){ + DataSegment.getLocal().flip(this.key, ValueFactory.createIntegerValue(val)); + } + + public void flip(String val){ + DataSegment.getLocal().flip(this.key, ValueFactory.createRawValue(val)); + } + + public void flip(byte[] val){ + DataSegment.getLocal().flip(this.key, ValueFactory.createRawValue(val, true)); + } + + public <T> void flip(T val) { + try { + DataSegment.getLocal().flip(this.key, SingletonMessage.getInstance().unconvert(val)); + } catch (IOException e) { + e.printStackTrace(); + } + } + public void setKey(String managerKey, String key) { this.managerKey = managerKey; setKey(managerKey, key, 0);