[sword-devel] I want to port the API to Java

Mike Dougherty sword-devel@crosswire.org
06 Dec 2001 11:47:41 -0800

On Wed, 2001-12-05 at 12:55, Troy A. Griffitts wrote:
> 	jsword currently requires the jgl container api.  The current, standard
> java container library is not extensive enough to contain a multimap
> equivelant of the c++ stl.  The primary difference between a map and
> multimap is that a multimap has the ability to iterate thru duplicate
> key values, whereas a map does not allow duplicate key values.

I am still reading up on the project so there may be some holes in my
logic here.

Did you do the multimap exclusively for the SWConfig object? If so it
seems to be that a better way to do this is by using a combination of
HashMap and Properties objects. Each .conf file would have it's own
Properties object, which are then stored in a configuration HashMap. So
getting the value of a property would look like:

String val = ((Properties)configHash.get("KJV")).getProperty("ModDrv");

Which you could then hide in a convenience method if desired:

SWConfig config = SWConfig.getInstance();
String val = config.getModuleProperty("KJV", "ModDrv");

Of course you still need a way to iterate through the modules and
properties, but that's already done for with the HashMap.keySet() and
Properties.keySet() methods. Which you could again hide:

Iterator moduleIterator = config.iterator();
// ... later that afternoon ...
Iterator propertyIterator = config.getModuleIterator( modName );

The names may be changed to protect the innocent, but I hope the idea is

Am I understanding all of this correctly, or do I need to go back and
rethink this?


 Mike Dougherty -- Java Software Engineer
 Going to church does not make a person religious, nor does going to
 make a person educated, any more than going to a garage makes a person
a car.