[jsword-devel] Verse.compareTo

DM Smith dmsmith at crosswire.org
Mon Feb 10 19:57:23 MST 2014


What should the semantic be?

Given a and b, the following has to be true:
a < b or a > b or a = b
such that the opposite is true
b > a or b < a or b = a

It was pretty straightforward when the compared Verses were in the KJV.

Right now, it merely compares the ordinal value of the verse within its versification.

I'm thinking that it should be an error to compare two verses not in the same v11n.

or maybe we start with the ordering of versifications by name and then by the ordinal within the v11n.

The other issue is that it currently allows b to be a VerseRange (comparing the start), but not a Passage.

And finally, Verse.equals(Object) is not transitive for all inputs.

Verse.equals allows Object to be a Passage, but not a VerseRange. The Passage has to be a single verse.

However, Passage.equals would need to reciprocate.

I started to make Verse.equals and Verse.compareTo both handle Passage and VerseRange.

What got me started on this was changing a.equals(b) to b.equals(a) and getting different results when a was a Verse and b was a Passage.

In His Service,
	DM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4145 bytes
Desc: not available
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140210/fc93842d/attachment.p7s>


More information about the jsword-devel mailing list