You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2020/06/06 21:55:02 UTC

[commons-math] 02/02: Formatting.

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit d8ad317f946b3070c0601ec80127e693069309da
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Sat Jun 6 12:50:15 2020 +0200

    Formatting.
    
    Closes #142.
---
 .../math4/stat/descriptive/ListUnivariateImpl.java   | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java
index 132c4a3..3dfeda1 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java
@@ -30,21 +30,18 @@ import org.apache.commons.math4.util.NumberTransformer;
 /**
  */
 public class ListUnivariateImpl extends DescriptiveStatistics implements Serializable {
-
     /** Serializable version identifier */
     private static final long serialVersionUID = -8837442489133392138L;
-
     /**
      * Holds a reference to a list - GENERICs are going to make
      * our lives easier here as we could only accept List<Number>
      */
     protected List<Object> list;
-
     /** Number Transformer maps Objects to Number for us. */
     protected NumberTransformer transformer;
 
     /**
-     * No argument Constructor
+     * No argument constructor
      */
     public ListUnivariateImpl(){
         this(new ArrayList<>());
@@ -64,7 +61,6 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali
      * @param transformer the number transformer used to convert the list items.
      */
     public ListUnivariateImpl(List<Object> list, NumberTransformer transformer) {
-        super();
         this.list = list;
         this.transformer = transformer;
     }
@@ -72,7 +68,6 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali
     /** {@inheritDoc} */
     @Override
     public double[] getValues() {
-
         int length = list.size();
 
         // If the window size is not INFINITE_WINDOW AND
@@ -97,9 +92,7 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali
     /** {@inheritDoc} */
     @Override
     public double getElement(int index) {
-
         double value = Double.NaN;
-
         int calcIndex = index;
 
         final int wSize = getWindowSize();
@@ -132,6 +125,7 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali
         } else {
             n = list.size();
         }
+
         return n;
     }
 
@@ -166,11 +160,12 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali
      */
     @Override
     public double apply(UnivariateStatistic stat) {
-        double[] v = this.getValues();
+        final double[] v = this.getValues();
 
         if (v != null) {
             return stat.evaluate(v, 0, v.length);
         }
+
         return Double.NaN;
     }
 
@@ -194,12 +189,11 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali
     @Override
     public void setWindowSize(int windowSize) {
         super.setWindowSize(windowSize);
-        //Discard elements from the front of the list if the windowSize is less than
-        // the size of the list.
-        int extra = list.size() - windowSize;
+        // Discard elements from the front of the list if "windowSize"
+        // is less than the size of the list.
+        final int extra = list.size() - windowSize;
         if (extra > 0) {
             list.subList(0, extra).clear();
         }
     }
-
 }