(final int pre, final byte[] value, final int kind)
| 323 | } |
| 324 | |
| 325 | @Override |
| 326 | protected void updateText(final int pre, final byte[] value, final int kind) { |
| 327 | // delete existing index entry |
| 328 | indexDelete(pre, -1, 1); |
| 329 | |
| 330 | // reference to heap file |
| 331 | final DataAccess store = kind == ATTR ? values : texts; |
| 332 | // old entry (offset or value) |
| 333 | final long oldRef = textRef(pre); |
| 334 | |
| 335 | // check if new entry can be inlined |
| 336 | final long v = Inline.packInt(value); |
| 337 | if(v != -1) { |
| 338 | // invalidate old entry if it was not inlined |
| 339 | if(!Inline.inlined(oldRef)) store.free(oldRef & Compress.COMPRESS - 1, 0); |
| 340 | // inline integer value |
| 341 | textRef(pre, v); |
| 342 | } else { |
| 343 | // otherwise, try to compress new value |
| 344 | final byte[] val = Compress.pack(value); |
| 345 | |
| 346 | // choose inserting position |
| 347 | final long off; |
| 348 | if(Inline.inlined(oldRef)) { |
| 349 | // old entry was inlined: append new entry to heap file |
| 350 | off = store.length(); |
| 351 | } else { |
| 352 | // otherwise, compute inserting position and invalidate old entry |
| 353 | final int vl = val.length; |
| 354 | off = store.free(oldRef & Compress.COMPRESS - 1, vl + Num.length(vl)); |
| 355 | } |
| 356 | |
| 357 | store.writeToken(off, val); |
| 358 | textRef(pre, val == value ? off : off | Compress.COMPRESS); |
| 359 | } |
| 360 | |
| 361 | // insert new entries |
| 362 | indexAdd(pre, -1, 1, null); |
| 363 | } |
| 364 | |
| 365 | @Override |
| 366 | protected long textRef(final byte[] value, final boolean text) { |
nothing calls this directly
no test coverage detected