From 6776d6e88bc0951dd3b36c0539849bb074d63ae3 Mon Sep 17 00:00:00 2001
From: zihluwang
+ * 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.
+ *
+ * Quartile bounds consist of:
+ *
+ *
+ *
+ * Example usage: + *
+ * QuartileBounds bounds = QuartileBounds.builder() + * .lowerBound(1.5) + * .upperBound(7.5) + * .build(); + ** - * @param upperBound - * @param lowerBound + * @param upperBound the upper bound of the dataset + * @param lowerBound the lower bound of the dataset * @author zihluwang + * @version 1.6.5 + * @since 1.6.5 */ public record QuartileBounds( Double upperBound, @@ -30,31 +51,74 @@ public record QuartileBounds( ) { /** - * Get a builder for {@link QuartileBounds}. + * Creates a new {@link Builder} instance for building a {@code QuartileBounds} object. + *
+ * The {@link Builder} pattern is used to construct the {@code QuartileBounds} object with optional values for the + * upper and lower bounds. + *
* - * @return a builder + * @return a new instance of the {@link Builder} class */ public static Builder builder() { return new Builder(); } + /** + * A builder class for constructing instances of the {@code QuartileBounds} record. + *+ * 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. + *
+ *+ * Example usage: + *
+ * {@code
+ * QuartileBounds bounds = QuartileBounds.builder()
+ * .lowerBound(1.5)
+ * .upperBound(7.5)
+ * .build();
+ * }
+ *
+ */
public static class Builder {
private Double upperBound;
private Double lowerBound;
+ /**
+ * Private constructor for {@code Builder}, ensuring it can only be instantiated through the
+ * {@link QuartileBounds#builder()} method.
+ */
private Builder() {
}
+ /**
+ * Sets the upper bound for the {@code QuartileBounds}.
+ *
+ * @param upperBound the upper bound of the dataset
+ * @return the current {@code Builder} instance, for method chaining
+ */
public Builder upperBound(Double upperBound) {
this.upperBound = upperBound;
return this;
}
+ /**
+ * Sets the lower bound for the {@code QuartileBounds}.
+ *
+ * @param lowerBound the lower bound of the dataset
+ * @return the current {@code Builder} instance, for method chaining
+ */
public Builder lowerBound(Double lowerBound) {
this.lowerBound = lowerBound;
return this;
}
+ /**
+ * 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
+ */
public QuartileBounds build() {
return new QuartileBounds(upperBound, lowerBound);
}