commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r771076 - in /commons/proper/math/trunk: ./ src/java/org/apache/commons/math/linear/ src/java/org/apache/commons/math/stat/clustering/ src/java/org/apache/commons/math/util/
Date Sun, 03 May 2009 16:28:48 GMT
Author: luc
Date: Sun May  3 16:28:48 2009
New Revision: 771076

URL: http://svn.apache.org/viewvc?rev=771076&view=rev
Log:
fixed various checkstyle and findbugs errors

Modified:
    commons/proper/math/trunk/findbugs-exclude-filter.xml
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixUtils.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/Cluster.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/util/BigReal.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java

Modified: commons/proper/math/trunk/findbugs-exclude-filter.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/findbugs-exclude-filter.xml?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/findbugs-exclude-filter.xml (original)
+++ commons/proper/math/trunk/findbugs-exclude-filter.xml Sun May  3 16:28:48 2009
@@ -110,6 +110,11 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
+    <Class name="org.apache.commons.math.linear.DenseFieldMatrix"/>
+    <Method name="&lt;init>" params="int,int,org.apache.commons.math.FieldElement[][],boolean"
returns="void" />
+    <Bug pattern="EI_EXPOSE_REP2" />
+  </Match>
+  <Match>
     <Class name="org.apache.commons.math.linear.FieldMatrixImpl"/>
     <Method name="&lt;init>" params="org.apache.commons.math.FieldElement[][],boolean"
returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
@@ -142,6 +147,16 @@
     <Method name="getDataRef" params="" returns="org.apache.commons.math.FieldElement[]"
/>
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
+  <Match>
+    <Class name="org.apache.commons.math.stat.clustering.EuclideanIntegerPoint"/>
+    <Method name="&lt;init>" params="int[]" returns="void" />
+    <Bug pattern="EI_EXPOSE_REP2" />
+  </Match>
+  <Match>
+    <Class name="org.apache.commons.math.stat.clustering.EuclideanIntegerPoint"/>
+    <Method name="getPoint" params="" returns="int[]" />
+    <Bug pattern="EI_EXPOSE_REP" />
+  </Match>
 
   <!-- The following cases are intentional unit tests for null parameters -->
   <Match>

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
Sun May  3 16:28:48 2009
@@ -45,6 +45,7 @@
 
     /**
      * Get the elements type from an array.
+     * @param <T> the type of the field elements
      * @param d data array
      * @return field to which array elements belong
      * @exception IllegalArgumentException if array is empty
@@ -62,6 +63,7 @@
 
     /**
      * Get the elements type from an array.
+     * @param <T> the type of the field elements
      * @param d data array
      * @return field to which array elements belong
      * @exception IllegalArgumentException if array is empty
@@ -78,6 +80,8 @@
      * <p>
      * Complete arrays are filled with field.getZero()
      * </p>
+     * @param <T> the type of the field elements
+     * @param field field to which array elements belong
      * @param rows number of rows
      * @param columns number of columns (may be negative to build partial
      * arrays in the same way <code>new Field[rows][]</code> works)
@@ -103,6 +107,8 @@
      * <p>
      * Arrays are filled with field.getZero()
      * </p>
+     * @param <T> the type of the field elements
+     * @param field field to which array elements belong
      * @param length of the array
      * @return a new array
      */

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java
Sun May  3 16:28:48 2009
@@ -57,6 +57,7 @@
  * arrays is negligible for small matrices (about 1%). The gain from cache efficiency leads
  * to up to 3-fold improvements for matrices of moderate to large size.
  * </p>
+ * @param <T> the type of the field elements
  * @version $Revision$ $Date$
  * @since 2.0
  */
