commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claudio Squarcella <>
Subject Re: [Graph] On graph weight type(s)
Date Sun, 12 Feb 2012 22:36:51 GMT

>> * the mapping between primitive types and their respective default
>>    *Operations is known and kept somewhere (abstract class, etc);
>> * each algorithm specifies only once the set of primitive types that
>>    it accepts;
>> * with a bit of magic (?) we combine the above to provide shortcuts to
>>    the user.
> +1
> I think that a mapper can be useful.
> we can create a default mapper between primitives and *Operations and add a void API
like that
> findMaxFlow( graph ).from( a ).to( g ).applying<Algorithm>( void ).
> we can choose the correct Operation mappimng directly on the default constructor using
our mapper.
> so for the primitives Integer, Double etc, the user doesn't  have to specify anything.

I thought about something similar. But I finally see two downsides:

  * we would need to use reflection for generics or some better
    alternative to actually understand the generic type of weight and
    map it to the appropriate *Operations,
  * we should throw an exception when non-primitive weights are
    incorrectly passed without a handler.

Now that I have a clearer picture in mind I'm almost convinced to give up...

Anyway, expect a patch soon from me that at least incorporates 
suggestions on new names for primitive implementations and variable names ;)


Claudio Squarcella
PhD student at Roma Tre University

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message