You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by Manik Surtani <ma...@surtani.org> on 2005/02/10 17:22:33 UTC

RegexpKeyedMap

Hello all

I've written a Regexp based hashmap - a simple extension to
java.util.HashMap which uses regexps as keys, and returns values whose
regexp keys match a 'requested' key.

I'd like to submit this to Jakarta, but am not sure whether it would be
here or to the Commons Collections project.  My class depends on
org.apache.regexp classes, so it seems logical that it is packaged here
... but being a general purpose collection class, I'd think Commons
Collections ...

Suggestions?

Here's the javadoc on the class...

/**
 * This map implementation uses a hashmap as the underlying storage.
 * Note that the keySet() method will return a set of regular expressions
rather than actual keys.
 * The put() method uses a regexp as a key.
 * The get() method gets any value that matches one of the regexps.  If
there is more than one matching regexp, the first one
 * encountered is returned - and hence could be indeterminate!
 *
 * @author Manik Surtani
 *
 */

-- 
Manik Surtani
manik@surtani.org

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


Re: RegexpKeyedMap

Posted by Manik Surtani <ma...@surtani.org>.
Hi

I've added a few pages to the Jakarta wiki since Jakarta-Regexp doesn't 
have its own wiki

links from http://wiki.apache.org/jakarta/InterWiki

Cheers,
Manik


Vadim Gritsenko wrote:

> Manik Surtani wrote:
>
>> Where is this wiki?
>
>
> You can use jakarta wiki:
>   http://wiki.apache.org/jakarta/
>
> Vadim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


Re: RegexpKeyedMap

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Manik Surtani wrote:
> Where is this wiki?

You can use jakarta wiki:
   http://wiki.apache.org/jakarta/

Vadim

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


Re: RegexpKeyedMap

Posted by Manik Surtani <ma...@surtani.org>.
I've actually found a lot of use for this - e.g., lookups where I have 
the same value for a number of keys, etc.

key: "red|blue|black" value: "colour"
key: "one|two|three" value: "number"

etc.

Logically I would think this should go in the commons collections 
package, just another useful collection class.  Since this depends on 
the regexp package though, it may be hard to get it into commons 
collections...

Where is this wiki?

Cheers,
Manik


Vadim Gritsenko wrote:

> Manik Surtani wrote:
>
>> Hello all
>>
>> I've written a Regexp based hashmap - a simple extension to
>> java.util.HashMap which uses regexps as keys, and returns values whose
>> regexp keys match a 'requested' key.
>>
>> I'd like to submit this to Jakarta, but am not sure whether it would be
>> here or to the Commons Collections project.  My class depends on
>> org.apache.regexp classes, so it seems logical that it is packaged here
>> ... but being a general purpose collection class, I'd think Commons
>> Collections ...
>>
>> Suggestions?
>
>
> It's probably of not enough general interest so I don't think it 
> should go into regexp package. You can add it to the wiki page, 
> bugzilla, or both. This way interested people can get it.
>
> Vadim
>
>
>> Here's the javadoc on the class...
>>
>> /**
>>  * This map implementation uses a hashmap as the underlying storage.
>>  * Note that the keySet() method will return a set of regular 
>> expressions
>> rather than actual keys.
>>  * The put() method uses a regexp as a key.
>>  * The get() method gets any value that matches one of the regexps.  If
>> there is more than one matching regexp, the first one
>>  * encountered is returned - and hence could be indeterminate!
>>  *
>>  * @author Manik Surtani
>>  *
>>  */
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


Re: RegexpKeyedMap

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Manik Surtani wrote:
> Hello all
> 
> I've written a Regexp based hashmap - a simple extension to
> java.util.HashMap which uses regexps as keys, and returns values whose
> regexp keys match a 'requested' key.
> 
> I'd like to submit this to Jakarta, but am not sure whether it would be
> here or to the Commons Collections project.  My class depends on
> org.apache.regexp classes, so it seems logical that it is packaged here
> ... but being a general purpose collection class, I'd think Commons
> Collections ...
> 
> Suggestions?

It's probably of not enough general interest so I don't think it should go into 
regexp package. You can add it to the wiki page, bugzilla, or both. This way 
interested people can get it.

Vadim


> Here's the javadoc on the class...
> 
> /**
>  * This map implementation uses a hashmap as the underlying storage.
>  * Note that the keySet() method will return a set of regular expressions
> rather than actual keys.
>  * The put() method uses a regexp as a key.
>  * The get() method gets any value that matches one of the regexps.  If
> there is more than one matching regexp, the first one
>  * encountered is returned - and hence could be indeterminate!
>  *
>  * @author Manik Surtani
>  *
>  */

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org