[codestyle] Improve code style of PoissonSampler

This closes #1476


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/5b27cea2
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/5b27cea2
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/5b27cea2

Branch: refs/heads/master
Commit: 5b27cea20528dc28ff608677e6979d7f337560c6
Parents: 54b89b9
Author: zhangminglei <minglei.l.zh...@intel.com>
Authored: Fri Dec 25 00:20:02 2015 +0800
Committer: Fabian Hueske <fhue...@apache.org>
Committed: Thu Jan 7 17:00:56 2016 +0100

----------------------------------------------------------------------
 .../org/apache/flink/api/java/sampling/PoissonSampler.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/5b27cea2/flink-java/src/main/java/org/apache/flink/api/java/sampling/PoissonSampler.java
----------------------------------------------------------------------
diff --git 
a/flink-java/src/main/java/org/apache/flink/api/java/sampling/PoissonSampler.java
 
b/flink-java/src/main/java/org/apache/flink/api/java/sampling/PoissonSampler.java
index e132882..dd9a650 100644
--- 
a/flink-java/src/main/java/org/apache/flink/api/java/sampling/PoissonSampler.java
+++ 
b/flink-java/src/main/java/org/apache/flink/api/java/sampling/PoissonSampler.java
@@ -111,7 +111,7 @@ public class PoissonSampler<T> extends RandomSampler<T> {
                                return currentElement;
                        }
                        
-                       public int poisson_ge1(double p){
+                       public int poisson_ge1(double p) {
                                // sample 'k' from Poisson(p), conditioned to k 
>= 1.
                                double q = Math.pow(Math.E, -p);
                                // simulate a poisson trial such that k >= 1.
@@ -129,13 +129,13 @@ public class PoissonSampler<T> extends RandomSampler<T> {
                        private void skipGapElements(int num) {
                                // skip the elements that occurrence number is 
zero.
                                int elementCount = 0;
-                               while (input.hasNext() && elementCount < num){
+                               while (input.hasNext() && elementCount < num) {
                                        currentElement = input.next();
                                        elementCount++;
                                }
                        }
                        
-                       private void samplingProcess(){
+                       private void samplingProcess() {
                                if (fraction <= THRESHOLD) {
                                        double u = 
Math.max(random.nextDouble(), EPSILON);
                                        int gap = (int) (Math.log(u) / 
-fraction);
@@ -145,7 +145,7 @@ public class PoissonSampler<T> extends RandomSampler<T> {
                                                currentCount = 
poisson_ge1(fraction);
                                        }
                                } else {
-                                       while (input.hasNext()){
+                                       while (input.hasNext()) {
                                                currentElement = input.next();
                                                currentCount = 
poissonDistribution.sample();
                                                if (currentCount > 0) {

Reply via email to