/** * Puts a long into the payload of this node. * * @param offset The offset into the payload, in longs. * @param l The value to put into the payload. */ public void putPayloadLong(int offset, long l) { assert dirty; assert offset > 0; block.putLong(IDX_PAYLOAD + offset, l); }
/** * Writes the details of the current phase into a block. * * @param b The block to put the details into. * @param offset The distance of the logical phase block from the beginning * of <i>b</i>. */ public void writeToBlock(Block b, int offset) { b.putLong(offset + IDX_HEAD, head); b.putLong(offset + IDX_TAIL, tail); b.putLong(offset + IDX_NEXT_ITEM, nextItem); b.putLong(offset + IDX_NR_VALID_ITEMS, nrValidItems); }
/** * Writes this PersistableMetaRoot to the specified Block. The ints are * written at the specified offset. * * @param b the Block. * @param offset the offset into the Block to start writing. */ public void writeToBlock(Block b, int offset) { check(); b.putLong(offset + IDX_ROOT_ID, rootId); b.putLong(offset + IDX_NR_NODES, nrNodes); avlBlockFilePhase.writeToBlock(b, offset + HEADER_SIZE); }
/** * Initialises a node on the given information. * * @param phase The phase that the node exists in. * @param objectPool The pool that the node will return to. * @throws IOException If an I/O error occurs. */ private void init( AVLFile.Phase phase, ObjectPool objectPool ) throws IOException { assert this.objectPool == null; this.phase = phase; parentNode = null; childIndex = 0; this.leftChildNode = null; this.rightChildNode = null; this.objectPool = objectPool; //X trace = new Throwable(); refCount = 1; writable = true; dirty = true; block = phase.getAVLBlockFilePhase().allocateBlock(objectPool); block.putLong(IDX_LEFT, NULL_NODE); block.putLong(IDX_RIGHT, NULL_NODE); block.putByte(IDX_BALANCE_B, (byte) 0); }
block.putLong(ci, newNode.getId()); rebalanceInsert(ci); phase.incNrNodes();
if (parentNode != null) { parentNode.modify(); parentNode.block.putLong(childIndex, newId); } else { phase.setRootId(newId);
node.block.putLong(childIndex, NULL_NODE); node.rebalanceRemove(childIndex); node.release(); adjacentNode.rightChildNode = null; adjacentNode.childIndex = childIndex; adjacentNode.block.putLong(IDX_LEFT, block.getLong(IDX_LEFT)); adjacentNode.block.putLong(IDX_RIGHT, block.getLong(IDX_RIGHT)); adjacentNode.block.putByte(IDX_BALANCE_B, block.getByte(IDX_BALANCE_B)); parentNode.block.putLong(childIndex, adjacentNode.getId()); adjacentParent.block.putLong( adjacentParentChildIndex, adjacentNodeChildId ); } else { adjacentNode.modify(); adjacentNode.block.putLong( adjacentParentChildIndex, adjacentNodeChildId );
headBlock.putLong(offset, item); headBlockDirty = true;
reallocateBlock.putLong(getBlockOffset(reallocate), tItem); reallocateBlockDirty = true;