commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1334421 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/ListUnivariateImpl.java
Date Sat, 05 May 2012 13:41:04 GMT
Author: tn
Date: Sat May  5 13:41:04 2012
New Revision: 1334421

URL: http://svn.apache.org/viewvc?rev=1334421&view=rev
Log:
[MATH-759] cleanup unit test ListUnivariateImpl.

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/ListUnivariateImpl.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/ListUnivariateImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/ListUnivariateImpl.java?rev=1334421&r1=1334420&r2=1334421&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/ListUnivariateImpl.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/stat/descriptive/ListUnivariateImpl.java
Sat May  5 13:41:04 2012
@@ -81,10 +81,9 @@ public class ListUnivariateImpl extends 
         // take into account only the last n elements of the list
         // as definied by windowSize
 
-        if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
-            windowSize < list.size())
-        {
-            length = list.size() - FastMath.max(0, list.size() - windowSize);
+        final int wSize = getWindowSize();
+        if (wSize != DescriptiveStatistics.INFINITE_WINDOW && wSize < list.size())
{
+            length = list.size() - FastMath.max(0, list.size() - wSize);
         }
 
         // Create an array to hold all values
@@ -104,10 +103,9 @@ public class ListUnivariateImpl extends 
 
         int calcIndex = index;
 
-        if (windowSize != DescriptiveStatistics.INFINITE_WINDOW &&
-            windowSize < list.size())
-        {
-            calcIndex = (list.size() - windowSize) + index;
+        final int wSize = getWindowSize();
+        if (wSize != DescriptiveStatistics.INFINITE_WINDOW && wSize < list.size())
{
+            calcIndex = (list.size() - wSize) + index;
         }
 
 
@@ -125,9 +123,10 @@ public class ListUnivariateImpl extends 
     public long getN() {
         int n = 0;
 
-        if (windowSize != DescriptiveStatistics.INFINITE_WINDOW) {
-            if (list.size() > windowSize) {
-                n = windowSize;
+        final int wSize = getWindowSize();
+        if (wSize != DescriptiveStatistics.INFINITE_WINDOW) {
+            if (list.size() > wSize) {
+                n = wSize;
             } else {
                 n = list.size();
             }
@@ -194,8 +193,8 @@ public class ListUnivariateImpl extends 
 
     /** {@inheritDoc} */
     @Override
-    public synchronized void setWindowSize(int windowSize) {
-        this.windowSize = windowSize;
+    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;
@@ -204,10 +203,4 @@ public class ListUnivariateImpl extends 
         }
     }
 
-    /** {@inheritDoc} */
-    @Override
-    public synchronized int getWindowSize() {
-        return windowSize;
-    }
-
 }



Mime
View raw message