本文整理汇总了Java中org.jfree.util.ArrayUtilities.hasDuplicateItems方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtilities.hasDuplicateItems方法的具体用法?Java ArrayUtilities.hasDuplicateItems怎么用?Java ArrayUtilities.hasDuplicateItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.util.ArrayUtilities
的用法示例。
在下文中一共展示了ArrayUtilities.hasDuplicateItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCategoryDataset
import org.jfree.util.ArrayUtilities; //导入方法依赖的package包/类
/**
* Creates a {@link CategoryDataset} that contains a copy of the data in
* an array (instances of <code>Double</code> are created to represent the
* data items).
* <p>
* Row and column keys are taken from the supplied arrays.
*
* @param rowKeys the row keys (<code>null</code> not permitted).
* @param columnKeys the column keys (<code>null</code> not permitted).
* @param data the data.
*
* @return The dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable[] rowKeys,
Comparable[] columnKeys, double[][] data) {
ParamChecks.nullNotPermitted(rowKeys, "rowKeys");
ParamChecks.nullNotPermitted(columnKeys, "columnKeys");
if (ArrayUtilities.hasDuplicateItems(rowKeys)) {
throw new IllegalArgumentException("Duplicate items in 'rowKeys'.");
}
if (ArrayUtilities.hasDuplicateItems(columnKeys)) {
throw new IllegalArgumentException(
"Duplicate items in 'columnKeys'.");
}
if (rowKeys.length != data.length) {
throw new IllegalArgumentException(
"The number of row keys does not match the number of rows in "
+ "the data array.");
}
int columnCount = 0;
for (int r = 0; r < data.length; r++) {
columnCount = Math.max(columnCount, data[r].length);
}
if (columnKeys.length != columnCount) {
throw new IllegalArgumentException(
"The number of column keys does not match the number of "
+ "columns in the data array.");
}
// now do the work...
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int r = 0; r < data.length; r++) {
Comparable rowKey = rowKeys[r];
for (int c = 0; c < data[r].length; c++) {
Comparable columnKey = columnKeys[c];
result.addValue(new Double(data[r][c]), rowKey, columnKey);
}
}
return result;
}
示例2: createCategoryDataset
import org.jfree.util.ArrayUtilities; //导入方法依赖的package包/类
/**
* Creates a {@link CategoryDataset} that contains a copy of the data in
* an array (instances of <code>Double</code> are created to represent the
* data items).
* <p>
* Row and column keys are taken from the supplied arrays.
*
* @param rowKeys the row keys (<code>null</code> not permitted).
* @param columnKeys the column keys (<code>null</code> not permitted).
* @param data the data.
*
* @return The dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable[] rowKeys,
Comparable[] columnKeys,
double[][] data) {
// check arguments...
if (rowKeys == null) {
throw new IllegalArgumentException("Null 'rowKeys' argument.");
}
if (columnKeys == null) {
throw new IllegalArgumentException("Null 'columnKeys' argument.");
}
if (ArrayUtilities.hasDuplicateItems(rowKeys)) {
throw new IllegalArgumentException("Duplicate items in 'rowKeys'.");
}
if (ArrayUtilities.hasDuplicateItems(columnKeys)) {
throw new IllegalArgumentException(
"Duplicate items in 'columnKeys'."
);
}
if (rowKeys.length != data.length) {
throw new IllegalArgumentException(
"The number of row keys does not match the number of rows in "
+ "the data array."
);
}
int columnCount = 0;
for (int r = 0; r < data.length; r++) {
columnCount = Math.max(columnCount, data[r].length);
}
if (columnKeys.length != columnCount) {
throw new IllegalArgumentException(
"The number of column keys does not match the number of "
+ "columns in the data array."
);
}
// now do the work...
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int r = 0; r < data.length; r++) {
Comparable rowKey = rowKeys[r];
for (int c = 0; c < data[r].length; c++) {
Comparable columnKey = columnKeys[c];
result.addValue(new Double(data[r][c]), rowKey, columnKey);
}
}
return result;
}
示例3: createCategoryDataset
import org.jfree.util.ArrayUtilities; //导入方法依赖的package包/类
/**
* Creates a {@link CategoryDataset} that contains a copy of the data in
* an array (instances of <code>Double</code> are created to represent the
* data items).
* <p>
* Row and column keys are taken from the supplied arrays.
*
* @param rowKeys the row keys (<code>null</code> not permitted).
* @param columnKeys the column keys (<code>null</code> not permitted).
* @param data the data.
*
* @return The dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable[] rowKeys,
Comparable[] columnKeys,
double[][] data) {
// check arguments...
if (rowKeys == null) {
throw new IllegalArgumentException("Null 'rowKeys' argument.");
}
if (columnKeys == null) {
throw new IllegalArgumentException("Null 'columnKeys' argument.");
}
if (ArrayUtilities.hasDuplicateItems(rowKeys)) {
throw new IllegalArgumentException("Duplicate items in 'rowKeys'.");
}
if (ArrayUtilities.hasDuplicateItems(columnKeys)) {
throw new IllegalArgumentException(
"Duplicate items in 'columnKeys'."
);
}
if (rowKeys.length != data.length) {
throw new IllegalArgumentException(
"The number of row keys does not match the number of rows in "
+ "the data array."
);
}
int columnCount = 0;
for (int r = 0; r < data.length; r++) {
columnCount = Math.max(columnCount, data[r].length);
}
if (columnKeys.length != columnCount) {
throw new IllegalArgumentException(
"The number of column keys does not match the number of "
+ "columns in the data array."
);
}
// now do the work...
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int r = 0; r < data.length; r++) {
Comparable rowKey = rowKeys[r];
for (int c = 0; c < data[r].length; c++) {
Comparable columnKey = columnKeys[c];
result.addValue(new Double(data[r][c]), rowKey, columnKey);
}
}
return result;
}
示例4: createCategoryDataset
import org.jfree.util.ArrayUtilities; //导入方法依赖的package包/类
/**
* Creates a {@link CategoryDataset} that contains a copy of the data in
* an array (instances of <code>Double</code> are created to represent the
* data items).
* <p>
* Row and column keys are taken from the supplied arrays.
*
* @param rowKeys the row keys (<code>null</code> not permitted).
* @param columnKeys the column keys (<code>null</code> not permitted).
* @param data the data.
*
* @return The dataset.
*/
public static CategoryDataset createCategoryDataset(Comparable[] rowKeys,
Comparable[] columnKeys, double[][] data) {
// check arguments...
if (rowKeys == null) {
throw new IllegalArgumentException("Null 'rowKeys' argument.");
}
if (columnKeys == null) {
throw new IllegalArgumentException("Null 'columnKeys' argument.");
}
if (ArrayUtilities.hasDuplicateItems(rowKeys)) {
throw new IllegalArgumentException("Duplicate items in 'rowKeys'.");
}
if (ArrayUtilities.hasDuplicateItems(columnKeys)) {
throw new IllegalArgumentException(
"Duplicate items in 'columnKeys'.");
}
if (rowKeys.length != data.length) {
throw new IllegalArgumentException(
"The number of row keys does not match the number of rows in "
+ "the data array.");
}
int columnCount = 0;
for (int r = 0; r < data.length; r++) {
columnCount = Math.max(columnCount, data[r].length);
}
if (columnKeys.length != columnCount) {
throw new IllegalArgumentException(
"The number of column keys does not match the number of "
+ "columns in the data array.");
}
// now do the work...
DefaultCategoryDataset result = new DefaultCategoryDataset();
for (int r = 0; r < data.length; r++) {
Comparable rowKey = rowKeys[r];
for (int c = 0; c < data[r].length; c++) {
Comparable columnKey = columnKeys[c];
result.addValue(new Double(data[r][c]), rowKey, columnKey);
}
}
return result;
}