Package org.jfree.data
Class DataUtils
java.lang.Object
org.jfree.data.DataUtils
Utility methods for use with some of the data classes (but not the datasets,
see
DatasetUtils).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublecalculateColumnTotal(Values2D data, int column) Returns the total of the values in one column of the supplied data table.static doublecalculateColumnTotal(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 doublecalculateRowTotal(Values2D data, int row) Returns the total of the values in one row of the supplied data table.static doublecalculateRowTotal(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 Number[]createNumberArray(double[] data) Constructs an array ofNumberobjects from an array ofdoubleprimitives.static Number[][]createNumberArray2D(double[][] data) Constructs an array of arrays ofNumberobjects from a corresponding structure containingdoubleprimitives.static booleanequal(double[][] a, double[][] b) Tests two arrays for equality.static KeyedValuesReturns aKeyedValuesinstance that contains the cumulative percentage values for the data in anotherKeyedValuesinstance.
-
Constructor Details
-
DataUtils
public DataUtils()
-
-
Method Details
-
equal
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 (nullpermitted).b- the second array (nullpermitted).- Returns:
- A boolean.
-
clone
Returns a clone of the specified array.- Parameters:
source- the source array (nullnot permitted).- Returns:
- A clone of the array.
-
calculateColumnTotal
Returns the total of the values in one column of the supplied data table.- Parameters:
data- the table of values (nullnot permitted).column- the column index (zero-based).- Returns:
- The total of the values in the specified column.
-
calculateColumnTotal
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 (nullnot 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.
-
calculateRowTotal
Returns the total of the values in one row of the supplied data table.- Parameters:
data- the table of values (nullnot permitted).row- the row index (zero-based).- Returns:
- The total of the values in the specified row.
-
calculateRowTotal
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 (nullnot 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.
-
createNumberArray
Constructs an array ofNumberobjects from an array ofdoubleprimitives.- Parameters:
data- the data (nullnot permitted).- Returns:
- An array of
double.
-
createNumberArray2D
Constructs an array of arrays ofNumberobjects from a corresponding structure containingdoubleprimitives.- Parameters:
data- the data (nullnot permitted).- Returns:
- An array of
double.
-
getCumulativePercentages
Returns aKeyedValuesinstance that contains the cumulative percentage values for the data in anotherKeyedValuesinstance.The percentages are values between 0.0 and 1.0 (where 1.0 = 100%).
- Parameters:
data- the data (nullnot permitted).- Returns:
- The cumulative percentages.
-