MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / getMIVector

Method getMIVector

src/main/java/History/HistoryLoader.java:168–253  ·  view source on GitHub ↗
(boolean forward)

Source from the content-addressed store, hash-verified

166 }
167
168 private Vector getMIVector(boolean forward) {
169 readBlock(forward);
170
171 Vector listMessages = new Vector();
172 int pos = 0;
173 first_m = last_m = -1;
174
175 do {
176 int start = findOpenStr(current_block, pos, true, 'm');
177 int end = findCloseStr(current_block, start + 3, true, 'm');
178
179 if (start < 0 || end < 0) {
180 if ((first_m < 0) || (last_m < 0)) {
181 boolean can_step_back = true;
182 boolean can_step_next = true;
183 if (forward)
184 can_step_back = !inBegin();
185 else can_step_next = !inEnd();
186
187 StringBuffer bigMessage = new StringBuffer();
188
189 do {
190 if (forward) {
191 bigMessage.append(getSubstr(start, current_block.length-start));
192 readBlock(forward);
193 end = findCloseStr(current_block, 0, true, 'm');
194 } else {
195 bigMessage.insert(0, getSubstr(0, end));
196 readBlock(forward);
197 start = findOpenStr(current_block, current_block.length-3, false, 'm');
198 }
199 first_m = 0;
200 last_m = current_block.length - 3;
201 } while (start < 0 || end < 0);
202
203 if (forward) {
204 bigMessage.append(getSubstr(start + 3, end - start - 3));
205 can_step_next = !inEnd();
206 } else {
207 bigMessage.insert(0, getSubstr(start + 3, end - start - 3));
208 can_step_back = !inBegin();
209 }
210
211 current_block = null;
212
213 String current = bigMessage.toString();
214 bigMessage = null;
215 listMessages.addElement(getMessageItem(processMessage(
216 findBlock(current, "t"),
217 findBlock(current, "d"),
218 findBlock(current, "f"),
219 findBlock(current, "s"),
220 findBlock(current, "b"))));
221
222 if (can_step_back)
223 listMessages.insertElementAt(HistoryReader.MIPrev, 0);
224 if (can_step_next)
225 listMessages.addElement(HistoryReader.MINext);

Callers 4

stepBeginMethod · 0.95
stepEndMethod · 0.95
stepBackMethod · 0.95
stepNextMethod · 0.95

Calls 13

readBlockMethod · 0.95
findOpenStrMethod · 0.95
findCloseStrMethod · 0.95
inBeginMethod · 0.95
inEndMethod · 0.95
getSubstrMethod · 0.95
getMessageItemMethod · 0.95
processMessageMethod · 0.95
findBlockMethod · 0.95
appendMethod · 0.80
addElementMethod · 0.80
insertMethod · 0.65

Tested by

no test coverage detected