Example usage for org.jfree.data.time TimeSeriesDataItem hashCode

List of usage examples for org.jfree.data.time TimeSeriesDataItem hashCode

Introduction

In this page you can find the example usage for org.jfree.data.time TimeSeriesDataItem hashCode.

Prototype

@Override
public int hashCode() 

Source Link

Document

Returns a hash code.

Usage

From source file:org.jfree.data.time.TimeSeries.java

/**
 * Returns a hash code value for the object.
 *
 * @return The hashcode/*w w w .  j  a va  2s  . com*/
 */
@Override
public int hashCode() {
    int result = super.hashCode();
    result = 29 * result + (this.domain != null ? this.domain.hashCode() : 0);
    result = 29 * result + (this.range != null ? this.range.hashCode() : 0);
    result = 29 * result + (this.timePeriodClass != null ? this.timePeriodClass.hashCode() : 0);
    // it is too slow to look at every data item, so let's just look at
    // the first, middle and last items...
    int count = getItemCount();
    if (count > 0) {
        TimeSeriesDataItem item = getRawDataItem(0);
        result = 29 * result + item.hashCode();
    }
    if (count > 1) {
        TimeSeriesDataItem item = getRawDataItem(count - 1);
        result = 29 * result + item.hashCode();
    }
    if (count > 2) {
        TimeSeriesDataItem item = getRawDataItem(count / 2);
        result = 29 * result + item.hashCode();
    }
    result = 29 * result + this.maximumItemCount;
    result = 29 * result + (int) this.maximumItemAge;
    return result;
}