Mercurial > hg > Members > tatsuki > Alice
view src/alice/datasegment/Receiver.java @ 241:02783f3699b1
add word count
author | sugi |
---|---|
date | Tue, 16 Apr 2013 15:09:47 +0900 |
parents | bc061ee5f31f |
children | 32e7d5271477 |
line wrap: on
line source
package alice.datasegment; import alice.codesegment.InputDataSegment; /** * MessagePack implementation and DataSegment Receiver * @author kazz * */ public class Receiver { private ReceiverData data = new ReceiveRemoteData(); public InputDataSegment ids; public int index; public String from; public CommandType type; public String managerKey; public String key; public Receiver(InputDataSegment ids, CommandType type) { this.ids = ids; this.type = type; ids.regist(); } public void setKey(String managerKey, String key) { this.managerKey = managerKey; setKey(managerKey, key, 0); } public void setKey(String managerKey, String key, int index) { this.key = key; switch (type) { case PEEK: ids.peek(this, managerKey, key, index); break; case TAKE: ids.take(this, managerKey, key, index); break; default: break; } ids.setKey(); } public void setKey(String key) { setKey(key, 0); } public void setKey(String key, int index) { this.key = key; switch (type) { case PEEK: ids.peek(this, key, index); break; case TAKE: ids.take(this, key, index); break; default: break; } ids.setKey(); } public void setData(ReceiverData r) { data = r; } public int asInteger() { return data.asInteger(); } public String asString() { return data.asString(); } public <T> T asClass(Class<T> clazz) { return data.asClass(clazz); } public Object getObj() { return data.getObj(); } public Object getVal() { return data.getVal(); } }