Header
And More


org.jfree.data
Class DataUtilities

java.lang.Object
  extended by org.jfree.data.DataUtilities

public abstract class DataUtilities
extends java.lang.Object

Utility methods for use with some of the data classes (but not the datasets, see DatasetUtilities).


Constructor Summary
DataUtilities()
           
 
Method Summary
static double calculateColumnTotal(Values2D data, int column)
          Returns the total of the values in one column of the supplied data table.
static double calculateColumnTotal(Values2D data, int column, int[] validRows)
          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.
static double calculateRowTotal(Values2D data, int row)
          Returns the total of the values in one row of the supplied data table.
static double calculateRowTotal(Values2D data, int row, int[] validCols)
          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.
static double[][] clone(double[][] source)
          Returns a clone of the specified array.
static java.lang.Number[] createNumberArray(double[] data)
          Constructs an array of Number objects from an array of double primitives.
static java.lang.Number[][] createNumberArray2D(double[][] data)
          Constructs an array of arrays of Number objects from a corresponding structure containing double primitives.
static boolean equal(double[][] a, double[][] b)
          Tests two arrays for equality.
static KeyedValues getCumulativePercentages(KeyedValues data)
          Returns a KeyedValues instance that contains the cumulative percentage values for the data in another KeyedValues instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataUtilities

public DataUtilities()
Method Detail

equal

public static boolean equal(double[][] a,
                            double[][] b)
Tests two arrays for equality. To be considered equal, the arrays must have exactly the same dimensions, and the values in each array must also match (two values that qre both NaN or both INF are considered equal in this test).

Parameters:
a - the first array (null permitted).
b - the second array (null permitted).
Returns:
A boolean.
Since:
1.0.13

clone

public static double[][] clone(double[][] source)
Returns a clone of the specified array.

Parameters:
source - the source array (null not permitted).
Returns:
A clone of the array.
Since:
1.0.13

calculateColumnTotal

public static double calculateColumnTotal(Values2D data,
                                          int column)
Returns the total of the values in one column of the supplied data table.

Parameters:
data - the table of values (null not permitted).
column - the column index (zero-based).
Returns:
The total of the values in the specified column.

calculateColumnTotal

public static double calculateColumnTotal(Values2D data,
                                          int column,
                                          int[] validRows)
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.

Parameters:
data - the table of values (null not permitted).
column - the column index (zero-based).
validRows - the array with valid rows (zero-based).
Returns:
The total of the valid values in the specified column.
Since:
1.0.13

calculateRowTotal

public static double calculateRowTotal(Values2D data,
                                       int row)
Returns the total of the values in one row of the supplied data table.

Parameters:
data - the table of values (null not permitted).
row - the row index (zero-based).
Returns:
The total of the values in the specified row.

calculateRowTotal

public static double calculateRowTotal(Values2D data,
                                       int row,
                                       int[] validCols)
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.

Parameters:
data - the table of values (null not permitted).
row - the row index (zero-based).
validCols - the array with valid cols (zero-based).
Returns:
The total of the valid values in the specified row.
Since:
1.0.13

createNumberArray

public static java.lang.Number[] createNumberArray(double[] data)
Constructs an array of Number objects from an array of double primitives.

Parameters:
data - the data (null not permitted).
Returns:
An array of Double.

createNumberArray2D

public static java.lang.Number[][] createNumberArray2D(double[][] data)
Constructs an array of arrays of Number objects from a corresponding structure containing double primitives.

Parameters:
data - the data (null not permitted).
Returns:
An array of Double.

getCumulativePercentages

public static KeyedValues getCumulativePercentages(KeyedValues data)
Returns a KeyedValues instance that contains the cumulative percentage values for the data in another KeyedValues instance.

The percentages are values between 0.0 and 1.0 (where 1.0 = 100%).

Parameters:
data - the data (null not permitted).
Returns:
The cumulative percentages.

Footer
And More


Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.