@@ -142,7 +143,7 @@
      * @see #DenseFieldMatrix(T[][])
      */
     public DenseFieldMatrix(final int rows, final int columns,
-                           final T[][] blockData, final boolean copyArray)
+                            final T[][] blockData, final boolean copyArray)
         throws IllegalArgumentException {
 
         super(extractField(blockData), rows, columns);
@@ -193,6 +194,7 @@
      * It can be used to provide the array argument of the {@link
      * DenseFieldMatrix#DenseFieldMatrix(int, int, T[][], boolean)} constructor.
      * </p>
+     * @param <T> the type of the field elements
      * @param rawData data array in raw layout
      * @return a new data array containing the same entries but in blocks layout
      * @exception IllegalArgumentException if <code>rawData</code> is not rectangular
@@ -252,6 +254,8 @@
      * This method can be used to create the array argument of the {@link
      * DenseFieldMatrix#DenseFieldMatrix(int, int, T[][], boolean)} constructor.
      * </p>
+     * @param <T> the type of the field elements
+     * @param field field to which the elements belong
      * @param rows  the number of rows in the new matrix
      * @param columns  the number of columns in the new matrix
      * @return a new data array in blocks layout

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixUtils.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixUtils.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixUtils.java Sun
May  3 16:28:48 2009
@@ -54,6 +54,7 @@
     /**
      * Returns a {@link FieldMatrix} with specified dimensions.
      * <p>The matrix elements are all set to field.getZero().</p>
+     * @param <T> the type of the field elements
      * @param field field to which the matrix elements belong
      * @param rows number of rows of the matrix
      * @param columns number of columns of the matrix
@@ -88,6 +89,7 @@
      * <p>
      * The input array is copied, not referenced.
      * </p>
+     * @param <T> the type of the field elements
      * @param data input array
      * @return  RealMatrix containing the values of the array
      * @throws IllegalArgumentException if <code>data</code> is not rectangular
@@ -119,6 +121,8 @@
     /**
      * Returns <code>dimension x dimension</code> identity matrix.
      *
+     * @param <T> the type of the field elements
+     * @param field field to which the elements belong
      * @param dimension dimension of identity matrix to generate
      * @return identity matrix
      * @throws IllegalArgumentException if dimension is not positive
@@ -177,6 +181,7 @@
     /**
      * Returns a diagonal matrix with specified elements.
      *
+     * @param <T> the type of the field elements
      * @param diagonal diagonal elements of the matrix (the array elements
      * will be copied)
      * @return diagonal matrix
@@ -277,6 +282,7 @@
     /**
      * Creates a {@link FieldVector} using the data from the input array. 
      * 
+     * @param <T> the type of the field elements
      * @param data the input data
      * @return a data.length FieldVector
      * @throws IllegalArgumentException if <code>data</code> is empty
@@ -308,6 +314,7 @@
      * Creates a row {@link FieldMatrix} using the data from the input
      * array. 
      * 
+     * @param <T> the type of the field elements
      * @param rowData the input row data
      * @return a 1 x rowData.length FieldMatrix
      * @throws IllegalArgumentException if <code>rowData</code> is empty
@@ -406,6 +413,7 @@
      * Creates a column {@link FieldMatrix} using the data from the input
      * array.
      * 
+     * @param <T> the type of the field elements
      * @param columnData  the input column data
      * @return a columnData x 1 FieldMatrix
      * @throws IllegalArgumentException if <code>columnData</code> is empty

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/Cluster.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/Cluster.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/Cluster.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/Cluster.java
Sun May  3 16:28:48 2009
@@ -30,13 +30,13 @@
 public class Cluster<T extends Clusterable<T>> implements Serializable {
 
     /** Serializable version identifier. */
-    private static final long serialVersionUID = -1741417096265465690L;
+    private static final long serialVersionUID = -3442297081515880464L;
 
     /** The points contained in this cluster. */
-    final List<T> points;
+    private final List<T> points;
 
     /** Center of the cluster. */
-    final T center;
+    private final T center;
 
     /**
      * Build a cluster centered at a specified point.

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/EuclideanIntegerPoint.java
Sun May  3 16:28:48 2009
@@ -35,6 +35,8 @@
     private final int[] point;
 
     /**
+     * Build an instance wrapping an integer array.
+     * <p>The wrapped array is referenced, it is <em>not</em> copied.</p>
      * @param point the n-dimensional point in integer space
      */
     public EuclideanIntegerPoint(final int[] point) {
@@ -42,7 +44,8 @@
     }
 
     /**
-     * Returns the n-dimensional point in integer space
+     * Get the n-dimensional point in integer space.
+     * @return a reference (not a copy!) to the wrapped array
      */
     public int[] getPoint() {
         return point;

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java
Sun May  3 16:28:48 2009
@@ -24,6 +24,7 @@
 
 /**
  * Clustering algorithm based on David Arthur and Sergei Vassilvitski k-means++ algorithm.
+ * @param <T> type of the points to cluster
  * @see <a href="http://en.wikipedia.org/wiki/K-means%2B%2B">K-means++ (wikipedia)</a>
  * @version $Revision$ $Date$
  * @since 2.0
@@ -79,6 +80,7 @@
     /**
      * Adds the given points to the closest {@link Cluster}.
      * 
+     * @param <T> type of the points to cluster
      * @param clusters the {@link Cluster}s to add the points to
      * @param points the points to add to the given {@link Cluster}s
      */
@@ -93,6 +95,7 @@
     /**
      * Use K-means++ to choose the initial centers.
      * 
+     * @param <T> type of the points to cluster
      * @param points the points to choose the initial centers from
      * @param k the number of centers to choose
      * @param random random generator to use
@@ -140,6 +143,7 @@
     /**
      * Returns the nearest {@link Cluster} to the given point
      * 
+     * @param <T> type of the points to cluster
      * @param clusters the {@link Cluster}s to search
      * @param point the point to find the nearest {@link Cluster} for
      * @return the nearest {@link Cluster} to the given point

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/util/BigReal.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/BigReal.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/util/BigReal.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/util/BigReal.java Sun May 
3 16:28:48 2009
@@ -206,6 +206,25 @@
     }
 
     /** {@inheritDoc} */
+    @Override
+    public boolean equals(Object other) {
+        try {
+            if (other == null) {
+                return false;
+            }
+            return d.equals(((BigReal) other).d);
+        } catch (ClassCastException cce) {
+            return false;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int hashCode() {
+        return d.hashCode();
+    }
+
+    /** {@inheritDoc} */
     public Field<BigReal> getField() {
         return BigRealField.getInstance();
     }

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java Sun May
 3 16:28:48 2009
@@ -59,7 +59,10 @@
     /** 2 &pi;. */
     private static final double TWO_PI = 2 * Math.PI;
 
+    /** Gap between NaN and regular numbers. */
     private static final int NAN_GAP = 4 * 1024 * 1024;
+
+    /** Offset to order signed double numbers lexicographically. */
     private static final long SGN_MASK = 0x8000000000000000L;
 
     /**

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java?rev=771076&r1=771075&r2=771076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToFieldHashMap.java
Sun May  3 16:28:48 2009
@@ -35,13 +35,14 @@
  * {@link #iterator()} are fail-fast: they throw a
  * <code>ConcurrentModificationException</code> when they detect the map has
been
  * modified during iteration.</p>
+ * @param <T> the type of the field elements
  * @version $Revision: 746578 $ $Date: 2009-02-21 12:01:14 -0800 (Sat, 21 Feb 2009) $
  * @since 2.0
  */
 public class OpenIntToFieldHashMap<T extends FieldElement<T>> implements Serializable
{
     
     /** Serializable version identifier. */
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = -9179080286849120720L;
 
     /** Load factor for the map. */
     private static final float LOAD_FACTOR = 0.5f;



Mime
View raw message