Example usage for org.jfree.data ComparableObjectItem hashCode

List of usage examples for org.jfree.data ComparableObjectItem hashCode

Introduction

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

Prototype

@Override
public int hashCode() 

Source Link

Document

Returns a hash code.

Usage

From source file:org.jfree.data.ComparableObjectSeries.java

/**
 * Returns a hash code./*  ww  w.  ja v a2  s . co  m*/
 *
 * @return A hash code.
 */
@Override
public int hashCode() {
    int result = super.hashCode();
    // 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) {
        ComparableObjectItem item = getDataItem(0);
        result = 29 * result + item.hashCode();
    }
    if (count > 1) {
        ComparableObjectItem item = getDataItem(count - 1);
        result = 29 * result + item.hashCode();
    }
    if (count > 2) {
        ComparableObjectItem item = getDataItem(count / 2);
        result = 29 * result + item.hashCode();
    }
    result = 29 * result + this.maximumItemCount;
    result = 29 * result + (this.autoSort ? 1 : 0);
    result = 29 * result + (this.allowDuplicateXValues ? 1 : 0);
    return result;
}