incubator-droids-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1463848 - in /incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay: GaussianRandomDelayTimer.java RandomDelayTimer.java
Date Wed, 03 Apr 2013 07:45:48 GMT
Author: tobr
Date: Wed Apr  3 07:45:48 2013
New Revision: 1463848

URL: http://svn.apache.org/r1463848
Log:
cleaned up the code
changed to private members and created getter/setters

Modified:
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/GaussianRandomDelayTimer.java
    incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/RandomDelayTimer.java

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/GaussianRandomDelayTimer.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/GaussianRandomDelayTimer.java?rev=1463848&r1=1463847&r2=1463848&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/GaussianRandomDelayTimer.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/GaussianRandomDelayTimer.java
Wed Apr  3 07:45:48 2013
@@ -45,9 +45,9 @@ public class GaussianRandomDelayTimer ex
     public long getDelayMillis() {
         double delay;
         do {
-            delay = (random.nextGaussian() + 1) / 2;
+            delay = (getRandom().nextGaussian() + 1) / 2;
         } while (delay < 0 || delay > 1);
-        return (long) (delay * delaySpread + minimumDelay);
+        return (long) (delay * getDelaySpread() + getMinimumDelay());
     }
 
 }

Modified: incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/RandomDelayTimer.java
URL: http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/RandomDelayTimer.java?rev=1463848&r1=1463847&r2=1463848&view=diff
==============================================================================
--- incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/RandomDelayTimer.java
(original)
+++ incubator/droids/branches/0.2.x-cleanup/droids-core/src/main/java/org/apache/droids/delay/RandomDelayTimer.java
Wed Apr  3 07:45:48 2013
@@ -24,9 +24,9 @@ import java.util.Random;
  */
 public class RandomDelayTimer implements DelayTimer {
 
-    protected final Random random;
-    protected int minimumDelay;
-    protected int delaySpread;
+    private final Random random;
+    private int minimumDelay;
+    private int delaySpread;
 
     /**
      * Creates a new random delay generator,
@@ -91,4 +91,13 @@ public class RandomDelayTimer implements
         this.delaySpread = delaySpread;
     }
 
+    /**
+     * Return the random delay value
+     *
+     * @return random
+     */
+    protected Random getRandom() {
+        return random;
+    }
+
 }



Mime
View raw message