comparison rep/handler/Translator.java @ 439:5cbe1731f40c

fix checkAck in Editor.java
author one
date Sat, 11 Sep 2010 17:54:04 +0900
parents 146d91b61b36
children c50cee354f62
comparison
equal deleted inserted replaced
438:146d91b61b36 439:5cbe1731f40c
84 * @param editor 84 * @param editor
85 * @param output 85 * @param output
86 * @return if any sent commands output 86 * @return if any sent commands output
87 */ 87 */
88 public boolean optimizedSend(REPNode editor, LinkedList<REPCommand> output) { 88 public boolean optimizedSend(REPNode editor, LinkedList<REPCommand> output) {
89 sentMergedList.clear();
89 List<REPCommand> output1 = optimizer.optimize(output); 90 List<REPCommand> output1 = optimizer.optimize(output);
90 if (output1.size()==0) { 91 if (output1.size()==0) {
91 merge_mode = false; 92 merge_mode = false;
92 return false; 93 return false;
93 } 94 }
94 assert(sentMergedList.size()==0);
95 for(REPCommand c:output1) { 95 for(REPCommand c:output1) {
96 REPCommand m = new REPCommand(c); 96 REPCommand m = new REPCommand(c);
97 m.setEID(REP.MERGE_EID.id); 97 m.setEID(REP.MERGE_EID.id);
98 m.setSEQID(editor.seq()); 98 m.setSEQID(editor.seq());
99 sentMergedList.add(m); 99 sentMergedList.add(m);
126 return 0; 126 return 0;
127 } 127 }
128 } 128 }
129 129
130 /** 130 /**
131 * Translate Command cmd that was received from SeMa. 131 * Translate Command that was received from SeMa.
132 * @param cmd the command to be translated. 132 * @param cmd the command to be translated.
133 * @return translated commannd. 133 * @return translated command.
134 */ 134 */
135 public void transReceiveCmd(REPNode nextEditor,REPCommand cmd){ 135 public void transReceiveCmd(REPNode nextEditor,REPCommand cmd){
136 assert (cmd.eid != eid); 136 assert (cmd.eid != eid);
137 unMergedCmds.addFirst(cmd); 137 unMergedCmds.addFirst(cmd);
138 } 138 }