Le 19/10/15 20:58, Stefan Seelmann a écrit : > On 10/19/2015 11:57 AM, Emmanuel Lécharny wrote: >> OTOH, using the before(K)/after(K), it's easier : >> >> getting the previous key >> ------------------------ >> >> tuple = before(K); >> >> getting the next key >> -------------------- >> >> tuple = after(K); >> >> No test, not need to remember if the seek(K) method set the position >> before or after K. >> >> >> Is that extravagant, or just spurious ? I mean, we can live with >> seek(K), it does the job, I just wonder if the additional methods don't >> mke the developer lifer easier. >> >> wdyt ? >> > I like the before/after approach, we already have it in other places > like the Cursor interface.
At a second thought, we don't have to expose those methods in the cursor. Howard advice is sane, and if you look at the Mavibot 1.0.0-M8 code, we don't have such methods in the cursor, and for one good reason : it would force the Cursor to know about the Key, and thus the associated comparator, which is not necessarily a good idea. In Mavibot 1.0.0-M8, we implemented those methods at the B-tree level. The Cursor is used to simply move forward and backward, regardless of the B-tree it is iterating on.
