/**
* Returns the maximum number of items that will be retained in the series.
* The default value is <code>Integer.MAX_VALUE</code>.
*
* @return The maximum item count.
* @see #setMaximumItemCount(int)
*/
public int getMaximumItemCount() {
return this.maximumItemCount;
}
/**
* Sets the maximum number of items that will be retained in the series.
* If you add a new item to the series such that the number of items will
* exceed the maximum item count, then the first element in the series is
* automatically removed, ensuring that the maximum item count is not
* exceeded.
* <p>
* Typically this value is set before the series is populated with data,
* but if it is applied later, it may cause some items to be removed from
* the series (in which case a {@link SeriesChangeEvent} will be sent to
* all registered listeners.
*
* @param maximum the maximum number of items for the series.
*/
/**
* Sets the maximum number of items that will be retained in the series.
* If you add a new item to the series such that the number of items will
* exceed the maximum item count, then the first element in the series is
* automatically removed, ensuring that the maximum item count is not
* exceeded.
* <p>
* Typically this value is set before the series is populated with data,
* but if it is applied later, it may cause some items to be removed from
* the series (in which case a {@link SeriesChangeEvent} will be sent to
* all registered listeners.
*
* @param maximum the maximum number of items for the series.
*/
public void setMaximumItemCount(int maximum) {
this.maximumItemCount = maximum;
boolean dataRemoved = false;
while (this.data.size() > maximum) {
this.data.remove(0);
dataRemoved = true;
}
if (dataRemoved) {
fireSeriesChanged();
}
}
|