Skip to content

Commit 6887253

Browse files
authored
add-javadoc-BarSeries#setMaximumBarCount (ta4j#1052)
1 parent 501eb48 commit 6887253

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

ta4j-core/src/main/java/org/ta4j/core/BarSeries.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,17 @@ default Num numOf(Number number) {
101101
}
102102

103103
/**
104-
* @param i an index
104+
* Gets the bar from {@link #getBarData()} with index {@code i}.
105+
*
106+
* <p>
107+
* The given {@code i} can return the same bar within the first range of indices
108+
* due to {@link #setMaximumBarCount(int)}, for example: If you fill a BarSeries
109+
* with 30 bars and then apply a {@code maximumBarCount} of 10 bars, the first
110+
* 20 bars will be removed from the BarSeries. The indices going further from 0
111+
* to 29 remain but return the same bar from 0 to 20. The remaining 9 bars are
112+
* returned from index 21.
113+
*
114+
* @param i the index
105115
* @return the bar at the i-th position
106116
*/
107117
Bar getBar(int i);
@@ -184,8 +194,9 @@ default String getSeriesPeriodDescription() {
184194
*
185195
* If a new bar is added to the series such that the number of bars will exceed
186196
* the maximum bar count, then the FIRST bar in the series is automatically
187-
* removed, ensuring that the maximum bar count is not exceeded.
188-
*
197+
* removed, ensuring that the maximum bar count is not exceeded. The indices of
198+
* the bar series do not change.
199+
*
189200
* @param maximumBarCount the maximum bar count
190201
*/
191202
void setMaximumBarCount(int maximumBarCount);

0 commit comments

Comments
 (0)