public override void Replace(IPersistentStore store, Index index, NodeAVL n) { NodeAVLDisk node = this; RowAVLDisk row = this.row; if (!row.KeepInMemory(true)) { row = (RowAVLDisk)store.Get(this.row, true); node = (NodeAVLDisk)row.GetNode(this._iId); } if (node._iParent == -1) { if (n != null) { n = n.SetParent(store, null); } store.SetAccessor(index, n); } else { bool isLeft = node.IsFromLeft(store); node.GetParent(store).Set(store, isLeft, n); } row.KeepInMemory(false); }
public override NodeAVL SetParent(IPersistentStore store, NodeAVL n) { NodeAVLDisk node = this; RowAVLDisk row = this.row; if (!row.KeepInMemory(true)) { row = (RowAVLDisk)store.Get(this.row, true); node = (NodeAVLDisk)row.GetNode(this._iId); } if (!row.IsInMemory()) { row.KeepInMemory(false); throw Error.RuntimeError(0xc9, "NodeAVLDisk"); } row.SetNodesChanged(); node._iParent = (n == null) ? -1 : n.GetPos(); if ((n != null) && !n.IsInMemory()) { n = this.FindNode(store, n.GetPos()); } node.nParent = n; row.KeepInMemory(false); return(node); }
public override bool IsRoot(IPersistentStore store) { NodeAVLDisk node = this; if (!this.row.IsInMemory()) { node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId); } return(node._iParent == -1); }
public override int GetBalance(IPersistentStore store) { NodeAVLDisk node = this; if (!this.row.IsInMemory()) { node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId); } return(node.IBalance); }
private NodeAVLDisk FindNode(IPersistentStore store, int pos) { NodeAVLDisk node = null; RowAVLDisk disk2 = (RowAVLDisk)store.Get(pos, false); if (disk2 != null) { node = (NodeAVLDisk)disk2.GetNode(this._iId); } return(node); }
public override bool IsFromLeft(IPersistentStore store) { NodeAVLDisk node = this; if (!this.row.IsInMemory()) { node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId); } if (node._iParent == -1) { return(true); } if ((node.nParent == null) || !node.nParent.IsInMemory()) { node.nParent = this.FindNode(store, this._iParent); } return(this.GetPos() == ((NodeAVLDisk)node.nParent)._iLeft); }
public override NodeAVL GetParent(IPersistentStore store) { NodeAVLDisk node = this; if (!this.row.IsInMemory()) { node = (NodeAVLDisk)((RowAVLDisk)store.Get(this.row, false)).GetNode(this._iId); } if (node._iParent == -1) { return(null); } if ((node.nParent == null) || !node.nParent.IsInMemory()) { node.nParent = this.FindNode(store, this._iParent); } return(node.nParent); }
public override NodeAVL SetBalance(IPersistentStore store, int b) { NodeAVLDisk node = this; RowAVLDisk row = this.row; if (!row.KeepInMemory(true)) { row = (RowAVLDisk)store.Get(this.row, true); node = (NodeAVLDisk)row.GetNode(this._iId); } if (!row.IsInMemory()) { throw Error.RuntimeError(0xc9, "NodeAVLDisk"); } row.SetNodesChanged(); node.IBalance = b; row.KeepInMemory(false); return(node); }