docs: added docs

This commit is contained in:
zihluwang
2025-01-18 14:06:13 +08:00
parent 566a960c14
commit a85c562b66
22 changed files with 357 additions and 147 deletions
@@ -21,8 +21,8 @@ import com.onixbyte.nums.model.QuartileBounds;
import java.util.List;
/**
* A utility class that provides methods for calculating percentiles and interquartile range (IQR) bounds
* for a dataset.
* A utility class that provides methods for calculating percentiles and interquartile range (IQR)
* bounds for a dataset.
* <p>
* This class contains static methods to:
* <ul>
@@ -57,12 +57,13 @@ public final class PercentileCalculator {
/**
* Calculates the specified percentile from a list of values.
* <p>
* This method takes a list of double values and calculates the given percentile using linear interpolation between
* the two closest ranks. The list is first sorted in ascending order, and the specified percentile is
* then calculated.
* This method takes a list of double values and calculates the given percentile using linear
* interpolation between the two closest ranks. The list is first sorted in ascending order,
* and the specified percentile is then calculated.
*
* @param values a list of {@code Double} values from which the percentile is calculated.
* @param percentile a {@code Double} representing the percentile to be calculated (e.g., 50.0 for the median)
* @param percentile a {@code Double} representing the percentile to be calculated (e.g., 50.0
* for the median)
* @return a {@code Double} value representing the calculated percentile
*/
public static Double calculatePercentile(List<Double> values, Double percentile) {
@@ -20,9 +20,9 @@ package com.onixbyte.nums.model;
/**
* A record representing the quartile bounds of a dataset.
* <p>
* This class encapsulates the lower and upper bounds of a dataset, which are typically used for detecting outliers in
* the data. The bounds are calculated based on the interquartile range (IQR) of the dataset. Values below the lower
* bound or above the upper bound may be considered outliers.
* This class encapsulates the lower and upper bounds of a dataset, which are typically used for
* detecting outliers in the data. The bounds are calculated based on the interquartile range (IQR)
* of the dataset. Values below the lower bound or above the upper bound may be considered outliers.
* <p>
* Quartile bounds consist of:
* <ul>
@@ -52,8 +52,8 @@ public record QuartileBounds(
/**
* Creates a new {@link Builder} instance for building a {@code QuartileBounds} object.
* <p>
* The {@link Builder} pattern is used to construct the {@code QuartileBounds} object with optional values for the
* upper and lower bounds.
* The {@link Builder} pattern is used to construct the {@code QuartileBounds} object with
* optional values for the upper and lower bounds.
* </p>
*
* @return a new instance of the {@link Builder} class
@@ -65,9 +65,10 @@ public record QuartileBounds(
/**
* A builder class for constructing instances of the {@code QuartileBounds} record.
* <p>
* The {@link Builder} pattern allows for the step-by-step construction of a {@code QuartileBounds} object,
* providing a flexible way to set values for the lower and upper bounds. Once the builder has the required values,
* the {@link #build()} method creates and returns a new {@code QuartileBounds} object.
* The {@link Builder} pattern allows for the step-by-step construction of a
* {@code QuartileBounds} object, providing a flexible way to set values for the lower and
* upper bounds. Once the builder has the required values, the {@link #build()} method creates
* and returns a new {@code QuartileBounds} object.
* </p>
* <p>
* Example usage:
@@ -114,7 +115,8 @@ public record QuartileBounds(
}
/**
* Builds and returns a new {@code QuartileBounds} instance with the specified upper and lower bounds.
* Builds and returns a new {@code QuartileBounds} instance with the specified upper and
* lower bounds.
*
* @return a new {@code QuartileBounds} object containing the specified bounds
*/