On 05/13/2013 10:30 AM, Troy A. Griffitts wrote:
We have the first part already in the API:
SWModule::hasEntry(const SWKey *)
What sort of use cases do we have to build further API calls on this?
vector<string> getBooksPresent()
???
Yes- or even just:
bool isBookPresent(aBook)
and there also probably needs to be something like:
int lastChapterPresent(aBook)
An example of why this would be useful is seen in v11n Synodal, the book
of Daniel. The last two chapters (13-14) are Apocryphal material which
many translations purposefully exclude. Psalms 151 in Synodal is the
same. So something like lastChapterPresent(aBook) allows correct
building of chapter lists etc.
and then something like:
int lastVersePresent(aBook, aChapter)
An example for its usefulness would again be in Synodal, the book of
Daniel. Daniel chapter 3 verses 34-100 are Apocryphal and will be
excluded from many Synodal modules. Having lastVersePresent would allow
verse lists etc. to be built according to the actual module's content.
Usually these last-Present functions would simply check hasEntry on the
last unit and quickly return. Only in rare cases would they actually
need to iterate to find the answer.
This API has the advantage over the Scope .conf param in that it allows
module content to be fully queried even if the module makers failed to
supply a Scope param. On the other hand, it requires installation of the
module before "scope" can be determined, whereas having Scope in the
.conf allows pre-install knowledge of what's in a given module. But if
this becomes the Scope param's only usefulness, maybe Scope should then
be simplified substantially to indicate only the included books within
the module, and not chapters and verses too, which can get hairy.
John
On 05/12/2013 07:11 PM, DM Smith wrote:
More:
Once that is written, the worst case for analysis is a book that is
entirely absent. Basically, when you find something from a book, you
don't need to look any further in the book and go to the next.
On May 12, 2013, at 10:06 PM, DM Smith <dmsm...@crosswire.org> wrote:
JSword (Java) is quite different from SWORD (C++). But I'll give you
an overview. Each module has a similar structure. There is an index
file where slots have records indicating offset and size into a data
file. For a Bible module, each slot represents a verse.
If the size is 0 then that indexed location is empty. A compressed
module is slightly more complicated. The index consists of two parts.
But the idea is the same. If the length of the data is 0, then it is
empty.
Basically if you look at the chain of calls to get the raw text of a
verse, it digs down and at some point it gets the data size. Our code
merely bails once it gets the data size.
I can point you to our Java code, if you like, but I don't know how
much that'd help.
In Him,
DM
On May 12, 2013, at 9:53 PM, Nic Carter <niccar...@mac.com> wrote:
Hi DM,
On 12/05/2013, at 7:40 AM, DM Smith <dmsm...@crosswire.org> wrote:
Chris Burrell added some code to JSword that allows for the quick
determination of whether a verse is present in a module. He is
using this in STEP to prune the v11n to only those books, chapters
and verses that are actually present. On old slow hardware he
reported that it is very fast to analyze an entire module.
Could you please let me know where this is? Would be interesting to
look at and see how it performs on a handheld in C++ or Obj-C :)
Thanks heaps, ybic
nic... :)
ps: I don't know the JSword codebase at all, so it may be easier if
I'm pointed in the right direction rather than trying to find it :)
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page