Skip to content

Commit 6776d6e

Browse files
author
zihluwang
committed
docs: updated docs for record class QuartileBounds
1 parent fa10b95 commit 6776d6e

File tree

1 file changed

+69
-5
lines changed

1 file changed

+69
-5
lines changed

num4j/src/main/java/com/onixbyte/nums/model/QuartileBounds.java

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,107 @@
1818
package com.onixbyte.nums.model;
1919

2020
/**
21-
* QuartileBound.
21+
* A record representing the quartile bounds of a dataset.
22+
* <p>
23+
* This class encapsulates the lower and upper bounds of a dataset, which are typically used for detecting outliers in
24+
* the data. The bounds are calculated based on the interquartile range (IQR) of the dataset. Values below the lower
25+
* bound or above the upper bound may be considered outliers.
26+
* <p>
27+
* Quartile bounds consist of:
28+
* <ul>
29+
* <li>{@code lowerBound} - The lower bound of the dataset, typically {@code Q1 - 1.5 * IQR}.</li>
30+
* <li>{@code upperBound} - The upper bound of the dataset, typically {@code Q3 + 1.5 * IQR}.</li>
31+
* </ul>
32+
* </p>
33+
* <p>
34+
* Example usage:
35+
* <pre>
36+
* QuartileBounds bounds = QuartileBounds.builder()
37+
* .lowerBound(1.5)
38+
* .upperBound(7.5)
39+
* .build();
40+
* </pre>
2241
*
23-
* @param upperBound
24-
* @param lowerBound
42+
* @param upperBound the upper bound of the dataset
43+
* @param lowerBound the lower bound of the dataset
2544
* @author zihluwang
45+
* @version 1.6.5
46+
* @since 1.6.5
2647
*/
2748
public record QuartileBounds(
2849
Double upperBound,
2950
Double lowerBound
3051
) {
3152

3253
/**
33-
* Get a builder for {@link QuartileBounds}.
54+
* Creates a new {@link Builder} instance for building a {@code QuartileBounds} object.
55+
* <p>
56+
* The {@link Builder} pattern is used to construct the {@code QuartileBounds} object with optional values for the
57+
* upper and lower bounds.
58+
* </p>
3459
*
35-
* @return a builder
60+
* @return a new instance of the {@link Builder} class
3661
*/
3762
public static Builder builder() {
3863
return new Builder();
3964
}
4065

66+
/**
67+
* A builder class for constructing instances of the {@code QuartileBounds} record.
68+
* <p>
69+
* The {@link Builder} pattern allows for the step-by-step construction of a {@code QuartileBounds} object,
70+
* providing a flexible way to set values for the lower and upper bounds. Once the builder has the required values,
71+
* the {@link #build()} method creates and returns a new {@code QuartileBounds} object.
72+
* </p>
73+
* <p>
74+
* Example usage:
75+
* <pre>
76+
* {@code
77+
* QuartileBounds bounds = QuartileBounds.builder()
78+
* .lowerBound(1.5)
79+
* .upperBound(7.5)
80+
* .build();
81+
* }
82+
* </pre>
83+
*/
4184
public static class Builder {
4285
private Double upperBound;
4386
private Double lowerBound;
4487

88+
/**
89+
* Private constructor for {@code Builder}, ensuring it can only be instantiated through the
90+
* {@link QuartileBounds#builder()} method.
91+
*/
4592
private Builder() {
4693
}
4794

95+
/**
96+
* Sets the upper bound for the {@code QuartileBounds}.
97+
*
98+
* @param upperBound the upper bound of the dataset
99+
* @return the current {@code Builder} instance, for method chaining
100+
*/
48101
public Builder upperBound(Double upperBound) {
49102
this.upperBound = upperBound;
50103
return this;
51104
}
52105

106+
/**
107+
* Sets the lower bound for the {@code QuartileBounds}.
108+
*
109+
* @param lowerBound the lower bound of the dataset
110+
* @return the current {@code Builder} instance, for method chaining
111+
*/
53112
public Builder lowerBound(Double lowerBound) {
54113
this.lowerBound = lowerBound;
55114
return this;
56115
}
57116

117+
/**
118+
* Builds and returns a new {@code QuartileBounds} instance with the specified upper and lower bounds.
119+
*
120+
* @return a new {@code QuartileBounds} object containing the specified bounds
121+
*/
58122
public QuartileBounds build() {
59123
return new QuartileBounds(upperBound, lowerBound);
60124
}

0 commit comments

Comments
 (0)