Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }