comparison src/main/java/alice/datasegment/Receiver.java @ 600:0564f38e9bfe dispose

change allow using ids only peek from Normal Code Segment
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Tue, 16 Feb 2016 19:12:52 +0900
parents 3284428f525e
children 30f2c04571c2
comparison
equal deleted inserted replaced
599:3284428f525e 600:0564f38e9bfe
15 public int index; 15 public int index;
16 public String from; 16 public String from;
17 public CommandType type; 17 public CommandType type;
18 public String managerKey;//DSMを一意に特定。localかremoteか、どのremoteからか。 18 public String managerKey;//DSMを一意に特定。localかremoteか、どのremoteからか。
19 public String key; 19 public String key;
20 public String meta = "";
20 public boolean compressedFlag = false; 21 public boolean compressedFlag = false;
21 22
22 public Receiver(InputDataSegment ids, CommandType type) { 23 public Receiver(InputDataSegment ids, CommandType type, String meta) {
23 this.ids = ids; 24 this.ids = ids;
24 this.type = type; 25 this.type = type;
26 this.meta = meta;
25 ids.register(); 27 ids.register();
26 } 28 }
27 29
28 public Receiver(InputDataSegment ids, CommandType type, boolean compressedFlag) { 30 public Receiver(InputDataSegment ids, CommandType type, boolean compressedFlag) {
29 this.ids = ids; 31 this.ids = ids;
58 60
59 public void setKey(String managerKey, String key, int index) { 61 public void setKey(String managerKey, String key, int index) {
60 this.managerKey = managerKey; 62 this.managerKey = managerKey;
61 this.key = key; 63 this.key = key;
62 this.index = index; 64 this.index = index;
63 switch (type) { 65
64 case PEEK: 66 if (meta == "" && managerKey == "metalocal"){
65 ids.peek(this); 67 ids.peek(this);
66 break; 68 } else{
67 case TAKE: 69 switch (type) {
68 ids.take(this); 70 case PEEK:
69 break; 71 ids.peek(this);
70 default: 72 break;
71 break; 73 case TAKE:
74 ids.take(this);
75
76 break;
77 default:
78 break;
79 }
72 } 80 }
81
73 ids.setKey(); 82 ids.setKey();
74 } 83 }
75 84
76 public void setKey(String key) { 85 public void setKey(String key) {
77 setKey(key, 0); 86 setKey(key, 0);
78 } 87 }
79 88
80 public void setKey(String key, int index) { 89 public void setKey(String key, int index) {
81 this.managerKey = "local"; 90
82 this.key = key; 91 this.key = key;
83 this.index = index; 92 this.index = index;
84 switch (type) { 93 switch (type) {
85 case PEEK: 94 case PEEK:
86 ids.peek(this); 95 ids.peek(this);