This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
The following commit(s) were added to refs/heads/master by this push:
new 2ed8d31 Rename compose method to avoid compile warnings
2ed8d31 is described below
commit 2ed8d3155747913a3bd5355dfc24d5ec33d5605f
Author: Alex Herbert <[email protected]>
AuthorDate: Sun Aug 18 15:15:31 2024 +0100
Rename compose method to avoid compile warnings
The use of the same name for the compose function generated a
'potentially ambiguous' compile warning.
---
.../statistics/descriptive/DoubleStatistics.java | 3 ++-
.../commons/statistics/descriptive/IntStatistics.java | 6 +++---
.../commons/statistics/descriptive/LongStatistics.java | 6 +++---
.../commons/statistics/descriptive/Statistics.java | 6 +++---
.../commons/statistics/descriptive/StatisticsTest.java | 18 +++++++++---------
5 files changed, 20 insertions(+), 19 deletions(-)
diff --git
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/DoubleStatistics.java
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/DoubleStatistics.java
index 44bcb90..5a4b329 100644
---
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/DoubleStatistics.java
+++
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/DoubleStatistics.java
@@ -277,7 +277,8 @@ public final class DoubleStatistics implements
DoubleConsumer {
this.sumOfSquares = sumOfSquares;
this.sumOfLogs = sumOfLogs;
this.config = config;
- consumer = Statistics.compose(min, max, moment, sum, product,
sumOfSquares, sumOfLogs);
+ consumer = Statistics.composeDoubleConsumers(min, max, moment, sum,
product,
+ sumOfSquares, sumOfLogs);
}
/**
diff --git
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/IntStatistics.java
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/IntStatistics.java
index 35b9248..67c9f30 100644
---
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/IntStatistics.java
+++
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/IntStatistics.java
@@ -248,8 +248,8 @@ public final class IntStatistics implements IntConsumer {
this.config = config;
// The final consumer should never be null as the builder is created
// with at least one statistic.
- consumer = Statistics.compose(min, max, sum, sumOfSquares,
- composeAsInt(moment, product,
sumOfLogs));
+ consumer = Statistics.composeIntConsumers(min, max, sum, sumOfSquares,
+ composeAsInt(moment,
product, sumOfLogs));
}
/**
@@ -260,7 +260,7 @@ public final class IntStatistics implements IntConsumer {
* @return a composed consumer (or null)
*/
private static IntConsumer composeAsInt(DoubleConsumer... consumers) {
- final DoubleConsumer c = Statistics.compose(consumers);
+ final DoubleConsumer c = Statistics.composeDoubleConsumers(consumers);
if (c != null) {
return c::accept;
}
diff --git
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/LongStatistics.java
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/LongStatistics.java
index 3255daf..a6f7e04 100644
---
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/LongStatistics.java
+++
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/LongStatistics.java
@@ -248,8 +248,8 @@ public final class LongStatistics implements LongConsumer {
this.config = config;
// The final consumer should never be null as the builder is created
// with at least one statistic.
- consumer = Statistics.compose(min, max, sum, sumOfSquares,
- composeAsLong(moment, product,
sumOfLogs));
+ consumer = Statistics.composeLongConsumers(min, max, sum, sumOfSquares,
+ composeAsLong(moment,
product, sumOfLogs));
}
/**
@@ -260,7 +260,7 @@ public final class LongStatistics implements LongConsumer {
* @return a composed consumer (or null)
*/
private static LongConsumer composeAsLong(DoubleConsumer... consumers) {
- final DoubleConsumer c = Statistics.compose(consumers);
+ final DoubleConsumer c = Statistics.composeDoubleConsumers(consumers);
if (c != null) {
return c::accept;
}
diff --git
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/Statistics.java
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/Statistics.java
index f3c7e8d..90bf452 100644
---
a/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/Statistics.java
+++
b/commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/Statistics.java
@@ -178,7 +178,7 @@ final class Statistics {
* @param consumers Consumers.
* @return a composed consumer (or null)
*/
- static DoubleConsumer compose(DoubleConsumer... consumers) {
+ static DoubleConsumer composeDoubleConsumers(DoubleConsumer... consumers) {
DoubleConsumer action = DOUBLE_NOOP;
for (final DoubleConsumer consumer : consumers) {
if (consumer != null) {
@@ -195,7 +195,7 @@ final class Statistics {
* @param consumers Consumers.
* @return a composed consumer (or null)
*/
- static IntConsumer compose(IntConsumer... consumers) {
+ static IntConsumer composeIntConsumers(IntConsumer... consumers) {
IntConsumer action = INT_NOOP;
for (final IntConsumer consumer : consumers) {
if (consumer != null) {
@@ -212,7 +212,7 @@ final class Statistics {
* @param consumers Consumers.
* @return a composed consumer (or null)
*/
- static LongConsumer compose(LongConsumer... consumers) {
+ static LongConsumer composeLongConsumers(LongConsumer... consumers) {
LongConsumer action = LONG_NOOP;
for (final LongConsumer consumer : consumers) {
if (consumer != null) {
diff --git
a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/StatisticsTest.java
b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/StatisticsTest.java
index d1dc7e1..f939a16 100644
---
a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/StatisticsTest.java
+++
b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/StatisticsTest.java
@@ -43,13 +43,13 @@ class StatisticsTest {
@Test
void testComposeDoubleConsumers() {
- Assertions.assertNull(Statistics.compose((DoubleConsumer) null));
- Assertions.assertNull(Statistics.compose((DoubleConsumer) null,
(DoubleConsumer) null));
+
Assertions.assertNull(Statistics.composeDoubleConsumers((DoubleConsumer) null));
+
Assertions.assertNull(Statistics.composeDoubleConsumers((DoubleConsumer) null,
(DoubleConsumer) null));
final double[] v1 = {0};
final double[] v2 = {0};
final DoubleConsumer c1 = x -> v1[0] = x;
final DoubleConsumer c2 = x -> v2[0] = x;
- final DoubleConsumer combined = Statistics.compose(c1, c2);
+ final DoubleConsumer combined = Statistics.composeDoubleConsumers(c1,
c2);
final double y = 42;
combined.accept(y);
Assertions.assertEquals(y, v1[0]);
@@ -72,13 +72,13 @@ class StatisticsTest {
@Test
void testComposeIntConsumers() {
- Assertions.assertNull(Statistics.compose((IntConsumer) null));
- Assertions.assertNull(Statistics.compose((IntConsumer) null,
(IntConsumer) null));
+ Assertions.assertNull(Statistics.composeIntConsumers((IntConsumer)
null));
+ Assertions.assertNull(Statistics.composeIntConsumers((IntConsumer)
null, (IntConsumer) null));
final int[] v1 = {0};
final int[] v2 = {0};
final IntConsumer c1 = x -> v1[0] = x;
final IntConsumer c2 = x -> v2[0] = x;
- final IntConsumer combined = Statistics.compose(c1, c2);
+ final IntConsumer combined = Statistics.composeIntConsumers(c1, c2);
final int y = 42;
combined.accept(y);
Assertions.assertEquals(y, v1[0]);
@@ -101,13 +101,13 @@ class StatisticsTest {
@Test
void testComposeLongConsumers() {
- Assertions.assertNull(Statistics.compose((LongConsumer) null));
- Assertions.assertNull(Statistics.compose((LongConsumer) null,
(LongConsumer) null));
+ Assertions.assertNull(Statistics.composeLongConsumers((LongConsumer)
null));
+ Assertions.assertNull(Statistics.composeLongConsumers((LongConsumer)
null, (LongConsumer) null));
final long[] v1 = {0};
final long[] v2 = {0};
final LongConsumer c1 = x -> v1[0] = x;
final LongConsumer c2 = x -> v2[0] = x;
- final LongConsumer combined = Statistics.compose(c1, c2);
+ final LongConsumer combined = Statistics.composeLongConsumers(c1, c2);
final long y = 42;
combined.accept(y);
Assertions.assertEquals(y, v1[0]);