| Method from org.jfree.data.time.TimePeriodValues Detail: |
public void add(TimePeriodValue item) {
if (item == null) {
throw new IllegalArgumentException("Null item not allowed.");
}
this.data.add(item);
updateBounds(item.getPeriod(), this.data.size() - 1);
fireSeriesChanged();
}
Adds a data item to the series and sends a SeriesChangeEvent to
all registered listeners. |
public void add(TimePeriod period,
double value) {
TimePeriodValue item = new TimePeriodValue(period, value);
add(item);
}
Adds a new data item to the series and sends a SeriesChangeEvent
to all registered listeners. |
public void add(TimePeriod period,
Number value) {
TimePeriodValue item = new TimePeriodValue(period, value);
add(item);
}
Adds a new data item to the series and sends a SeriesChangeEvent
to all registered listeners. |
public Object clone() throws CloneNotSupportedException {
Object clone = createCopy(0, getItemCount() - 1);
return clone;
}
Returns a clone of the collection.
Notes:
- no need to clone the domain and range descriptions, since String
object is immutable;
- we pass over to the more general method createCopy(start, end).
|
public TimePeriodValues createCopy(int start,
int end) throws CloneNotSupportedException {
TimePeriodValues copy = (TimePeriodValues) super.clone();
copy.data = new ArrayList();
if (this.data.size() > 0) {
for (int index = start; index < = end; index++) {
TimePeriodValue item = (TimePeriodValue) this.data.get(index);
TimePeriodValue clone = (TimePeriodValue) item.clone();
try {
copy.add(clone);
}
catch (SeriesException e) {
System.err.println("Failed to add cloned item.");
}
}
}
return copy;
}
Creates a new instance by copying a subset of the data in this
collection. |
public void delete(int start,
int end) {
for (int i = 0; i < = (end - start); i++) {
this.data.remove(start);
}
recalculateBounds();
fireSeriesChanged();
}
Deletes data from start until end index (end inclusive) and sends a
SeriesChangeEvent to all registered listeners. |
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof TimePeriodValues)) {
return false;
}
if (!super.equals(obj)) {
return false;
}
TimePeriodValues that = (TimePeriodValues) obj;
if (!ObjectUtilities.equal(this.getDomainDescription(),
that.getDomainDescription())) {
return false;
}
if (!ObjectUtilities.equal(this.getRangeDescription(),
that.getRangeDescription())) {
return false;
}
int count = getItemCount();
if (count != that.getItemCount()) {
return false;
}
for (int i = 0; i < count; i++) {
if (!getDataItem(i).equals(that.getDataItem(i))) {
return false;
}
}
return true;
}
Tests the series for equality with another object. |
public TimePeriodValue getDataItem(int index) {
return (TimePeriodValue) this.data.get(index);
}
Returns one data item for the series. |
public String getDomainDescription() {
return this.domain;
}
Returns the domain description. |
public int getItemCount() {
return this.data.size();
}
Returns the number of items in the series. |
public int getMaxEndIndex() {
return this.maxEndIndex;
}
Returns the index of the time period with the maximum end milliseconds. |
public int getMaxMiddleIndex() {
return this.maxMiddleIndex;
}
Returns the index of the time period with the maximum middle
milliseconds. |
public int getMaxStartIndex() {
return this.maxStartIndex;
}
Returns the index of the time period with the maximum start milliseconds. |
public int getMinEndIndex() {
return this.minEndIndex;
}
Returns the index of the time period with the minimum end milliseconds. |
public int getMinMiddleIndex() {
return this.minMiddleIndex;
}
Returns the index of the time period with the minimum middle
milliseconds. |
public int getMinStartIndex() {
return this.minStartIndex;
}
Returns the index of the time period with the minimum start milliseconds. |
public String getRangeDescription() {
return this.range;
}
Returns the range description. |
public TimePeriod getTimePeriod(int index) {
return getDataItem(index).getPeriod();
}
Returns the time period at the specified index. |
public Number getValue(int index) {
return getDataItem(index).getValue();
}
Returns the value at the specified index. |
public int hashCode() {
int result;
result = (this.domain != null ? this.domain.hashCode() : 0);
result = 29 * result + (this.range != null ? this.range.hashCode() : 0);
result = 29 * result + this.data.hashCode();
result = 29 * result + this.minStartIndex;
result = 29 * result + this.maxStartIndex;
result = 29 * result + this.minMiddleIndex;
result = 29 * result + this.maxMiddleIndex;
result = 29 * result + this.minEndIndex;
result = 29 * result + this.maxEndIndex;
return result;
}
Returns a hash code value for the object. |
public void setDomainDescription(String description) {
String old = this.domain;
this.domain = description;
firePropertyChange("Domain", old, description);
}
Sets the domain description and fires a property change event (with the
property name Domain if the description changes). |
public void setRangeDescription(String description) {
String old = this.range;
this.range = description;
firePropertyChange("Range", old, description);
}
Sets the range description and fires a property change event with the
name Range. |
public void update(int index,
Number value) {
TimePeriodValue item = getDataItem(index);
item.setValue(value);
fireSeriesChanged();
}
Updates (changes) the value of a data item and sends a
SeriesChangeEvent to all registered listeners. |