You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-dev@incubator.apache.org by Arjuna Wijeyekoon <ar...@gmail.com> on 2006/11/09 01:55:05 UTC

Re: Re: make ValueMap public

ok, since we can't use the commons-collections, let's make ValueMap
public.

I was going to call it ReverseHashMap,

but since BidiMap seems to be more popular (especially since
commons-collections has a BidiMap)
can I call this
BidiHashMap
?


On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > While I've no problem with using commons-collections internally,
> > I'm very reluctant to consider exposing commons-collections
> > classes directly in a public API, since it mandates that
> > dependency eternally  - and assumes that Commons Collections
> > won't just decide to change their API (which they have in the
> > past).  So, -1 to using any commons collections class as
> > the return type of any public API.
>
> good point. In MyFaces we had fun with them in the past too :)
>
> > We might consider introducing:
> >
> >   org.apache.myfaces.trinidad.util.BidiMap
> >   {
> >      Object getKey(Object value)
> >      BidiMap inverseBidiMap()
> >      Object removeValue(Object value)
> >   }
> >
> > (modeled after their BidiMap), then as an internal
> > implementation detail use a subclass of
> > commons-collections' DualHashBidiMap that
> > implements our BidiMap.  This eliminates the
> > public API dependency, but adds an implementation
> > dependency.
> >
> > I don't know, though, if it's worth adding the
> > dependency on commons-collections for this
> > one feature.
> >
> > -- Adam
> >
> >
> >
> > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > underlying storage is HashMap.
> > >
> > > I just found the following in commons:
> > > http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > >
> > > I wonder if we should use that directly and remove the current ValueMap?
> > >
> > > --arjuna
> > >
> > >
> > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > >
> > > > I guess both are useful;  but what is the underlying storage?
> > > > If it's a HashMap, then this should be called something like
> > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > >
> > > > -- Adam
> > > >
> > > >
> > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > Hi,
> > > > > I'd like to make
> > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > a public utility class.
> > > > >
> > > > > This class maintains a mapping from key to value, and also from value to
> > > > > key. It is useful to create
> > > > > ClientRowKeyManager implementations (See
> > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > >
> > > > > I'd like to call it
> > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > >
> > > > > And I will cleanup the api so that the Map interface is fully
> > > > implemented
> > > > > (along with the remove operations).
> > > > >
> > > > > What do you think about making this class public?
> > > > > ??????
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > If we do make this public, which of the following apis is better?
> > > > > ReverseMap<K,V> map;
> > > > > V value;
> > > > > K key = map.getKey(value);    // option 1
> > > > > or
> > > > > Map<V,K> valuemap = map.getReverseMap();     //  option 2
> > > > > K Key = valuemap.get(value);
> > > > > ???
> > > > >
> > > > > or should we have both?
> > > > >
> > > > > --arjuna
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>

Re: Re: Re: Re: Re: make ValueMap public

Posted by Adam Winer <aw...@gmail.com>.
Yep, we saw the Jakarta Collections project.  I'm happy to
use their code, but highly apprehensive about making
any of our public APIs directly expose their APIs;  there
is a history of API changes there.

-- Adam



On 11/9/06, Craig McClanahan <cr...@apache.org> wrote:
> On 11/9/06, Adam Winer <aw...@gmail.com> wrote:
> >
> > What I was suggesting is that we have a BidiMap interface,
> > and a BidiHashMap implementation of that interface.  So if
> > you're going to have a getInvertedMap() function, it should
> > return a BidiMap.
>
>
> On the topic of general purpose "bidi" maps, it might be worth comparing
> notes with the Jakarta Collections project, which IIRC has a similar class.
> It might be possible to use such an existing implementation and/or
> collaborate on a feature set that meets everyone's needs within the context
> of that project.
>
> -- Adam
>
>
> Craig
>
>
> On 11/9/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > I thought you would prefer BidiHashMap because
> > > the internal implementation is two HashMaps.
> > >
> > > When I proposed ReverseMap, you suggested ReverseHashMap,
> > > so now that I like BidiMap, I proposed BidiHashMap because
> > > I thought you would prefer that :)
> > >
> > > what say you?
> > >
> > >
> > > On 11/8/06, Adam Winer <aw...@gmail.com> wrote:
> > > > Shouldn't it be BidiMap?  Not BidiHashMap?
> > > >
> > > > -- Adam
> > > >
> > > >
> > > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > http://issues.apache.org/jira/browse/ADFFACES-282
> > > > > --arjuna
> > > > >
> > > > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > Also, can I call this method getInvertedMap?
> > > > > >
> > > > > > Map<V,K> BidiHashMap<K,V>.getInvertedMap()
> > > > > >
> > > > > > ?
> > > > > >
> > > > > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > ok, since we can't use the commons-collections, let's make
> > ValueMap
> > > > > > > public.
> > > > > > >
> > > > > > > I was going to call it ReverseHashMap,
> > > > > > >
> > > > > > > but since BidiMap seems to be more popular (especially since
> > > > > > > commons-collections has a BidiMap)
> > > > > > > can I call this
> > > > > > > BidiHashMap
> > > > > > > ?
> > > > > > >
> > > > > > >
> > > > > > > On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > > > > > > > On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > > > > While I've no problem with using commons-collections
> > internally,
> > > > > > > > > I'm very reluctant to consider exposing commons-collections
> > > > > > > > > classes directly in a public API, since it mandates that
> > > > > > > > > dependency eternally  - and assumes that Commons Collections
> > > > > > > > > won't just decide to change their API (which they have in
> > the
> > > > > > > > > past).  So, -1 to using any commons collections class as
> > > > > > > > > the return type of any public API.
> > > > > > > >
> > > > > > > > good point. In MyFaces we had fun with them in the past too :)
> > > > > > > >
> > > > > > > > > We might consider introducing:
> > > > > > > > >
> > > > > > > > >   org.apache.myfaces.trinidad.util.BidiMap
> > > > > > > > >   {
> > > > > > > > >      Object getKey(Object value)
> > > > > > > > >      BidiMap inverseBidiMap()
> > > > > > > > >      Object removeValue(Object value)
> > > > > > > > >   }
> > > > > > > > >
> > > > > > > > > (modeled after their BidiMap), then as an internal
> > > > > > > > > implementation detail use a subclass of
> > > > > > > > > commons-collections' DualHashBidiMap that
> > > > > > > > > implements our BidiMap.  This eliminates the
> > > > > > > > > public API dependency, but adds an implementation
> > > > > > > > > dependency.
> > > > > > > > >
> > > > > > > > > I don't know, though, if it's worth adding the
> > > > > > > > > dependency on commons-collections for this
> > > > > > > > > one feature.
> > > > > > > > >
> > > > > > > > > -- Adam
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > > > underlying storage is HashMap.
> > > > > > > > > >
> > > > > > > > > > I just found the following in commons:
> > > > > > > > > >
> > http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > > > > > > > >
> > > > > > > > > > I wonder if we should use that directly and remove the
> > current ValueMap?
> > > > > > > > > >
> > > > > > > > > > --arjuna
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > > > > > >
> > > > > > > > > > > I guess both are useful;  but what is the underlying
> > storage?
> > > > > > > > > > > If it's a HashMap, then this should be called something
> > like
> > > > > > > > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > > > > > > > >
> > > > > > > > > > > -- Adam
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > > > > > Hi,
> > > > > > > > > > > > I'd like to make
> > > > > > > > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > > > > > > > a public utility class.
> > > > > > > > > > > >
> > > > > > > > > > > > This class maintains a mapping from key to value, and
> > also from value to
> > > > > > > > > > > > key. It is useful to create
> > > > > > > > > > > > ClientRowKeyManager implementations (See
> > > > > > > > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > > > > > > > >
> > > > > > > > > > > > I'd like to call it
> > > > > > > > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > > > > > > > >
> > > > > > > > > > > > And I will cleanup the api so that the Map interface
> > is fully
> > > > > > > > > > > implemented
> > > > > > > > > > > > (along with the remove operations).
> > > > > > > > > > > >
> > > > > > > > > > > > What do you think about making this class public?
> > > > > > > > > > > > ??????
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > If we do make this public, which of the following apis
> > is better?
> > > > > > > > > > > > ReverseMap<K,V> map;
> > > > > > > > > > > > V value;
> > > > > > > > > > > > K key = map.getKey(value);    // option 1
> > > > > > > > > > > > or
> > > > > > > > > > > > Map<V,K> valuemap = map.getReverseMap();
> > //  option 2
> > > > > > > > > > > > K Key = valuemap.get(value);
> > > > > > > > > > > > ???
> > > > > > > > > > > >
> > > > > > > > > > > > or should we have both?
> > > > > > > > > > > >
> > > > > > > > > > > > --arjuna
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Matthias Wessendorf
> > > > > > > > http://tinyurl.com/fmywh
> > > > > > > >
> > > > > > > > further stuff:
> > > > > > > > blog: http://jroller.com/page/mwessendorf
> > > > > > > > mail: mwessendorf-at-gmail-dot-com
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>

Re: Re: Re: Re: make ValueMap public

Posted by Craig McClanahan <cr...@apache.org>.
On 11/9/06, Adam Winer <aw...@gmail.com> wrote:
>
> What I was suggesting is that we have a BidiMap interface,
> and a BidiHashMap implementation of that interface.  So if
> you're going to have a getInvertedMap() function, it should
> return a BidiMap.


On the topic of general purpose "bidi" maps, it might be worth comparing
notes with the Jakarta Collections project, which IIRC has a similar class.
It might be possible to use such an existing implementation and/or
collaborate on a feature set that meets everyone's needs within the context
of that project.

-- Adam


Craig


On 11/9/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > I thought you would prefer BidiHashMap because
> > the internal implementation is two HashMaps.
> >
> > When I proposed ReverseMap, you suggested ReverseHashMap,
> > so now that I like BidiMap, I proposed BidiHashMap because
> > I thought you would prefer that :)
> >
> > what say you?
> >
> >
> > On 11/8/06, Adam Winer <aw...@gmail.com> wrote:
> > > Shouldn't it be BidiMap?  Not BidiHashMap?
> > >
> > > -- Adam
> > >
> > >
> > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > http://issues.apache.org/jira/browse/ADFFACES-282
> > > > --arjuna
> > > >
> > > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > Also, can I call this method getInvertedMap?
> > > > >
> > > > > Map<V,K> BidiHashMap<K,V>.getInvertedMap()
> > > > >
> > > > > ?
> > > > >
> > > > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > ok, since we can't use the commons-collections, let's make
> ValueMap
> > > > > > public.
> > > > > >
> > > > > > I was going to call it ReverseHashMap,
> > > > > >
> > > > > > but since BidiMap seems to be more popular (especially since
> > > > > > commons-collections has a BidiMap)
> > > > > > can I call this
> > > > > > BidiHashMap
> > > > > > ?
> > > > > >
> > > > > >
> > > > > > On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > > > > > > On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > > > While I've no problem with using commons-collections
> internally,
> > > > > > > > I'm very reluctant to consider exposing commons-collections
> > > > > > > > classes directly in a public API, since it mandates that
> > > > > > > > dependency eternally  - and assumes that Commons Collections
> > > > > > > > won't just decide to change their API (which they have in
> the
> > > > > > > > past).  So, -1 to using any commons collections class as
> > > > > > > > the return type of any public API.
> > > > > > >
> > > > > > > good point. In MyFaces we had fun with them in the past too :)
> > > > > > >
> > > > > > > > We might consider introducing:
> > > > > > > >
> > > > > > > >   org.apache.myfaces.trinidad.util.BidiMap
> > > > > > > >   {
> > > > > > > >      Object getKey(Object value)
> > > > > > > >      BidiMap inverseBidiMap()
> > > > > > > >      Object removeValue(Object value)
> > > > > > > >   }
> > > > > > > >
> > > > > > > > (modeled after their BidiMap), then as an internal
> > > > > > > > implementation detail use a subclass of
> > > > > > > > commons-collections' DualHashBidiMap that
> > > > > > > > implements our BidiMap.  This eliminates the
> > > > > > > > public API dependency, but adds an implementation
> > > > > > > > dependency.
> > > > > > > >
> > > > > > > > I don't know, though, if it's worth adding the
> > > > > > > > dependency on commons-collections for this
> > > > > > > > one feature.
> > > > > > > >
> > > > > > > > -- Adam
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > > underlying storage is HashMap.
> > > > > > > > >
> > > > > > > > > I just found the following in commons:
> > > > > > > > >
> http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > > > > > > >
> > > > > > > > > I wonder if we should use that directly and remove the
> current ValueMap?
> > > > > > > > >
> > > > > > > > > --arjuna
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > I guess both are useful;  but what is the underlying
> storage?
> > > > > > > > > > If it's a HashMap, then this should be called something
> like
> > > > > > > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > > > > > > >
> > > > > > > > > > -- Adam
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > > > > Hi,
> > > > > > > > > > > I'd like to make
> > > > > > > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > > > > > > a public utility class.
> > > > > > > > > > >
> > > > > > > > > > > This class maintains a mapping from key to value, and
> also from value to
> > > > > > > > > > > key. It is useful to create
> > > > > > > > > > > ClientRowKeyManager implementations (See
> > > > > > > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > > > > > > >
> > > > > > > > > > > I'd like to call it
> > > > > > > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > > > > > > >
> > > > > > > > > > > And I will cleanup the api so that the Map interface
> is fully
> > > > > > > > > > implemented
> > > > > > > > > > > (along with the remove operations).
> > > > > > > > > > >
> > > > > > > > > > > What do you think about making this class public?
> > > > > > > > > > > ??????
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > If we do make this public, which of the following apis
> is better?
> > > > > > > > > > > ReverseMap<K,V> map;
> > > > > > > > > > > V value;
> > > > > > > > > > > K key = map.getKey(value);    // option 1
> > > > > > > > > > > or
> > > > > > > > > > > Map<V,K> valuemap = map.getReverseMap();
> //  option 2
> > > > > > > > > > > K Key = valuemap.get(value);
> > > > > > > > > > > ???
> > > > > > > > > > >
> > > > > > > > > > > or should we have both?
> > > > > > > > > > >
> > > > > > > > > > > --arjuna
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Matthias Wessendorf
> > > > > > > http://tinyurl.com/fmywh
> > > > > > >
> > > > > > > further stuff:
> > > > > > > blog: http://jroller.com/page/mwessendorf
> > > > > > > mail: mwessendorf-at-gmail-dot-com
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Re: Re: Re: make ValueMap public

Posted by Adam Winer <aw...@gmail.com>.
What I was suggesting is that we have a BidiMap interface,
and a BidiHashMap implementation of that interface.  So if
you're going to have a getInvertedMap() function, it should
return a BidiMap.

-- Adam

On 11/9/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> I thought you would prefer BidiHashMap because
> the internal implementation is two HashMaps.
>
> When I proposed ReverseMap, you suggested ReverseHashMap,
> so now that I like BidiMap, I proposed BidiHashMap because
> I thought you would prefer that :)
>
> what say you?
>
>
> On 11/8/06, Adam Winer <aw...@gmail.com> wrote:
> > Shouldn't it be BidiMap?  Not BidiHashMap?
> >
> > -- Adam
> >
> >
> > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > http://issues.apache.org/jira/browse/ADFFACES-282
> > > --arjuna
> > >
> > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > Also, can I call this method getInvertedMap?
> > > >
> > > > Map<V,K> BidiHashMap<K,V>.getInvertedMap()
> > > >
> > > > ?
> > > >
> > > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > ok, since we can't use the commons-collections, let's make ValueMap
> > > > > public.
> > > > >
> > > > > I was going to call it ReverseHashMap,
> > > > >
> > > > > but since BidiMap seems to be more popular (especially since
> > > > > commons-collections has a BidiMap)
> > > > > can I call this
> > > > > BidiHashMap
> > > > > ?
> > > > >
> > > > >
> > > > > On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > > > > > On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > > While I've no problem with using commons-collections internally,
> > > > > > > I'm very reluctant to consider exposing commons-collections
> > > > > > > classes directly in a public API, since it mandates that
> > > > > > > dependency eternally  - and assumes that Commons Collections
> > > > > > > won't just decide to change their API (which they have in the
> > > > > > > past).  So, -1 to using any commons collections class as
> > > > > > > the return type of any public API.
> > > > > >
> > > > > > good point. In MyFaces we had fun with them in the past too :)
> > > > > >
> > > > > > > We might consider introducing:
> > > > > > >
> > > > > > >   org.apache.myfaces.trinidad.util.BidiMap
> > > > > > >   {
> > > > > > >      Object getKey(Object value)
> > > > > > >      BidiMap inverseBidiMap()
> > > > > > >      Object removeValue(Object value)
> > > > > > >   }
> > > > > > >
> > > > > > > (modeled after their BidiMap), then as an internal
> > > > > > > implementation detail use a subclass of
> > > > > > > commons-collections' DualHashBidiMap that
> > > > > > > implements our BidiMap.  This eliminates the
> > > > > > > public API dependency, but adds an implementation
> > > > > > > dependency.
> > > > > > >
> > > > > > > I don't know, though, if it's worth adding the
> > > > > > > dependency on commons-collections for this
> > > > > > > one feature.
> > > > > > >
> > > > > > > -- Adam
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > underlying storage is HashMap.
> > > > > > > >
> > > > > > > > I just found the following in commons:
> > > > > > > > http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > > > > > >
> > > > > > > > I wonder if we should use that directly and remove the current ValueMap?
> > > > > > > >
> > > > > > > > --arjuna
> > > > > > > >
> > > > > > > >
> > > > > > > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > I guess both are useful;  but what is the underlying storage?
> > > > > > > > > If it's a HashMap, then this should be called something like
> > > > > > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > > > > > >
> > > > > > > > > -- Adam
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > > > Hi,
> > > > > > > > > > I'd like to make
> > > > > > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > > > > > a public utility class.
> > > > > > > > > >
> > > > > > > > > > This class maintains a mapping from key to value, and also from value to
> > > > > > > > > > key. It is useful to create
> > > > > > > > > > ClientRowKeyManager implementations (See
> > > > > > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > > > > > >
> > > > > > > > > > I'd like to call it
> > > > > > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > > > > > >
> > > > > > > > > > And I will cleanup the api so that the Map interface is fully
> > > > > > > > > implemented
> > > > > > > > > > (along with the remove operations).
> > > > > > > > > >
> > > > > > > > > > What do you think about making this class public?
> > > > > > > > > > ??????
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > If we do make this public, which of the following apis is better?
> > > > > > > > > > ReverseMap<K,V> map;
> > > > > > > > > > V value;
> > > > > > > > > > K key = map.getKey(value);    // option 1
> > > > > > > > > > or
> > > > > > > > > > Map<V,K> valuemap = map.getReverseMap();     //  option 2
> > > > > > > > > > K Key = valuemap.get(value);
> > > > > > > > > > ???
> > > > > > > > > >
> > > > > > > > > > or should we have both?
> > > > > > > > > >
> > > > > > > > > > --arjuna
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Matthias Wessendorf
> > > > > > http://tinyurl.com/fmywh
> > > > > >
> > > > > > further stuff:
> > > > > > blog: http://jroller.com/page/mwessendorf
> > > > > > mail: mwessendorf-at-gmail-dot-com
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Re: Re: make ValueMap public

Posted by Arjuna Wijeyekoon <ar...@gmail.com>.
I thought you would prefer BidiHashMap because
the internal implementation is two HashMaps.

When I proposed ReverseMap, you suggested ReverseHashMap,
so now that I like BidiMap, I proposed BidiHashMap because
I thought you would prefer that :)

