Skip to content

Commit 3d4f7ad

Browse files
committed
Address PR comments
Signed-off-by: Ketan Verma <ketan9495@gmail.com>
1 parent bf37f5f commit 3d4f7ad

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

libs/common/src/main/java/org/opensearch/common/round/BidirectionalLinearSearcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BidirectionalLinearSearcher implements Roundable {
2727
private final long[] ascending;
2828
private final long[] descending;
2929

30-
public BidirectionalLinearSearcher(long[] values, int size) {
30+
BidirectionalLinearSearcher(long[] values, int size) {
3131
assert size > 0 : "at least one value must be present";
3232

3333
int len = (size + 1) >>> 1; // rounded-up to handle odd number of values

libs/common/src/main/java/org/opensearch/common/round/BinarySearcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BinarySearcher implements Roundable {
2222
private final long[] values;
2323
private final int size;
2424

25-
public BinarySearcher(long[] values, int size) {
25+
BinarySearcher(long[] values, int size) {
2626
assert size > 0 : "at least one value must be present";
2727

2828
this.values = values;

libs/common/src/main/java/org/opensearch/common/round/RoundableFactory.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
package org.opensearch.common.round;
1010

11+
import org.opensearch.common.annotation.InternalApi;
12+
1113
/**
1214
* Factory class to create and return the fastest implementation of {@link Roundable}.
15+
*
16+
* @opensearch.internal
1317
*/
14-
public class RoundableFactory {
18+
@InternalApi
19+
public final class RoundableFactory {
1520
/**
1621
* The maximum limit up to which linear search is used, otherwise binary search is used.
1722
* This is because linear search is much faster on small arrays.

server/src/main/java/org/opensearch/common/Rounding.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ protected Prepared maybeUseArray(long minUtcMillis, long maxUtcMillis, int max)
444444
values = ArrayUtil.grow(values, i + 1);
445445
values[i++] = rounded;
446446
}
447-
return new ArrayRounding(values, i, this);
447+
return new ArrayRounding(RoundableFactory.create(values, i), this);
448448
}
449449
}
450450

@@ -456,8 +456,8 @@ private static class ArrayRounding implements Prepared {
456456
private final Roundable roundable;
457457
private final Prepared delegate;
458458

459-
public ArrayRounding(long[] values, int size, Prepared delegate) {
460-
this.roundable = RoundableFactory.create(values, size);
459+
public ArrayRounding(Roundable roundable, Prepared delegate) {
460+
this.roundable = roundable;
461461
this.delegate = delegate;
462462
}
463463

0 commit comments

Comments
 (0)