commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1384212 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java
Date Thu, 13 Sep 2012 06:11:06 GMT
Author: celestin
Date: Thu Sep 13 06:11:05 2012
New Revision: 1384212

URL: http://svn.apache.org/viewvc?rev=1384212&view=rev
Log:
MATH-854: document all exceptions in ArrayFieldVector.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java?rev=1384212&r1=1384211&r2=1384212&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java
Thu Sep 13 06:11:05 2012
@@ -97,7 +97,7 @@ public class ArrayFieldVector<T extends 
      * @see #ArrayFieldVector(Field, FieldElement[])
      */
     public ArrayFieldVector(T[] d)
-            throws NullArgumentException, ZeroException {
+        throws NullArgumentException, ZeroException {
         if (d == null) {
             throw new NullArgumentException();
         }
@@ -118,7 +118,7 @@ public class ArrayFieldVector<T extends 
      * @see #ArrayFieldVector(FieldElement[])
      */
     public ArrayFieldVector(Field<T> field, T[] d)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (d == null) {
             throw new NullArgumentException();
         }
@@ -148,7 +148,7 @@ public class ArrayFieldVector<T extends 
      * @see #ArrayFieldVector(Field, FieldElement[], boolean)
      */
     public ArrayFieldVector(T[] d, boolean copyArray)
-            throws NullArgumentException, ZeroException {
+        throws NullArgumentException, ZeroException {
         if (d == null) {
             throw new NullArgumentException();
         }
@@ -175,7 +175,7 @@ public class ArrayFieldVector<T extends 
      * @see #ArrayFieldVector(FieldElement[], boolean)
      */
     public ArrayFieldVector(Field<T> field, T[] d, boolean copyArray)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (d == null) {
             throw new NullArgumentException();
         }
@@ -194,7 +194,7 @@ public class ArrayFieldVector<T extends 
      * than {@code pos + size}.
      */
     public ArrayFieldVector(T[] d, int pos, int size)
-            throws NullArgumentException, NumberIsTooLargeException {
+        throws NullArgumentException, NumberIsTooLargeException {
         if (d == null) {
             throw new NullArgumentException();
         }
@@ -218,7 +218,7 @@ public class ArrayFieldVector<T extends 
      * than {@code pos + size}.
      */
     public ArrayFieldVector(Field<T> field, T[] d, int pos, int size)
-            throws NullArgumentException, NumberIsTooLargeException {
+        throws NullArgumentException, NumberIsTooLargeException {
         if (d == null) {
             throw new NullArgumentException();
         }
@@ -237,7 +237,7 @@ public class ArrayFieldVector<T extends 
      * @throws NullArgumentException if {@code v} is {@code null}.
      */
     public ArrayFieldVector(FieldVector<T> v)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (v == null) {
             throw new NullArgumentException();
         }
@@ -255,7 +255,7 @@ public class ArrayFieldVector<T extends 
      * @throws NullArgumentException if {@code v} is {@code null}.
      */
     public ArrayFieldVector(ArrayFieldVector<T> v)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (v == null) {
             throw new NullArgumentException();
         }
@@ -272,7 +272,7 @@ public class ArrayFieldVector<T extends 
      * @throws NullArgumentException if {@code v} is {@code null}.
      */
     public ArrayFieldVector(ArrayFieldVector<T> v, boolean deep)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (v == null) {
             throw new NullArgumentException();
         }
@@ -289,7 +289,7 @@ public class ArrayFieldVector<T extends 
      * {@code null}.
      */
     public ArrayFieldVector(ArrayFieldVector<T> v1, ArrayFieldVector<T> v2)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (v1 == null || v2 == null) {
             throw new NullArgumentException();
         }
@@ -308,7 +308,7 @@ public class ArrayFieldVector<T extends 
      * {@code null}.
      */
     public ArrayFieldVector(ArrayFieldVector<T> v1, T[] v2)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (v1 == null || v2 == null) {
             throw new NullArgumentException();
         }
@@ -327,7 +327,7 @@ public class ArrayFieldVector<T extends 
      * {@code null}.
      */
     public ArrayFieldVector(T[] v1, ArrayFieldVector<T> v2)
-            throws NullArgumentException {
+        throws NullArgumentException {
         if (v1 == null || v2 == null) {
             throw new NullArgumentException();
         }
@@ -353,7 +353,7 @@ public class ArrayFieldVector<T extends 
      * @see #ArrayFieldVector(Field, FieldElement[], FieldElement[])
      */
     public ArrayFieldVector(T[] v1, T[] v2)
-            throws NullArgumentException, ZeroException {
+        throws NullArgumentException, ZeroException {
         if (v1 == null || v2 == null) {
             throw new NullArgumentException();
         }
@@ -378,7 +378,7 @@ public class ArrayFieldVector<T extends 
      * @see #ArrayFieldVector(FieldElement[], FieldElement[])
      */
     public ArrayFieldVector(Field<T> field, T[] v1, T[] v2)
-            throws NullArgumentException, ZeroException {
+        throws NullArgumentException, ZeroException {
         if (v1 == null || v2 == null) {
             throw new NullArgumentException();
         }
@@ -412,7 +412,12 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(this, true);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DimensionMismatchException if {@code v} is not the same size as
+     * {@code this}.
+     */
     public FieldVector<T> add(FieldVector<T> v)
         throws DimensionMismatchException {
         try {
@@ -444,7 +449,12 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DimensionMismatchException if {@code v} is not the same size as
+     * {@code this}.
+     */
     public FieldVector<T> subtract(FieldVector<T> v)
         throws DimensionMismatchException {
         try {
@@ -476,8 +486,12 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
-    public FieldVector<T> mapAdd(T d) {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     */
+    public FieldVector<T> mapAdd(T d) throws NullArgumentException {
         T[] out = buildArray(data.length);
         for (int i = 0; i < data.length; i++) {
             out[i] = data[i].add(d);
@@ -485,16 +499,24 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
-    public FieldVector<T> mapAddToSelf(T d) {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     */
+    public FieldVector<T> mapAddToSelf(T d) throws NullArgumentException {
         for (int i = 0; i < data.length; i++) {
             data[i] = data[i].add(d);
         }
         return this;
     }
 
-    /** {@inheritDoc} */
-    public FieldVector<T> mapSubtract(T d) {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     */
+    public FieldVector<T> mapSubtract(T d) throws NullArgumentException {
         T[] out = buildArray(data.length);
         for (int i = 0; i < data.length; i++) {
             out[i] = data[i].subtract(d);
@@ -502,16 +524,24 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
-    public FieldVector<T> mapSubtractToSelf(T d) {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     */
+    public FieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException {
         for (int i = 0; i < data.length; i++) {
             data[i] = data[i].subtract(d);
         }
         return this;
     }
 
-    /** {@inheritDoc} */
-    public FieldVector<T> mapMultiply(T d) {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     */
+    public FieldVector<T> mapMultiply(T d) throws NullArgumentException {
         T[] out = buildArray(data.length);
         for (int i = 0; i < data.length; i++) {
             out[i] = data[i].multiply(d);
@@ -519,15 +549,24 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
-    public FieldVector<T> mapMultiplyToSelf(T d) {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     */
+    public FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException {
         for (int i = 0; i < data.length; i++) {
             data[i] = data[i].multiply(d);
         }
         return this;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     * @throws MathArithmeticException if {@code d} is zero.
+     */
     public FieldVector<T> mapDivide(T d)
         throws NullArgumentException, MathArithmeticException {
         if (d == null) {
@@ -540,7 +579,12 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NullArgumentException if {@code d} is {@code null}.
+     * @throws MathArithmeticException if {@code d} is zero.
+     */
     public FieldVector<T> mapDivideToSelf(T d)
         throws NullArgumentException, MathArithmeticException {
         if (d == null) {
@@ -552,7 +596,11 @@ public class ArrayFieldVector<T extends 
         return this;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws MathArithmeticException if {@code d} is zero.
+     */
     public FieldVector<T> mapInv() throws MathArithmeticException {
         T[] out = buildArray(data.length);
         final T one = field.getOne();
@@ -566,7 +614,11 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws MathArithmeticException if {@code d} is zero.
+     */
     public FieldVector<T> mapInvToSelf() throws MathArithmeticException {
         final T one = field.getOne();
         for (int i = 0; i < data.length; i++) {
@@ -579,7 +631,12 @@ public class ArrayFieldVector<T extends 
         return this;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DimensionMismatchException if {@code v} is not the same size as
+     * {@code this}.
+     */
     public FieldVector<T> ebeMultiply(FieldVector<T> v)
         throws DimensionMismatchException {
         try {
@@ -611,7 +668,13 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DimensionMismatchException if {@code v} is not the same size as
+     * {@code this}.
+     * @throws MathArithmeticException if one entry of {@code v} is zero.
+     */
     public FieldVector<T> ebeDivide(FieldVector<T> v)
         throws DimensionMismatchException, MathArithmeticException {
         try {
@@ -666,9 +729,13 @@ public class ArrayFieldVector<T extends 
         return data;
     }
 
-    /** {@inheritDoc} */
-    public T dotProduct(FieldVector<T> v)
-        throws DimensionMismatchException {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DimensionMismatchException if {@code v} is not the same size as
+     * {@code this}.
+     */
+    public T dotProduct(FieldVector<T> v) throws DimensionMismatchException {
         try {
             return dotProduct((ArrayFieldVector<T>) v);
         } catch (ClassCastException cce) {
@@ -698,7 +765,13 @@ public class ArrayFieldVector<T extends 
         return dot;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws DimensionMismatchException if {@code v} is not the same size as
+     * {@code this}.
+     * @throws MathArithmeticException if {@code v} is the null vector.
+     */
     public FieldVector<T> projection(FieldVector<T> v)
         throws DimensionMismatchException, MathArithmeticException {
         return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
@@ -786,7 +859,12 @@ public class ArrayFieldVector<T extends 
         return new ArrayFieldVector<T>(field, out, false);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws OutOfRangeException if the index is not valid.
+     * @throws NotPositiveException if the number of elements is not positive.
+     */
     public FieldVector<T> getSubVector(int index, int n)
         throws OutOfRangeException, NotPositiveException {
         if (n < 0) {
@@ -811,7 +889,11 @@ public class ArrayFieldVector<T extends 
         }
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws OutOfRangeException if the index is not valid.
+     */
     public void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException
{
         try {
             try {



Mime
View raw message