Example usage for org.jfree.data Values2D getValue

List of usage examples for org.jfree.data Values2D getValue

Introduction

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

Prototype

public Number getValue(int row, int column);

Source Link

Document

Returns a value from the table.

Usage

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

/**
 * Returns the total of the values in one column of the supplied data
 * table./*from  ww  w  .j  a  v a  2  s .  com*/
 *
 * @param data  the table of values ({@code null} not permitted).
 * @param column  the column index (zero-based).
 *
 * @return The total of the values in the specified column.
 */
public static double calculateColumnTotal(Values2D data, int column) {
    Args.nullNotPermitted(data, "data");
    double total = 0.0;
    int rowCount = data.getRowCount();
    for (int r = 0; r < rowCount; r++) {
        Number n = data.getValue(r, column);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

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

/**
 * Returns the total of the values in one row of the supplied data
 * table.//from  www. ja  va 2  s.c o m
 *
 * @param data  the table of values ({@code null} not permitted).
 * @param row  the row index (zero-based).
 *
 * @return The total of the values in the specified row.
 */
public static double calculateRowTotal(Values2D data, int row) {
    Args.nullNotPermitted(data, "data");
    double total = 0.0;
    int columnCount = data.getColumnCount();
    for (int c = 0; c < columnCount; c++) {
        Number n = data.getValue(row, c);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

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

/**
 * Returns the total of the values in one column of the supplied data
 * table./*  w w w . ja  v  a 2s .c om*/
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param column  the column index (zero-based).
 *
 * @return The total of the values in the specified column.
 */
public static double calculateColumnTotal(Values2D data, int column) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int rowCount = data.getRowCount();
    for (int r = 0; r < rowCount; r++) {
        Number n = data.getValue(r, column);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

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

/**
 * Returns the total of the values in one row of the supplied data
 * table.//from www.  j ava  2 s  .c o m
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 *
 * @return The total of the values in the specified row.
 */
public static double calculateRowTotal(Values2D data, int row) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int columnCount = data.getColumnCount();
    for (int c = 0; c < columnCount; c++) {
        Number n = data.getValue(row, c);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

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

/**
 * Returns the total of the values in one column of the supplied data
 * table by taking only the row numbers in the array into account.
 *
 * @param data  the table of values ({@code null} not permitted).
 * @param column  the column index (zero-based).
 * @param validRows the array with valid rows (zero-based).
 *
 * @return The total of the valid values in the specified column.
 *
 * @since 1.0.13//from w w w  .  ja va2  s  . co  m
 */
public static double calculateColumnTotal(Values2D data, int column, int[] validRows) {
    Args.nullNotPermitted(data, "data");
    double total = 0.0;
    int rowCount = data.getRowCount();
    for (int v = 0; v < validRows.length; v++) {
        int row = validRows[v];
        if (row < rowCount) {
            Number n = data.getValue(row, column);
            if (n != null) {
                total += n.doubleValue();
            }
        }
    }
    return total;
}

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

/**
 * Returns the total of the values in one row of the supplied data
 * table by taking only the column numbers in the array into account.
 *
 * @param data  the table of values ({@code null} not permitted).
 * @param row  the row index (zero-based).
 * @param validCols the array with valid cols (zero-based).
 *
 * @return The total of the valid values in the specified row.
 *
 * @since 1.0.13/*  w  w  w  .  j ava2s.c  om*/
 */
public static double calculateRowTotal(Values2D data, int row, int[] validCols) {
    Args.nullNotPermitted(data, "data");
    double total = 0.0;
    int colCount = data.getColumnCount();
    for (int v = 0; v < validCols.length; v++) {
        int col = validCols[v];
        if (col < colCount) {
            Number n = data.getValue(row, col);
            if (n != null) {
                total += n.doubleValue();
            }
        }
    }
    return total;
}

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

/**
 * Returns the total of the values in one column of the supplied data
 * table by taking only the row numbers in the array into account.
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param column  the column index (zero-based).
 * @param validRows the array with valid rows (zero-based).
 *
 * @return The total of the valid values in the specified column.
 *
 * @since 1.0.13//  w  w  w.j  av  a 2 s .co m
 */
public static double calculateColumnTotal(Values2D data, int column, int[] validRows) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int rowCount = data.getRowCount();
    for (int v = 0; v < validRows.length; v++) {
        int row = validRows[v];
        if (row < rowCount) {
            Number n = data.getValue(row, column);
            if (n != null) {
                total += n.doubleValue();
            }
        }
    }
    return total;
}

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

/**
 * Returns the total of the values in one row of the supplied data
 * table by taking only the column numbers in the array into account.
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param validCols the array with valid cols (zero-based).
 *
 * @return The total of the valid values in the specified row.
 *
 * @since 1.0.13//from  w  ww .  jav a  2s. co  m
 */
public static double calculateRowTotal(Values2D data, int row, int[] validCols) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int colCount = data.getColumnCount();
    for (int v = 0; v < validCols.length; v++) {
        int col = validCols[v];
        if (col < colCount) {
            Number n = data.getValue(row, col);
            if (n != null) {
                total += n.doubleValue();
            }
        }
    }
    return total;
}