Hi Sebastien,

Am Donnerstag 09 Februar 2012, 11:18:43 schrieb Sébastien Brisard:
> > I am slightly reluctant to change FieldElement to an abstract class.
> > What do other people think  about this ?
> > Luc

it would have been better to let Number only be an interface and not an 
abstract class. Number only has byteValue() and shortValue() implemented in 
terms of the abstract method intValue(). So an interface would have been 
sufficient as for FieldElement. 

> I see your point and was going to suggest that we only add a
> doubleValue() method to the interface FieldElement. But that does not
> work with Complex!
> So I'll have to think of something else...

one work arround could be to setup an interface, say NumberConversions, which 
just contains the methods of Number. Then one could use it together with 
FieldElement: 

  class X implements FieldElement, NumberConversions /*extends Number*/ {...}

and then to require the same for using classes

  <C extends FieldElement & NumberConversions> 
  double computeSomeThing(C parm) { ...; return parm.doubleValue(); }

One could also reduce NumberConversions to just DoubleConversion with only
the doubleValue() method.

For Complex one can then decide just not to implement DoubleConversion or to 
implement doubleValue() with some warning in the API documentation and with 
some different meaning (e.g. the double value of the absolute value).

Heinz


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to