📄 xyseriescollection.java
字号:
* @param series the series (zero-based index).
*
* @return The item count.
*
* @throws IllegalArgumentException if <code>series</code> is not in the
* range <code>0</code> to <code>getSeriesCount() - 1</code>.
*/
public int getItemCount(int series) {
// defer argument checking
return getSeries(series).getItemCount();
}
/**
* Returns the x-value for the specified series and item.
*
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return The value.
*/
public Number getX(int series, int item) {
XYSeries ts = (XYSeries) this.data.get(series);
XYDataItem xyItem = ts.getDataItem(item);
return xyItem.getX();
}
/**
* Returns the starting X value for the specified series and item.
*
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return The starting X value.
*/
public Number getStartX(int series, int item) {
return this.intervalDelegate.getStartX(series, item);
}
/**
* Returns the ending X value for the specified series and item.
*
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return The ending X value.
*/
public Number getEndX(int series, int item) {
return this.intervalDelegate.getEndX(series, item);
}
/**
* Returns the y-value for the specified series and item.
*
* @param series the series (zero-based index).
* @param index the index of the item of interest (zero-based).
*
* @return The value (possibly <code>null</code>).
*/
public Number getY(int series, int index) {
XYSeries ts = (XYSeries) this.data.get(series);
XYDataItem xyItem = ts.getDataItem(index);
return xyItem.getY();
}
/**
* Returns the starting Y value for the specified series and item.
*
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return The starting Y value.
*/
public Number getStartY(int series, int item) {
return getY(series, item);
}
/**
* Returns the ending Y value for the specified series and item.
*
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return The ending Y value.
*/
public Number getEndY(int series, int item) {
return getY(series, item);
}
/**
* Tests this collection for equality with an arbitrary object.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/
public boolean equals(Object obj) {
/*
* XXX
*
* what about the interval delegate...?
* The interval width etc wasn't considered
* before, hence i did not add it here (AS)
*
*/
if (obj == this) {
return true;
}
if (!(obj instanceof XYSeriesCollection)) {
return false;
}
XYSeriesCollection that = (XYSeriesCollection) obj;
return ObjectUtilities.equal(this.data, that.data);
}
/**
* Returns a clone of this instance.
*
* @return A clone.
*
* @throws CloneNotSupportedException if there is a problem.
*/
public Object clone() throws CloneNotSupportedException {
XYSeriesCollection clone = (XYSeriesCollection) super.clone();
clone.data = (List) ObjectUtilities.deepClone(this.data);
clone.intervalDelegate
= (IntervalXYDelegate) this.intervalDelegate.clone();
return clone;
}
/**
* Returns a hash code.
*
* @return A hash code.
*/
public int hashCode() {
// Same question as for equals (AS)
return (this.data != null ? this.data.hashCode() : 0);
}
/**
* Returns the minimum x-value in the dataset.
*
* @param includeInterval a flag that determines whether or not the
* x-interval is taken into account.
*
* @return The minimum value.
*/
public double getDomainLowerBound(boolean includeInterval) {
return this.intervalDelegate.getDomainLowerBound(includeInterval);
}
/**
* Returns the maximum x-value in the dataset.
*
* @param includeInterval a flag that determines whether or not the
* x-interval is taken into account.
*
* @return The maximum value.
*/
public double getDomainUpperBound(boolean includeInterval) {
return this.intervalDelegate.getDomainUpperBound(includeInterval);
}
/**
* Returns the range of the values in this dataset's domain.
*
* @param includeInterval a flag that determines whether or not the
* x-interval is taken into account.
*
* @return The range.
*/
public Range getDomainBounds(boolean includeInterval) {
if (includeInterval) {
return this.intervalDelegate.getDomainBounds(includeInterval);
}
else {
return DatasetUtilities.iterateDomainBounds(this, includeInterval);
}
}
/**
* Returns the interval width. This is used to calculate the start and end
* x-values, if/when the dataset is used as an {@link IntervalXYDataset}.
*
* @return The interval width.
*/
public double getIntervalWidth() {
return this.intervalDelegate.getIntervalWidth();
}
/**
* Sets the interval width and sends a {@link DatasetChangeEvent} to all
* registered listeners.
*
* @param width the width (negative values not permitted).
*/
public void setIntervalWidth(double width) {
if (width < 0.0) {
throw new IllegalArgumentException("Negative 'width' argument.");
}
this.intervalDelegate.setFixedIntervalWidth(width);
fireDatasetChanged();
}
/**
* Returns the interval position factor.
*
* @return The interval position factor.
*/
public double getIntervalPositionFactor() {
return this.intervalDelegate.getIntervalPositionFactor();
}
/**
* Sets the interval position factor. This controls where the x-value is in
* relation to the interval surrounding the x-value (0.0 means the x-value
* will be positioned at the start, 0.5 in the middle, and 1.0 at the end).
*
* @param factor the factor.
*/
public void setIntervalPositionFactor(double factor) {
this.intervalDelegate.setIntervalPositionFactor(factor);
fireDatasetChanged();
}
/**
* Returns whether the interval width is automatically calculated or not.
*
* @return Whether the width is automatically calculated or not.
*/
public boolean isAutoWidth() {
return this.intervalDelegate.isAutoWidth();
}
/**
* Sets the flag that indicates wether the interval width is automatically
* calculated or not.
*
* @param b a boolean.
*/
public void setAutoWidth(boolean b) {
this.intervalDelegate.setAutoWidth(b);
fireDatasetChanged();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -