[
https://issues.apache.org/jira/browse/MATH-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743887#action_12743887
]
Luc Maisonobe commented on MATH-285:
------------------------------------
The names were chosen for compatibility with existing names in commons-math.
As an example, the Complex and Fraction classes now implement the interface but
existed before that.
These names are also consistent throughout the library, even for classes that
do not implement the Field interface.
I'm not sure many people will have a need to implement themselves this
interface. I'm also sure many people would complain against changing the API of
Complex and Fraction.
> FieldElement *interface* method names clash with already used method names
> --------------------------------------------------------------------------
>
> Key: MATH-285
> URL: https://issues.apache.org/jira/browse/MATH-285
> Project: Commons Math
> Issue Type: Improvement
> Affects Versions: 2.0
> Reporter: Klaus Hartlage
> Priority: Minor
>
> This is probably to late to change, because release 2.0 is available now.
> But it would be good if the FieldElement *interface* method names don't clash
> with already used method names (expecially with the java.util.List#add()
> method) if you would like to adopt the interface for already existing number
> type hierarchies.
> For my hierachy I refactored the methods like this and could adopt the
> interface very fast. Otherwise you have to write a lot of wrappers to adopt
> the FieldElement interface.
> public interface FieldElement<T> {
> /** Compute this + a.
> * @param a element to add
> * @return a new element representing this + a
> */
> T plus(T a);
> /** Compute this - a.
> * @param a element to subtract
> * @return a new element representing this - a
> */
> T minus(T a);
> /** Compute this × a.
> * @param a element to multiply
> * @return a new element representing this × a
> */
> T times(T a);
> /** Compute this ÷ a.
> * @param a element to add
> * @return a new element representing this ÷ a
> * @exception ArithmeticException if a is the zero of the
> * additive operation (i.e. additive identity)
> */
> T div(T a) throws ArithmeticException;
> .....
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.