DIRECTORY AlpineEnvironment, FilePageMgrPrivateChunk, FilePageMgrPrivateFile, FilePageMgrRedBlackTree, RedBlackTree ; FilePageMgrRedBlackTreeImpl: CEDAR PROGRAM IMPORTS RedBlackTree EXPORTS FilePageMgrRedBlackTree = BEGIN OPEN FpmPC: FilePageMgrPrivateChunk, FpmPF: FilePageMgrPrivateFile; FPMFileHandle: TYPE = REF FPMFileObject; FPMFileObject: TYPE = FpmPF.FPMFileObject; RefChunk: TYPE = REF Chunk; Chunk: TYPE = FpmPC.Chunk; LookupProc: TYPE = FilePageMgrRedBlackTree.LookupProc; Lookup: PUBLIC LookupProc = { fpmFileHandle.rbKeyRef^ _ key; RETURN[ NARROW[RedBlackTree.Lookup[ fpmFileHandle.chunkTable, fpmFileHandle.rbKeyRef]] ]; }; LookupNextLarger: PUBLIC LookupProc = { fpmFileHandle.rbKeyRef^ _ key; RETURN[ NARROW[RedBlackTree.LookupNextLarger[ fpmFileHandle.chunkTable, fpmFileHandle.rbKeyRef]] ]; }; LookupNextSmaller: PUBLIC LookupProc = { fpmFileHandle.rbKeyRef^ _ key; RETURN[ NARROW[RedBlackTree.LookupNextSmaller[ fpmFileHandle.chunkTable, fpmFileHandle.rbKeyRef]] ]; }; LookupLargest: PUBLIC PROCEDURE[ fpmFileHandle: FPMFileHandle ] RETURNS [RefChunk] = { RETURN[ NARROW[RedBlackTree.LookupLargest[ fpmFileHandle.chunkTable]] ]; }; LookupSmallest: PUBLIC PROCEDURE[ fpmFileHandle: FPMFileHandle ] RETURNS [RefChunk] = { RETURN[ NARROW[RedBlackTree.LookupSmallest[ fpmFileHandle.chunkTable ]] ]; }; Delete: PUBLIC PROCEDURE[ fpmFileHandle: FPMFileHandle, key: AlpineEnvironment.PageNumber ] RETURNS [RefChunk] = { n: RedBlackTree.Node; fpmFileHandle.rbKeyRef^ _ key; n _ RedBlackTree.Delete[ fpmFileHandle.chunkTable, fpmFileHandle.rbKeyRef]; RETURN[ IF n=NIL THEN NIL ELSE NARROW[n.data] ]; }; Insert: PUBLIC PROCEDURE[ fpmFileHandle: FPMFileHandle, refChunk: RefChunk, key: AlpineEnvironment.PageNumber ] = { fpmFileHandle.rbKeyRef^ _ key; RedBlackTree.Insert[ fpmFileHandle.chunkTable, refChunk, fpmFileHandle.rbKeyRef ]; }; END. bFilePageMgrRedBlackTreeImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Hauser, March 27, 1985 11:57:01 am PST A thin interface over RedBlackTree handling the coercions. Should be called only from FilePageMgrMainImpl with the lock in fpmFileHandle already held. This is split out only to overcome compile size restriction. Κ™˜™ Icodešœ Οmœ1™