Example usage for org.jfree.data KeyedValues2D getRowCount

List of usage examples for org.jfree.data KeyedValues2D getRowCount

Introduction

In this page you can find the example usage for org.jfree.data KeyedValues2D getRowCount.

Prototype

public int getRowCount();

Source Link

Document

Returns the number of rows in the table.

Usage

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

/**
 * Tests if this object is equal to another.
 *
 * @param o  the other object (<code>null</code> permitted).
 *
 * @return A boolean./*ww w . j a  va  2 s .co  m*/
 */
public boolean equals(Object o) {

    if (o == null) {
        return false;
    }
    if (o == this) {
        return true;
    }

    if (!(o instanceof KeyedValues2D)) {
        return false;
    }
    KeyedValues2D kv2D = (KeyedValues2D) o;
    if (!getRowKeys().equals(kv2D.getRowKeys())) {
        return false;
    }
    if (!getColumnKeys().equals(kv2D.getColumnKeys())) {
        return false;
    }
    int rowCount = getRowCount();
    if (rowCount != kv2D.getRowCount()) {
        return false;
    }

    int colCount = getColumnCount();
    if (colCount != kv2D.getColumnCount()) {
        return false;
    }

    for (int r = 0; r < rowCount; r++) {
        for (int c = 0; c < colCount; c++) {
            Number v1 = getValue(r, c);
            Number v2 = kv2D.getValue(r, c);
            if (v1 == null) {
                if (v2 != null) {
                    return false;
                }
            } else {
                if (!v1.equals(v2)) {
                    return false;
                }
            }
        }
    }
    return true;
}

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

/**
 * Tests if this object is equal to another.
 *
 * @param o  the other object (<code>null</code> permitted).
 *
 * @return A boolean.//  www.  j  a  v a 2 s  .  com
 */
@Override
public boolean equals(Object o) {

    if (o == null) {
        return false;
    }
    if (o == this) {
        return true;
    }

    if (!(o instanceof KeyedValues2D)) {
        return false;
    }
    KeyedValues2D kv2D = (KeyedValues2D) o;
    if (!getRowKeys().equals(kv2D.getRowKeys())) {
        return false;
    }
    if (!getColumnKeys().equals(kv2D.getColumnKeys())) {
        return false;
    }
    int rowCount = getRowCount();
    if (rowCount != kv2D.getRowCount()) {
        return false;
    }

    int colCount = getColumnCount();
    if (colCount != kv2D.getColumnCount()) {
        return false;
    }

    for (int r = 0; r < rowCount; r++) {
        for (int c = 0; c < colCount; c++) {
            Number v1 = getValue(r, c);
            Number v2 = kv2D.getValue(r, c);
            if (v1 == null) {
                if (v2 != null) {
                    return false;
                }
            } else {
                if (!v1.equals(v2)) {
                    return false;
                }
            }
        }
    }
    return true;
}