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

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

Introduction

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

Prototype

public int getItemCount();

Source Link

Document

Returns the number of items (values) in the collection.

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 ww . ja  v  a2  s .com
 *
 * @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;

}