Example usage for org.jfree.data.pie PieDataset getValue

List of usage examples for org.jfree.data.pie PieDataset getValue

Introduction

In this page you can find the example usage for org.jfree.data.pie PieDataset getValue.

Prototype

public Number getValue(Comparable key);

Source Link

Document

Returns the value for a given key.

Usage

From source file:org.jfree.data.pie.DefaultPieDataset.java

/**
 * Tests if this object is equal to another.
 *
 * @param obj  the other object.//from w  w w . j  a v a 2 s  .  co  m
 *
 * @return A boolean.
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }

    if (!(obj instanceof PieDataset)) {
        return false;
    }
    PieDataset that = (PieDataset) obj;
    int count = getItemCount();
    if (that.getItemCount() != count) {
        return false;
    }

    for (int i = 0; i < count; i++) {
        Comparable k1 = getKey(i);
        Comparable k2 = that.getKey(i);
        if (!k1.equals(k2)) {
            return false;
        }

        Number v1 = getValue(i);
        Number v2 = that.getValue(i);
        if (v1 == null) {
            if (v2 != null) {
                return false;
            }
        } else {
            if (!v1.equals(v2)) {
                return false;
            }
        }
    }
    return true;

}