Closed jto closed 3 years ago
Er... I must admit my memory is a bit confused about what happened, but I believe those were stub methods that had to be tested and completed; indeed, the unit test never exercise them, and they are entirely undocumented.
Somehow I forgot about them: I'll have a look and get back to you.
Hi @vigna, Thank you for your quick reply (and for this library ofc)!
That explains it then :) In case anyone runs into the same issue, iterator(key).previous()
can be used as a workaround to achieved the same result. I did not look into the performance though.
OK, in the end it was just a sign (pred() was using the same sign test of succ(), while it should have been reversed).
I have implemented the correct behavior and added tests. Now there is also full documentation. I modified the method names (it's better anyway to have a compile error if anybody was using them): you can use the theory-style successor(), strictSuccessor(), etc., methods or the NavigableSet-style ceiling(), floor(), etc. methods (but NavigableSet is not yet implemented).
Please let me know if this works for you!
Sounds great thank you 👍 Closing the issue :)
BTW, I just realized ZFastTrie won't work with negative integers. That's just because the fixedLong() strategy is missing a flip of the first bit to be truly lexicographical. I'll fix this ASAP in the DSI Utilities.
A final note: we have C implementations for strings and 64-bit integers in case you're interested. They're much faster as bit rolling is not one of Java's strengths...
Hey @vigna. Thanks for the heads up! For now I'm just fiddling with Sux4j and the performance have been good enough. The C implementation might come handy if I need to scale things up a little :)
Here are a couple of examples using
ZFastTrie.pred
andZFastTrie.succ
onStrings
andLong
. In both casessucc
seems to have the expected behavior butpred
results are unexpected.Am I doing something wrong ? I'm using version
5.2.3
Example is a Scala worksheet but I believe the code is easy enough to understand. The comment below each line is the returned value.