[jsword-devel] Bookset
Martin Denham
mjdenham at gmail.com
Sat Jan 25 16:23:46 MST 2014
And Bible tends to get lists of books and then store the relevant Book
object. I can't find anywhere that it asks for a book by name but it does
use initials sometimes.
I recall there was a problem a few months ago in which KJVA had the same
name as KJV but different initials and use of the name as the id, instead
of the initials, caused problems - a fix had to be implemented then.
There were some similar cases of same name/different initials in the IBT
repo.
AB should be fine/faster if JSword matches by initials first rather than
name - if that is what you are intending.
I am hoping to settle on a stable build of JSword soon to prepare for an AB
release. When do you think would be a good time. It would be good to get
it labelled too. The only outstanding issue is with 'zerosUnmapped' but I
could just remove that line from the properties files for AB if a fix is
not easy. Currently I just catch the exception and force the verse to the
required v11n.
Martin
Martin
On 25 January 2014 21:41, Chris Burrell <chris at burrell.me.uk> wrote:
> Hi
>
> I'm looking to refactor Books.installed().getBook(name) because it takes
> too long when you need to look up books multiple times (and don't have an
> easy way of caching the JSword lookup). It's particular slow when you have
> 200+ resources (our server will have). This will also be more prevalent in
> Android where method calls are quite expensive.
>
> In STEP we always have the initials of the module (the user selects by
> name/initials/STEP name in the browser, where it always gets translated to
> initials well before it hits JSword). Do any other frontends use the
> getBook(name) by name?
>
> I want to at least provide way of getting the book directly from its
> initials. As part of this, we can several things:
>
> In Books:
> - refactor the getBook() method to not search first against the name, then
> against name insensitive and then against the initials in the BMD, and then
> against the initials directly
> - If the above is not possible then at least provide a getBookByInitials
> (which would just look up the initials against their lower case value.
>
> In BookSet:
> - I can't work out why we're sorting the inserts in add(). They cause
> unecessary copies of the ArrayList contents in the creation of it.
> - I can't work out why it also implements Set. Especially, since contains
> would be a good candidate for using
>
>
> So there are two options really:
> - change BookSet to be based on a Map. getBooksByInitials would use the
> map directly. getBook would iterate through the contents (or key the
> contents in a separate map for faster access)
> - Add a map to BookSet to cache the lookups
>
> My preference would be to replace the BookSet implementation altogether.
> But the easy option would be to have a Map lookup. Do we use any of the
> Set<> methods? Would it make sense to replace BookSet with a LinkedHashMap?
>
>
> Chris
>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140125/a47443d7/attachment.html>
More information about the jsword-devel
mailing list