Skip to content

Add "final" to method parameters where they were missing. #664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ under the License.
<!-- System-wide properties -->
<maven.version>3.6.3</maven.version>
<java.version>21</java.version>
<jvm-ffm-flag>--enable-preview</jvm-ffm-flag>
<jvm-arguments>--enable-preview</jvm-arguments>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<argLine>-Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 ${jvm-ffm-flag}</argLine>
<argLine>-Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 ${jvm-arguments}</argLine>
<charset.encoding>UTF-8</charset.encoding>
<project.build.sourceEncoding>${charset.encoding}</project.build.sourceEncoding>
<project.build.resourceEncoding>${charset.encoding}</project.build.resourceEncoding>
Expand Down Expand Up @@ -164,7 +164,7 @@ under the License.
<version>${maven-compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>${jvm-ffm-flag}</arg>
<arg>${jvm-arguments}</arg>
</compilerArgs>
</configuration>
</plugin>
Expand Down Expand Up @@ -239,7 +239,7 @@ under the License.
<show>public</show>
<doclint>all,-missing</doclint>
<additionalJOptions>
<additionalJOption>${jvm-ffm-flag}</additionalJOption>
<additionalJOption>${jvm-arguments}</additionalJOption>
</additionalJOptions>
</configuration>
<executions>
Expand Down Expand Up @@ -285,7 +285,7 @@ under the License.
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-failsafe-plugins.version}</version>
<configuration>
<argLine>${jvm-ffm-flag}</argLine>
<argLine>${jvm-arguments}</argLine>
<trimStackTrace>false</trimStackTrace>
<useManifestOnlyJar>false</useManifestOnlyJar>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface DoublesSortedView extends SortedView {
* @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getCDF(double[] splitPoints, QuantileSearchCriteria searchCrit) {
default double[] getCDF(final double[] splitPoints, final QuantileSearchCriteria searchCrit) {
QuantilesUtil.checkDoublesSplitPointsOrder(splitPoints);
final int len = splitPoints.length + 1;
final double[] buckets = new double[len];
Expand Down Expand Up @@ -129,7 +129,7 @@ default double[] getCDF(double[] splitPoints, QuantileSearchCriteria searchCrit)
* @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getPMF(double[] splitPoints, QuantileSearchCriteria searchCrit) {
default double[] getPMF(final double[] splitPoints, final QuantileSearchCriteria searchCrit) {
final double[] buckets = getCDF(splitPoints, searchCrit);
final int len = buckets.length;
for (int i = len; i-- > 1; ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface FloatsSortedView extends SortedView {
* @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getCDF(float[] splitPoints, QuantileSearchCriteria searchCrit) {
default double[] getCDF(final float[] splitPoints, final QuantileSearchCriteria searchCrit) {
QuantilesUtil.checkFloatsSplitPointsOrder(splitPoints);
final int len = splitPoints.length + 1;
final double[] buckets = new double[len];
Expand Down Expand Up @@ -129,7 +129,7 @@ default double[] getCDF(float[] splitPoints, QuantileSearchCriteria searchCrit)
* @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getPMF(float[] splitPoints, QuantileSearchCriteria searchCrit) {
default double[] getPMF(final float[] splitPoints, final QuantileSearchCriteria searchCrit) {
final double[] buckets = getCDF(splitPoints, searchCrit);
final int len = buckets.length;
for (int i = len; i-- > 1; ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface LongsSortedView extends SortedView {
* @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getCDF(long[] splitPoints, QuantileSearchCriteria searchCrit) {
default double[] getCDF(final long[] splitPoints, final QuantileSearchCriteria searchCrit) {
QuantilesUtil.checkLongsSplitPointsOrder(splitPoints);
final int len = splitPoints.length + 1;
final double[] buckets = new double[len];
Expand Down Expand Up @@ -129,7 +129,7 @@ default double[] getCDF(long[] splitPoints, QuantileSearchCriteria searchCrit) {
* @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getPMF(long[] splitPoints, QuantileSearchCriteria searchCrit) {
default double[] getPMF(final long[] splitPoints, final QuantileSearchCriteria searchCrit) {
final double[] buckets = getCDF(splitPoints, searchCrit);
final int len = buckets.length;
for (int i = len; i-- > 1; ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface PartitioningFeature<T> {
*
* @return an instance of {@link GenericPartitionBoundaries GenericPartitionBoundaries}.
*/
default GenericPartitionBoundaries<T> getPartitionBoundariesFromNumParts(int numEquallySizedParts) {
default GenericPartitionBoundaries<T> getPartitionBoundariesFromNumParts(final int numEquallySizedParts) {
return getPartitionBoundariesFromNumParts(numEquallySizedParts, INCLUSIVE);
}

Expand Down Expand Up @@ -106,7 +106,7 @@ GenericPartitionBoundaries<T> getPartitionBoundariesFromNumParts(
*
* @return an instance of {@link GenericPartitionBoundaries GenericPartitionBoundaries}.
*/
default GenericPartitionBoundaries<T> getPartitionBoundariesFromPartSize(long nominalPartSizeItems) {
default GenericPartitionBoundaries<T> getPartitionBoundariesFromPartSize(final long nominalPartSizeItems) {
return getPartitionBoundariesFromPartSize(nominalPartSizeItems, INCLUSIVE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface QuantilesDoublesAPI extends QuantilesAPI {
* @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getCDF(double[] splitPoints) {
default double[] getCDF(final double[] splitPoints) {
return getCDF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -98,7 +98,7 @@ default double[] getCDF(double[] splitPoints) {
* @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getPMF(double[] splitPoints) {
default double[] getPMF(final double[] splitPoints) {
return getPMF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -150,7 +150,7 @@ default double[] getPMF(double[] splitPoints) {
* @return the approximate quantile given the normalized rank.
* @throws IllegalArgumentException if sketch is empty.
*/
default double getQuantile(double rank) {
default double getQuantile(final double rank) {
return getQuantile(rank, INCLUSIVE);
}

Expand Down Expand Up @@ -207,7 +207,7 @@ default double getQuantile(double rank) {
* @return an array of quantiles corresponding to the given array of normalized ranks.
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getQuantiles(double[] ranks) {
default double[] getQuantiles(final double[] ranks) {
return getQuantiles(ranks, INCLUSIVE);
}

Expand All @@ -230,7 +230,7 @@ default double[] getQuantiles(double[] ranks) {
* @return the normalized rank corresponding to the given quantile
* @throws IllegalArgumentException if sketch is empty.
*/
default double getRank(double quantile) {
default double getRank(final double quantile) {
return getRank(quantile, INCLUSIVE);
}

Expand All @@ -251,7 +251,7 @@ default double getRank(double quantile) {
* @return an array of normalized ranks corresponding to the given array of quantiles.
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getRanks(double[] quantiles) {
default double[] getRanks(final double[] quantiles) {
return getRanks(quantiles, INCLUSIVE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface QuantilesFloatsAPI extends QuantilesAPI {
* @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getCDF(float[] splitPoints) {
default double[] getCDF(final float[] splitPoints) {
return getCDF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -97,7 +97,7 @@ default double[] getCDF(float[] splitPoints) {
* @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getPMF(float[] splitPoints) {
default double[] getPMF(final float[] splitPoints) {
return getPMF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -149,7 +149,7 @@ default double[] getPMF(float[] splitPoints) {
* @return the approximate quantile given the normalized rank.
* @throws IllegalArgumentException if sketch is empty.
*/
default float getQuantile(double rank) {
default float getQuantile(final double rank) {
return getQuantile(rank, INCLUSIVE);
}

Expand Down Expand Up @@ -206,7 +206,7 @@ default float getQuantile(double rank) {
* @return an array of quantiles corresponding to the given array of normalized ranks.
* @throws IllegalArgumentException if sketch is empty.
*/
default float[] getQuantiles(double[] ranks) {
default float[] getQuantiles(final double[] ranks) {
return getQuantiles(ranks, INCLUSIVE);
}

Expand All @@ -229,7 +229,7 @@ default float[] getQuantiles(double[] ranks) {
* @return the normalized rank corresponding to the given quantile.
* @throws IllegalArgumentException if sketch is empty.
*/
default double getRank(float quantile) {
default double getRank(final float quantile) {
return getRank(quantile, INCLUSIVE);
}

Expand All @@ -250,7 +250,7 @@ default double getRank(float quantile) {
* @return an array of normalized ranks corresponding to the given array of quantiles.
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getRanks(float[] quantiles) {
default double[] getRanks(final float[] quantiles) {
return getRanks(quantiles, INCLUSIVE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface QuantilesGenericAPI<T> extends QuantilesAPI, PartitioningFeatur
* @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getCDF(T[] splitPoints) {
default double[] getCDF(final T[] splitPoints) {
return getCDF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -118,7 +118,7 @@ default int getMaxPartitions() {
* @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getPMF(T[] splitPoints) {
default double[] getPMF(final T[] splitPoints) {
return getPMF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -170,7 +170,7 @@ default double[] getPMF(T[] splitPoints) {
* @return the approximate quantile given the normalized rank.
* @throws IllegalArgumentException if sketch is empty.
*/
default T getQuantile(double rank) {
default T getQuantile(final double rank) {
return getQuantile(rank, INCLUSIVE);
}

Expand Down Expand Up @@ -227,7 +227,7 @@ default T getQuantile(double rank) {
* @return an array of quantiles corresponding to the given array of normalized ranks.
* @throws IllegalArgumentException if sketch is empty.
*/
default T[] getQuantiles(double[] ranks) {
default T[] getQuantiles(final double[] ranks) {
return getQuantiles(ranks, INCLUSIVE);
}

Expand All @@ -250,7 +250,7 @@ default T[] getQuantiles(double[] ranks) {
* @return the normalized rank corresponding to the given quantile.
* @throws IllegalArgumentException if sketch is empty.
*/
default double getRank(T quantile) {
default double getRank(final T quantile) {
return getRank(quantile, INCLUSIVE);
}

Expand All @@ -271,7 +271,7 @@ default double getRank(T quantile) {
* @return an array of normalized ranks corresponding to the given array of quantiles.
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getRanks(T[] quantiles) {
default double[] getRanks(final T[] quantiles) {
return getRanks(quantiles, INCLUSIVE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface QuantilesLongsAPI extends QuantilesAPI {
* @return a discrete CDF array of m+1 double ranks (or cumulative probabilities) on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getCDF(long[] splitPoints) {
default double[] getCDF(final long[] splitPoints) {
return getCDF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -98,7 +98,7 @@ default double[] getCDF(long[] splitPoints) {
* @return a PMF array of m+1 probability masses as doubles on the interval [0.0, 1.0].
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getPMF(long[] splitPoints) {
default double[] getPMF(final long[] splitPoints) {
return getPMF(splitPoints, INCLUSIVE);
}

Expand Down Expand Up @@ -150,7 +150,7 @@ default double[] getPMF(long[] splitPoints) {
* @return the approximate quantile given the normalized rank.
* @throws IllegalArgumentException if sketch is empty.
*/
default long getQuantile(double rank) {
default long getQuantile(final double rank) {
return getQuantile(rank, INCLUSIVE);
}

Expand Down Expand Up @@ -207,7 +207,7 @@ default long getQuantile(double rank) {
* @return an array of quantiles corresponding to the given array of normalized ranks.
* @throws IllegalArgumentException if sketch is empty.
*/
default long[] getQuantiles(double[] ranks) {
default long[] getQuantiles(final double[] ranks) {
return getQuantiles(ranks, INCLUSIVE);
}

Expand All @@ -230,7 +230,7 @@ default long[] getQuantiles(double[] ranks) {
* @return the normalized rank corresponding to the given quantile
* @throws IllegalArgumentException if sketch is empty.
*/
default double getRank(long quantile) {
default double getRank(final long quantile) {
return getRank(quantile, INCLUSIVE);
}

Expand All @@ -251,7 +251,7 @@ default double getRank(long quantile) {
* @return an array of normalized ranks corresponding to the given array of quantiles.
* @throws IllegalArgumentException if sketch is empty.
*/
default double[] getRanks(long[] quantiles) {
default double[] getRanks(final long[] quantiles) {
return getRanks(quantiles, INCLUSIVE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface ConcurrentSharedThetaSketch extends MemoryStatus {
long NOT_SINGLE_HASH = -1L;
double MIN_ERROR = 0.0000001;

static long computeExactLimit(long k, double error) {
static long computeExactLimit(final long k, final double error) {
return 2 * Math.min(k, (long) Math.ceil(1.0 / Math.pow(Math.max(error,MIN_ERROR), 2.0)));
}

Expand Down