Example usage for org.jfree.chart.util ObjectUtilities equal

List of usage examples for org.jfree.chart.util ObjectUtilities equal

Introduction

In this page you can find the example usage for org.jfree.chart.util ObjectUtilities equal.

Prototype

public static boolean equal(final Object o1, final Object o2) 

Source Link

Document

Returns true if the two objects are equal OR both null.

Usage

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

/**
 * Tests the series for equality with another object.
 *
 * @param obj  the object (<code>null</code> permitted).
 *
 * @return <code>true</code> or <code>false</code>.
 *///from   w w w.  j a  va  2 s .  co m
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;
}

From source file:org.jfree.data.xy.XYSeries.java

/**
 * Tests this series for equality with an arbitrary object.
 *
 * @param obj  the object to test against for equality
 *             (<code>null</code> permitted).
 *
 * @return A boolean./*from w  ww.  ja  v a2  s  .  co m*/
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof XYSeries)) {
        return false;
    }
    if (!super.equals(obj)) {
        return false;
    }
    XYSeries that = (XYSeries) obj;
    if (this.maximumItemCount != that.maximumItemCount) {
        return false;
    }
    if (this.autoSort != that.autoSort) {
        return false;
    }
    if (this.allowDuplicateXValues != that.allowDuplicateXValues) {
        return false;
    }
    if (!ObjectUtilities.equal(this.data, that.data)) {
        return false;
    }
    return true;
}