You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2012/09/05 20:23:55 UTC
svn commit: r1381282 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/FieldElement.java
Author: luc
Date: Wed Sep 5 18:23:54 2012
New Revision: 1381282
URL: http://svn.apache.org/viewvc?rev=1381282&view=rev
Log:
Added throw declarations for FieldElements.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/FieldElement.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/FieldElement.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/FieldElement.java?rev=1381282&r1=1381281&r2=1381282&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/FieldElement.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/FieldElement.java Wed Sep 5 18:23:54 2012
@@ -16,6 +16,9 @@
*/
package org.apache.commons.math3;
+import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.NullArgumentException;
+
/**
* Interface representing <a href="http://mathworld.wolfram.com/Field.html">field</a> elements.
@@ -29,14 +32,16 @@ public interface FieldElement<T> {
/** Compute this + a.
* @param a element to add
* @return a new element representing this + a
+ * @throws NullArgumentException if {@code addend} is {@code null}.
*/
- T add(T a);
+ T add(T a) throws NullArgumentException;
/** Compute this - a.
* @param a element to subtract
* @return a new element representing this - a
+ * @throws NullArgumentException if {@code a} is {@code null}.
*/
- T subtract(T a);
+ T subtract(T a) throws NullArgumentException;
/**
* Returns the additive inverse of {@code this} element.
@@ -57,20 +62,24 @@ public interface FieldElement<T> {
/** Compute this × a.
* @param a element to multiply
* @return a new element representing this × a
+ * @throws NullArgumentException if {@code a} is {@code null}.
*/
- T multiply(T a);
+ T multiply(T a) throws NullArgumentException;
/** Compute this ÷ a.
* @param a element to add
* @return a new element representing this ÷ a
+ * @throws NullArgumentException if {@code a} is {@code null}.
+ * @throws MathArithmeticException if {@code a} is zero
*/
- T divide(T a);
+ T divide(T a) throws NullArgumentException, MathArithmeticException;
/**
* Returns the multiplicative inverse of {@code this} element.
* @return the inverse of {@code this}.
+ * @throws MathArithmeticException if {@code this} is zero
*/
- T reciprocal();
+ T reciprocal() throws MathArithmeticException;
/** Get the {@link Field} to which the instance belongs.
* @return {@link Field} to which the instance belongs