Mercurial > hg > Database > Alice
view src/main/java/alice/datasegment/Receiver.java @ 650:4289b232b3fd
nulValue
author | suruga |
---|---|
date | Fri, 02 Feb 2018 18:26:49 +0900 |
parents | 33f300d0720a |
children | 058bff2123c8 |
line wrap: on
line source
package alice.datasegment; import alice.codesegment.InputDataSegment; import javassist.compiler.ast.ASTree; /** * idsコマンド(create, setKey)の処理をする。コマンドの定義はids/LDSM内にある。 * MessagePack implementation and DataSegment Receiver * @author kazz * */ public class Receiver { private ReceiveData data; public InputDataSegment ids; public int index; public String from; public CommandType type; public String managerKey;//DSMを一意に特定。localかremoteか、どのremoteからか。 public String key; public boolean compressedFlag = false; public Receiver(InputDataSegment ids, CommandType type) { this.ids = ids; this.type = type; ids.register(); } public Receiver(InputDataSegment ids, CommandType type, boolean compressedFlag) { this.ids = ids; this.type = type; ids.register(); this.compressedFlag = compressedFlag; } public void setQuickKey(String managerKey, String key){ setQuickKey(managerKey, key, 0); }//? public void setQuickKey(String managerKey, String key, int index) { this.managerKey = managerKey; this.key = key; switch (type) { case PEEK: ids.quickPeek(this); break; case TAKE: ids.quickTake(this); break; default: break; } ids.setKey(); } public void setKey(String managerKey, String key) { setKey(managerKey, key, 0); } public void setKey(String managerKey, String key, int index) { this.managerKey = managerKey; this.key = key; this.index = index; switch (type) { case PEEK: ids.peek(this); break; case TAKE: ids.take(this); break; default: break; } ids.setKey(); } public void setKey(String key) { setKey(key, 0); } public void setKey(String key, int index) { this.key = key; this.index = index; switch (type) { case PEEK: ids.peek(this); break; case TAKE: ids.take(this); break; default: break; } ids.setKey(); } //以下各型でDS本体を受け取る public void setData(ReceiveData 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(); } public ReceiveData getReceiveData() { return data; } public boolean isCompressed(){ return data.compressed(); } }