Copyright ©1995 by NeXT Computer, Inc. All Rights Reserved.
IXPostingOperations |
Adopted By: | IXPostingCursor IXPostingSet | |
Declared In: | btree/protocols.h |
Protocol Description |
The IXPostingOperations protocol defines methods for manipulating postings. See the IXPostingExchange protocol specification for a description of the term "posting."
The IXPostingOperations protocol requires the implementor to logically order its postings by handle, eliminating duplicates, and to maintain a cursor on this ordering which defines a current selection. This protocol defines methods for the selection of postings by position or by handle, and for iteration over the entire set of postings. |
Method Types |
Manipulating postings by handle |
addHandle:withWeight: |
removeHandle: |
Getting the number of postings | count | |
Emptying a posting set | empty | |
Traversing a posting set | setHandle: |
getHandle:andWeight: setFirstHandle setNextHandle |
Instance Methods |
addHandle:withWeight: |
addHandle:(unsigned int)aHandle withWeight:(unsigned int)aWeight |
Adds a posting consisting of aHandle and aWeight to the set. If aHandle is already present, assigns the posting a new weight by averaging aWeight and the existing weight. (Note: if aHandle is already present, IXPostingCursor overwrites the existing weight with aWeight). Returns self.
See also: removeHandle:, getHandle:andWeight: |
count |
(unsigned int)count |
Returns the number of postings in the set. |
empty |
empty |
Removes all postings from the set. Returns self.
See also: removeHandle: |
getHandle:andWeight: |
(unsigned int)getHandle:(unsigned int *)aHandle andWeight:(unsigned int *)aWeight |
Returns by reference the handle and weight of the selected posting. Explicitly returns the handle, or 0 if the current selection is undefined.
See also: setHandle: |
removeHandle: |
removeHandle:(unsigned int)aHandle |
If a posting with handle aHandle exists, removes that posting. Returns self.
See also: addHandle:withWeight:, getHandle:andWeight: |
setFirstHandle |
(unsigned int)setFirstHandle |
Selects the first posting, and returns that posting's handle, or 0 if the set is empty.
See also: setNextHandle, setHandle: |
setHandle: |
(unsigned int)setHandle:(unsigned int)aHandle |
Selects the posting with handle aHandle, and returns that posting's handle. If the value returned isn't aHandle, that posting wasn't found, and the next higher-numbered posting is selected.
Note: For both IXPostingSet and IXPostingCursor, this is an efficient operation, with a cost on the order of Olog2(n), where n is the number of postings. See also: getHandle:andWeight: |
setNextHandle |
(unsigned int)setNextHandle |
Selects the next posting. Returns the handle for that posting, or 0 if there are no more postings.
See also: setFirstHandle, setHandle: |