what say you?


On 11/8/06, Adam Winer <aw...@gmail.com> wrote:
> Shouldn't it be BidiMap?  Not BidiHashMap?
>
> -- Adam
>
>
> On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > http://issues.apache.org/jira/browse/ADFFACES-282
> > --arjuna
> >
> > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > Also, can I call this method getInvertedMap?
> > >
> > > Map<V,K> BidiHashMap<K,V>.getInvertedMap()
> > >
> > > ?
> > >
> > > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > ok, since we can't use the commons-collections, let's make ValueMap
> > > > public.
> > > >
> > > > I was going to call it ReverseHashMap,
> > > >
> > > > but since BidiMap seems to be more popular (especially since
> > > > commons-collections has a BidiMap)
> > > > can I call this
> > > > BidiHashMap
> > > > ?
> > > >
> > > >
> > > > On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > > > > On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > While I've no problem with using commons-collections internally,
> > > > > > I'm very reluctant to consider exposing commons-collections
> > > > > > classes directly in a public API, since it mandates that
> > > > > > dependency eternally  - and assumes that Commons Collections
> > > > > > won't just decide to change their API (which they have in the
> > > > > > past).  So, -1 to using any commons collections class as
> > > > > > the return type of any public API.
> > > > >
> > > > > good point. In MyFaces we had fun with them in the past too :)
> > > > >
> > > > > > We might consider introducing:
> > > > > >
> > > > > >   org.apache.myfaces.trinidad.util.BidiMap
> > > > > >   {
> > > > > >      Object getKey(Object value)
> > > > > >      BidiMap inverseBidiMap()
> > > > > >      Object removeValue(Object value)
> > > > > >   }
> > > > > >
> > > > > > (modeled after their BidiMap), then as an internal
> > > > > > implementation detail use a subclass of
> > > > > > commons-collections' DualHashBidiMap that
> > > > > > implements our BidiMap.  This eliminates the
> > > > > > public API dependency, but adds an implementation
> > > > > > dependency.
> > > > > >
> > > > > > I don't know, though, if it's worth adding the
> > > > > > dependency on commons-collections for this
> > > > > > one feature.
> > > > > >
> > > > > > -- Adam
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > underlying storage is HashMap.
> > > > > > >
> > > > > > > I just found the following in commons:
> > > > > > > http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > > > > >
> > > > > > > I wonder if we should use that directly and remove the current ValueMap?
> > > > > > >
> > > > > > > --arjuna
> > > > > > >
> > > > > > >
> > > > > > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > > >
> > > > > > > > I guess both are useful;  but what is the underlying storage?
> > > > > > > > If it's a HashMap, then this should be called something like
> > > > > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > > > > >
> > > > > > > > -- Adam
> > > > > > > >
> > > > > > > >
> > > > > > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > > Hi,
> > > > > > > > > I'd like to make
> > > > > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > > > > a public utility class.
> > > > > > > > >
> > > > > > > > > This class maintains a mapping from key to value, and also from value to
> > > > > > > > > key. It is useful to create
> > > > > > > > > ClientRowKeyManager implementations (See
> > > > > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > > > > >
> > > > > > > > > I'd like to call it
> > > > > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > > > > >
> > > > > > > > > And I will cleanup the api so that the Map interface is fully
> > > > > > > > implemented
> > > > > > > > > (along with the remove operations).
> > > > > > > > >
> > > > > > > > > What do you think about making this class public?
> > > > > > > > > ??????
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > If we do make this public, which of the following apis is better?
> > > > > > > > > ReverseMap<K,V> map;
> > > > > > > > > V value;
> > > > > > > > > K key = map.getKey(value);    // option 1
> > > > > > > > > or
> > > > > > > > > Map<V,K> valuemap = map.getReverseMap();     //  option 2
> > > > > > > > > K Key = valuemap.get(value);
> > > > > > > > > ???
> > > > > > > > >
> > > > > > > > > or should we have both?
> > > > > > > > >
> > > > > > > > > --arjuna
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Matthias Wessendorf
> > > > > http://tinyurl.com/fmywh
> > > > >
> > > > > further stuff:
> > > > > blog: http://jroller.com/page/mwessendorf
> > > > > mail: mwessendorf-at-gmail-dot-com
> > > > >
> > > >
> > >
> >
>

Re: Re: Re: make ValueMap public

Posted by Adam Winer <aw...@gmail.com>.
Shouldn't it be BidiMap?  Not BidiHashMap?

-- Adam


On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> http://issues.apache.org/jira/browse/ADFFACES-282
> --arjuna
>
> On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > Also, can I call this method getInvertedMap?
> >
> > Map<V,K> BidiHashMap<K,V>.getInvertedMap()
> >
> > ?
> >
> > On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > ok, since we can't use the commons-collections, let's make ValueMap
> > > public.
> > >
> > > I was going to call it ReverseHashMap,
> > >
> > > but since BidiMap seems to be more popular (especially since
> > > commons-collections has a BidiMap)
> > > can I call this
> > > BidiHashMap
> > > ?
> > >
> > >
> > > On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > > > On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > While I've no problem with using commons-collections internally,
> > > > > I'm very reluctant to consider exposing commons-collections
> > > > > classes directly in a public API, since it mandates that
> > > > > dependency eternally  - and assumes that Commons Collections
> > > > > won't just decide to change their API (which they have in the
> > > > > past).  So, -1 to using any commons collections class as
> > > > > the return type of any public API.
> > > >
> > > > good point. In MyFaces we had fun with them in the past too :)
> > > >
> > > > > We might consider introducing:
> > > > >
> > > > >   org.apache.myfaces.trinidad.util.BidiMap
> > > > >   {
> > > > >      Object getKey(Object value)
> > > > >      BidiMap inverseBidiMap()
> > > > >      Object removeValue(Object value)
> > > > >   }
> > > > >
> > > > > (modeled after their BidiMap), then as an internal
> > > > > implementation detail use a subclass of
> > > > > commons-collections' DualHashBidiMap that
> > > > > implements our BidiMap.  This eliminates the
> > > > > public API dependency, but adds an implementation
> > > > > dependency.
> > > > >
> > > > > I don't know, though, if it's worth adding the
> > > > > dependency on commons-collections for this
> > > > > one feature.
> > > > >
> > > > > -- Adam
> > > > >
> > > > >
> > > > >
> > > > > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > underlying storage is HashMap.
> > > > > >
> > > > > > I just found the following in commons:
> > > > > > http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > > > >
> > > > > > I wonder if we should use that directly and remove the current ValueMap?
> > > > > >
> > > > > > --arjuna
> > > > > >
> > > > > >
> > > > > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > > >
> > > > > > > I guess both are useful;  but what is the underlying storage?
> > > > > > > If it's a HashMap, then this should be called something like
> > > > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > > > >
> > > > > > > -- Adam
> > > > > > >
> > > > > > >
> > > > > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > > Hi,
> > > > > > > > I'd like to make
> > > > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > > > a public utility class.
> > > > > > > >
> > > > > > > > This class maintains a mapping from key to value, and also from value to
> > > > > > > > key. It is useful to create
> > > > > > > > ClientRowKeyManager implementations (See
> > > > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > > > >
> > > > > > > > I'd like to call it
> > > > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > > > >
> > > > > > > > And I will cleanup the api so that the Map interface is fully
> > > > > > > implemented
> > > > > > > > (along with the remove operations).
> > > > > > > >
> > > > > > > > What do you think about making this class public?
> > > > > > > > ??????
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > If we do make this public, which of the following apis is better?
> > > > > > > > ReverseMap<K,V> map;
> > > > > > > > V value;
> > > > > > > > K key = map.getKey(value);    // option 1
> > > > > > > > or
> > > > > > > > Map<V,K> valuemap = map.getReverseMap();     //  option 2
> > > > > > > > K Key = valuemap.get(value);
> > > > > > > > ???
> > > > > > > >
> > > > > > > > or should we have both?
> > > > > > > >
> > > > > > > > --arjuna
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Matthias Wessendorf
> > > > http://tinyurl.com/fmywh
> > > >
> > > > further stuff:
> > > > blog: http://jroller.com/page/mwessendorf
> > > > mail: mwessendorf-at-gmail-dot-com
> > > >
> > >
> >
>

Re: Re: make ValueMap public

Posted by Arjuna Wijeyekoon <ar...@gmail.com>.
http://issues.apache.org/jira/browse/ADFFACES-282
--arjuna

On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> Also, can I call this method getInvertedMap?
>
> Map<V,K> BidiHashMap<K,V>.getInvertedMap()
>
> ?
>
> On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > ok, since we can't use the commons-collections, let's make ValueMap
> > public.
> >
> > I was going to call it ReverseHashMap,
> >
> > but since BidiMap seems to be more popular (especially since
> > commons-collections has a BidiMap)
> > can I call this
> > BidiHashMap
> > ?
> >
> >
> > On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > > On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > > > While I've no problem with using commons-collections internally,
> > > > I'm very reluctant to consider exposing commons-collections
> > > > classes directly in a public API, since it mandates that
> > > > dependency eternally  - and assumes that Commons Collections
> > > > won't just decide to change their API (which they have in the
> > > > past).  So, -1 to using any commons collections class as
> > > > the return type of any public API.
> > >
> > > good point. In MyFaces we had fun with them in the past too :)
> > >
> > > > We might consider introducing:
> > > >
> > > >   org.apache.myfaces.trinidad.util.BidiMap
> > > >   {
> > > >      Object getKey(Object value)
> > > >      BidiMap inverseBidiMap()
> > > >      Object removeValue(Object value)
> > > >   }
> > > >
> > > > (modeled after their BidiMap), then as an internal
> > > > implementation detail use a subclass of
> > > > commons-collections' DualHashBidiMap that
> > > > implements our BidiMap.  This eliminates the
> > > > public API dependency, but adds an implementation
> > > > dependency.
> > > >
> > > > I don't know, though, if it's worth adding the
> > > > dependency on commons-collections for this
> > > > one feature.
> > > >
> > > > -- Adam
> > > >
> > > >
> > > >
> > > > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > underlying storage is HashMap.
> > > > >
> > > > > I just found the following in commons:
> > > > > http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > > >
> > > > > I wonder if we should use that directly and remove the current ValueMap?
> > > > >
> > > > > --arjuna
> > > > >
> > > > >
> > > > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > > > >
> > > > > > I guess both are useful;  but what is the underlying storage?
> > > > > > If it's a HashMap, then this should be called something like
> > > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > > >
> > > > > > -- Adam
> > > > > >
> > > > > >
> > > > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > > Hi,
> > > > > > > I'd like to make
> > > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > > a public utility class.
> > > > > > >
> > > > > > > This class maintains a mapping from key to value, and also from value to
> > > > > > > key. It is useful to create
> > > > > > > ClientRowKeyManager implementations (See
> > > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > > >
> > > > > > > I'd like to call it
> > > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > > >
> > > > > > > And I will cleanup the api so that the Map interface is fully
> > > > > > implemented
> > > > > > > (along with the remove operations).
> > > > > > >
> > > > > > > What do you think about making this class public?
> > > > > > > ??????
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > If we do make this public, which of the following apis is better?
> > > > > > > ReverseMap<K,V> map;
> > > > > > > V value;
> > > > > > > K key = map.getKey(value);    // option 1
> > > > > > > or
> > > > > > > Map<V,K> valuemap = map.getReverseMap();     //  option 2
> > > > > > > K Key = valuemap.get(value);
> > > > > > > ???
> > > > > > >
> > > > > > > or should we have both?
> > > > > > >
> > > > > > > --arjuna
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > Matthias Wessendorf
> > > http://tinyurl.com/fmywh
> > >
> > > further stuff:
> > > blog: http://jroller.com/page/mwessendorf
> > > mail: mwessendorf-at-gmail-dot-com
> > >
> >
>

Re: Re: make ValueMap public

Posted by Arjuna Wijeyekoon <ar...@gmail.com>.
Also, can I call this method getInvertedMap?

Map<V,K> BidiHashMap<K,V>.getInvertedMap()

?

On 11/8/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> ok, since we can't use the commons-collections, let's make ValueMap
> public.
>
> I was going to call it ReverseHashMap,
>
> but since BidiMap seems to be more popular (especially since
> commons-collections has a BidiMap)
> can I call this
> BidiHashMap
> ?
>
>
> On 10/27/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > On 10/27/06, Adam Winer <aw...@gmail.com> wrote:
> > > While I've no problem with using commons-collections internally,
> > > I'm very reluctant to consider exposing commons-collections
> > > classes directly in a public API, since it mandates that
> > > dependency eternally  - and assumes that Commons Collections
> > > won't just decide to change their API (which they have in the
> > > past).  So, -1 to using any commons collections class as
> > > the return type of any public API.
> >
> > good point. In MyFaces we had fun with them in the past too :)
> >
> > > We might consider introducing:
> > >
> > >   org.apache.myfaces.trinidad.util.BidiMap
> > >   {
> > >      Object getKey(Object value)
> > >      BidiMap inverseBidiMap()
> > >      Object removeValue(Object value)
> > >   }
> > >
> > > (modeled after their BidiMap), then as an internal
> > > implementation detail use a subclass of
> > > commons-collections' DualHashBidiMap that
> > > implements our BidiMap.  This eliminates the
> > > public API dependency, but adds an implementation
> > > dependency.
> > >
> > > I don't know, though, if it's worth adding the
> > > dependency on commons-collections for this
> > > one feature.
> > >
> > > -- Adam
> > >
> > >
> > >
> > > On 10/27/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > underlying storage is HashMap.
> > > >
> > > > I just found the following in commons:
> > > > http://jakarta.apache.org/commons/collections/apidocs/org/apache/commons/collections/bidimap/DualHashBidiMap.html
> > > >
> > > > I wonder if we should use that directly and remove the current ValueMap?
> > > >
> > > > --arjuna
> > > >
> > > >
> > > > On 10/25/06, Adam Winer <aw...@gmail.com> wrote:
> > > > >
> > > > > I guess both are useful;  but what is the underlying storage?
> > > > > If it's a HashMap, then this should be called something like
> > > > > ReverseHashMap.  (Or ReversibleHashMap?)
> > > > >
> > > > > -- Adam
> > > > >
> > > > >
> > > > > On 10/24/06, Arjuna Wijeyekoon <ar...@gmail.com> wrote:
> > > > > > Hi,
> > > > > > I'd like to make
> > > > > > org.apache.myfaces.trinidad.component.ValueMap
> > > > > > a public utility class.
> > > > > >
> > > > > > This class maintains a mapping from key to value, and also from value to
> > > > > > key. It is useful to create
> > > > > > ClientRowKeyManager implementations (See
> > > > > > http://issues.apache.org/jira/browse/ADFFACES-210).
> > > > > >
> > > > > > I'd like to call it
> > > > > > org.apache.myfaces.trinidad.util.ReverseMap
> > > > > >
> > > > > > And I will cleanup the api so that the Map interface is fully
> > > > > implemented
> > > > > > (along with the remove operations).
> > > > > >
> > > > > > What do you think about making this class public?
> > > > > > ??????
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > If we do make this public, which of the following apis is better?
> > > > > > ReverseMap<K,V> map;
> > > > > > V value;
> > > > > > K key = map.getKey(value);    // option 1
> > > > > > or
> > > > > > Map<V,K> valuemap = map.getReverseMap();     //  option 2
> > > > > > K Key = valuemap.get(value);
> > > > > > ???
> > > > > >
> > > > > > or should we have both?
> > > > > >
> > > > > > --arjuna
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
> >
> > --
> > Matthias Wessendorf
> > http://tinyurl.com/fmywh
> >
> > further stuff:
> > blog: http://jroller.com/page/mwessendorf
> > mail: mwessendorf-at-gmail-dot-com
> >
>