Mercurial > hg > Database > Alice
changeset 453:8470db2523d5 dispose
remove no need file
author | sugi |
---|---|
date | Tue, 28 Oct 2014 17:25:30 +0900 |
parents | f68d103498e0 |
children | f8a8f869f016 |
files | src/main/java/alice/datasegment/ReceiveLocalData.java src/main/java/alice/datasegment/ReceiveRemoteData.java src/main/java/alice/datasegment/ReceiverData.java |
diffstat | 3 files changed, 0 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/datasegment/ReceiveLocalData.java Tue Oct 28 17:24:16 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -package alice.datasegment; - -import java.io.IOException; - -import org.msgpack.type.Value; - -import alice.codesegment.SingletonMessage; -import alice.datasegment.ReceiverData; - -public class ReceiveLocalData implements ReceiverData { - private Object obj; - - public ReceiveLocalData(Object obj) { - this.obj = obj; - } - - public String asString() { - return (String) obj; - } - - public int asInteger() { - return (Integer) obj; - } - - public Float asFloat() { - return (Float) obj; - } - - @SuppressWarnings("unchecked") - public <T> T asClass(Class<T> clazz) { - return (T) obj; - - } - - public Value getVal() { - try { - return SingletonMessage.getInstance().unconvert(obj); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - public Object getObj() { - return obj; - } - -}
--- a/src/main/java/alice/datasegment/ReceiveRemoteData.java Tue Oct 28 17:24:16 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -package alice.datasegment; - -import java.io.IOException; - -import org.msgpack.type.Value; -import alice.codesegment.SingletonMessage; - -public class ReceiveRemoteData implements ReceiverData { - public byte[] val; // serialized with MessagePack. need decode - - public ReceiveRemoteData() {} - - public ReceiveRemoteData(byte[] val) { - this.val = val; - } - - public String asString() { - return asClass(String.class); - } - - public int asInteger() { - Integer num = asClass(Integer.class); - return num!=null ? num : 0; - } - - public Float asFloat() { - Float num = asClass(Float.class); - return num!=null ? num : 0.0f; - } - - public <T> T asClass(Class<T> clazz) { - try { - return SingletonMessage.getInstance().read(val, clazz); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - - } - - public Value getVal() { - return asClass(Value.class); - } - - public Object getObj() { - return val; - } - -} \ No newline at end of file
--- a/src/main/java/alice/datasegment/ReceiverData.java Tue Oct 28 17:24:16 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -package alice.datasegment; - -import org.msgpack.type.Value; - -public interface ReceiverData { - - public String asString(); - public int asInteger(); - public Float asFloat() ; - public <T> T asClass(Class<T> clazz); - public Value getVal(); - public Object getObj(); - -} \ No newline at end of file