| 284 | } |
| 285 | |
| 286 | public void setLength(int v) { |
| 287 | if (v < 0) { |
| 288 | throw new IndexOutOfBoundsException(); |
| 289 | } |
| 290 | |
| 291 | if (v == 0) { |
| 292 | length = 0; |
| 293 | chain = null; |
| 294 | return; |
| 295 | } |
| 296 | |
| 297 | flush(); |
| 298 | |
| 299 | int index = length; |
| 300 | length = v; |
| 301 | for (Cell c = chain; c != null; c = c.next) { |
| 302 | int start = index - c.value.length(); |
| 303 | |
| 304 | if (v > start) { |
| 305 | if (v < index) { |
| 306 | c.value = c.value.substring(0, v - start); |
| 307 | } |
| 308 | break; |
| 309 | } |
| 310 | |
| 311 | chain = c.next; |
| 312 | index = start; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | public void getChars(int srcStart, int srcEnd, char[] dst, int dstStart) { |
| 317 | if (srcStart < 0 || srcEnd > length) { |