From f38a015be52734c40096fe30d50337b4b4d1ad1c Mon Sep 17 00:00:00 2001 From: Stas Levin Date: Wed, 4 Jan 2017 09:23:55 +0200 Subject: [PATCH] [BEAM-1223][Followup] Reduced visibility for Sum,Min,Max,Mean combine Fns. --- .../org/apache/beam/sdk/transforms/Max.java | 27 +++---------------- .../org/apache/beam/sdk/transforms/Mean.java | 12 +-------- .../org/apache/beam/sdk/transforms/Min.java | 27 +++---------------- .../org/apache/beam/sdk/transforms/Sum.java | 21 +++------------ 4 files changed, 12 insertions(+), 75 deletions(-) diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Max.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Max.java index f6460b6d12fc..91851bcbe9f6 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Max.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Max.java @@ -212,14 +212,7 @@ Combine.PerKey perKey(ComparatorT comparator) { ///////////////////////////////////////////////////////////////////////////// - /** - * A {@code CombineFn} that computes the maximum of a collection of elements of type {@code T} - * using an arbitrary {@link Comparator}, useful as an argument to {@link Combine#globally} or - * {@link Combine#perKey}. - * - * @param the type of the values being compared - */ - public static class MaxFn extends BinaryCombineFn { + private static class MaxFn extends BinaryCombineFn { private final T identity; private final Comparator comparator; @@ -248,11 +241,7 @@ public void populateDisplayData(DisplayData.Builder builder) { } } - /** - * A {@code CombineFn} that computes the maximum of a collection of {@code Integer}s, useful as an - * argument to {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class MaxIntegerFn extends Combine.BinaryCombineIntegerFn { + private static class MaxIntegerFn extends Combine.BinaryCombineIntegerFn { @Override public int apply(int left, int right) { @@ -265,11 +254,7 @@ public int identity() { } } - /** - * A {@code CombineFn} that computes the maximum of a collection of {@code Long}s, useful as an - * argument to {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class MaxLongFn extends Combine.BinaryCombineLongFn { + private static class MaxLongFn extends Combine.BinaryCombineLongFn { @Override public long apply(long left, long right) { @@ -282,11 +267,7 @@ public long identity() { } } - /** - * A {@code CombineFn} that computes the maximum of a collection of {@code Double}s, useful as an - * argument to {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class MaxDoubleFn extends Combine.BinaryCombineDoubleFn { + private static class MaxDoubleFn extends Combine.BinaryCombineDoubleFn { @Override public double apply(double left, double right) { diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java index 17dbe6cf4291..5e7c00317a06 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java @@ -101,17 +101,7 @@ Combine.AccumulatingCombineFn, Double> of() { ///////////////////////////////////////////////////////////////////////////// - /** - * A {@code Combine.CombineFn} that computes the arithmetic mean - * (a.k.a. average) of an {@code Iterable} of numbers of type - * {@code N}, useful as an argument to {@link Combine#globally} or - * {@link Combine#perKey}. - * - *

Returns {@code Double.NaN} if combining zero elements. - * - * @param the type of the {@code Number}s being combined - */ - public static class MeanFn + private static class MeanFn extends Combine.AccumulatingCombineFn, Double> { /** * Constructs a combining function that computes the mean over diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Min.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Min.java index 47d831ceb7e1..109f4e5cb5bc 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Min.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Min.java @@ -212,14 +212,7 @@ Combine.PerKey perKey(ComparatorT comparator) { ///////////////////////////////////////////////////////////////////////////// - /** - * A {@code CombineFn} that computes the maximum of a collection of elements of type {@code T} - * using an arbitrary {@link Comparator}, useful as an argument to {@link Combine#globally} or - * {@link Combine#perKey}. - * - * @param the type of the values being compared - */ - public static class MinFn extends BinaryCombineFn { + private static class MinFn extends BinaryCombineFn { private final T identity; private final Comparator comparator; @@ -248,11 +241,7 @@ public void populateDisplayData(DisplayData.Builder builder) { } } - /** - * A {@code CombineFn} that computes the minimum of a collection of {@code Integer}s, useful as an - * argument to {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class MinIntegerFn extends Combine.BinaryCombineIntegerFn { + private static class MinIntegerFn extends Combine.BinaryCombineIntegerFn { @Override public int apply(int left, int right) { @@ -265,11 +254,7 @@ public int identity() { } } - /** - * A {@code CombineFn} that computes the minimum of a collection of {@code Long}s, useful as an - * argument to {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class MinLongFn extends Combine.BinaryCombineLongFn { + private static class MinLongFn extends Combine.BinaryCombineLongFn { @Override public long apply(long left, long right) { @@ -282,11 +267,7 @@ public long identity() { } } - /** - * A {@code CombineFn} that computes the minimum of a collection of {@code Double}s, useful as an - * argument to {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class MinDoubleFn extends Combine.BinaryCombineDoubleFn { + private static class MinDoubleFn extends Combine.BinaryCombineDoubleFn { @Override public double apply(double left, double right) { diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Sum.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Sum.java index 504473240df5..ccade4db703a 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Sum.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Sum.java @@ -140,12 +140,7 @@ public static Combine.BinaryCombineLongFn ofLongs() { ///////////////////////////////////////////////////////////////////////////// - /** - * A {@code SerializableFunction} that computes the sum of an - * {@code Iterable} of {@code Integer}s, useful as an argument to - * {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class SumIntegerFn extends Combine.BinaryCombineIntegerFn { + private static class SumIntegerFn extends Combine.BinaryCombineIntegerFn { @Override public int apply(int a, int b) { @@ -158,12 +153,7 @@ public int identity() { } } - /** - * A {@code SerializableFunction} that computes the sum of an - * {@code Iterable} of {@code Long}s, useful as an argument to - * {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class SumLongFn extends Combine.BinaryCombineLongFn { + private static class SumLongFn extends Combine.BinaryCombineLongFn { @Override public long apply(long a, long b) { @@ -176,12 +166,7 @@ public long identity() { } } - /** - * A {@code SerializableFunction} that computes the sum of an - * {@code Iterable} of {@code Double}s, useful as an argument to - * {@link Combine#globally} or {@link Combine#perKey}. - */ - public static class SumDoubleFn extends Combine.BinaryCombineDoubleFn { + private static class SumDoubleFn extends Combine.BinaryCombineDoubleFn { @Override public double apply(double a, double b) {