commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [1/2] commons-statistics git commit: Unnecessary method calls.
Date Sat, 27 Jan 2018 13:56:47 GMT
Repository: commons-statistics
Updated Branches:
  refs/heads/master 3eb53ba17 -> 9cadb96cb


Unnecessary method calls.


Project: http://git-wip-us.apache.org/repos/asf/commons-statistics/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-statistics/commit/33d1552f
Tree: http://git-wip-us.apache.org/repos/asf/commons-statistics/tree/33d1552f
Diff: http://git-wip-us.apache.org/repos/asf/commons-statistics/diff/33d1552f

Branch: refs/heads/master
Commit: 33d1552f0140d207ba5ce5eab3eb7ec9b743ef28
Parents: 3eb53ba
Author: Gilles Sadowski <gilles@harfang.homelinux.org>
Authored: Sat Jan 27 14:40:25 2018 +0100
Committer: Gilles Sadowski <gilles@harfang.homelinux.org>
Committed: Sat Jan 27 14:40:25 2018 +0100

----------------------------------------------------------------------
 .../commons/statistics/distribution/TDistribution.java | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-statistics/blob/33d1552f/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java
----------------------------------------------------------------------
diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java
b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java
index 07b1fc6..7177308 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java
@@ -103,9 +103,7 @@ public class TDistribution extends AbstractContinuousDistribution {
      */
     @Override
     public double getMean() {
-        final double df = getDegreesOfFreedom();
-
-        if (df > 1) {
+        if (degreesOfFreedom > 1) {
             return 0;
         }
 
@@ -125,13 +123,12 @@ public class TDistribution extends AbstractContinuousDistribution {
      */
     @Override
     public double getVariance() {
-        final double df = getDegreesOfFreedom();
-
-        if (df > 2) {
-            return df / (df - 2);
+        if (degreesOfFreedom > 2) {
+            return degreesOfFreedom / (degreesOfFreedom - 2);
         }
 
-        if (df > 1 && df <= 2) {
+        if (degreesOfFreedom > 1 &&
+            degreesOfFreedom <= 2) {
             return Double.POSITIVE_INFINITY;
         }
 


Mime
View raw message