本文整理汇总了Java中org.jfree.util.ArrayUtilities类的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtilities类的具体用法?Java ArrayUtilities怎么用?Java ArrayUtilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArrayUtilities类属于org.jfree.util包,在下文中一共展示了ArrayUtilities类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEqualReferencesInArrays
import org.jfree.util.ArrayUtilities; //导入依赖的package包/类
/**
* Some checks for the equalReferencesInArrays() method.
*/
public void testEqualReferencesInArrays() {
Object[] a1 = new Object[] {};
Object[] a2 = new Object[] {};
Object[] a3 = new Object[] {null};
Object[] a4 = new Object[] {null};
Object[] a5 = new Object[] {"A"};
Object[] a6 = new Object[] {"A"};
Object[] a7 = new Object[] {"A", "B"};
Object[] a8 = new Object[] {"A", "B"};
Object[] a9 = new Object[] {"A", null};
Object[] a10 = new Object[] {"A", null};
assertTrue(ArrayUtilities.equalReferencesInArrays(a1, a2));
assertFalse(ArrayUtilities.equalReferencesInArrays(a1, a3));
assertTrue(ArrayUtilities.equalReferencesInArrays(a3, a4));
assertFalse(ArrayUtilities.equalReferencesInArrays(a3, a5));
assertTrue(ArrayUtilities.equalReferencesInArrays(a5, a6));
assertFalse(ArrayUtilities.equalReferencesInArrays(a5, a7));
assertTrue(ArrayUtilities.equalReferencesInArrays(a7, a8));
assertFalse(ArrayUtilities.equalReferencesInArrays(a7, a9));
assertTrue(ArrayUtilities.equalReferencesInArrays(a9, a10));
}
示例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) {
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;
}
示例3: testHasDuplicateItems
import org.jfree.util.ArrayUtilities; //导入依赖的package包/类
/**
* Some tests for the hasDuplicateItems() method.
*/
public void testHasDuplicateItems() {
Object[] a1 = new Object[] {"1", "2", "3"};
Object[] a2 = new Object[] {"1", "1", "3"};
Object[] a3 = new Object[] {null, "2", null};
assertFalse(ArrayUtilities.hasDuplicateItems(a1));
assertTrue(ArrayUtilities.hasDuplicateItems(a2));
assertFalse(ArrayUtilities.hasDuplicateItems(a3));
}
示例4: equals
import org.jfree.util.ArrayUtilities; //导入依赖的package包/类
/**
* Tests an object for equality with this instance.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof FastScatterPlot)) {
return false;
}
FastScatterPlot that = (FastScatterPlot) obj;
if (!ArrayUtilities.equal(this.data, that.data)) {
return false;
}
if (!ObjectUtilities.equal(this.domainAxis, that.domainAxis)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeAxis, that.rangeAxis)) {
return false;
}
if (!PaintUtilities.equal(this.paint, that.paint)) {
return false;
}
if (this.domainGridlinesVisible != that.domainGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.domainGridlinePaint,
that.domainGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.domainGridlineStroke,
that.domainGridlineStroke)) {
return false;
}
if (!this.rangeGridlinesVisible == that.rangeGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.rangeGridlinePaint,
that.rangeGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeGridlineStroke,
that.rangeGridlineStroke)) {
return false;
}
return true;
}
示例5: 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;
}
示例6: equals
import org.jfree.util.ArrayUtilities; //导入依赖的package包/类
/**
* Tests an arbitrary object for equality with this plot. Note that
* <code>FastScatterPlot</code> carries its data around with it (rather
* than referencing a dataset), and the data is included in the
* equality test.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof FastScatterPlot)) {
return false;
}
FastScatterPlot that = (FastScatterPlot) obj;
if (this.domainPannable != that.domainPannable) {
return false;
}
if (this.rangePannable != that.rangePannable) {
return false;
}
if (!ArrayUtilities.equal(this.data, that.data)) {
return false;
}
if (!ObjectUtilities.equal(this.domainAxis, that.domainAxis)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeAxis, that.rangeAxis)) {
return false;
}
if (!PaintUtilities.equal(this.paint, that.paint)) {
return false;
}
if (this.domainGridlinesVisible != that.domainGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.domainGridlinePaint,
that.domainGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.domainGridlineStroke,
that.domainGridlineStroke)) {
return false;
}
if (!this.rangeGridlinesVisible == that.rangeGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.rangeGridlinePaint,
that.rangeGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeGridlineStroke,
that.rangeGridlineStroke)) {
return false;
}
return true;
}
示例7: equals
import org.jfree.util.ArrayUtilities; //导入依赖的package包/类
/**
* Tests an object for equality with this instance.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof FastScatterPlot)) {
return false;
}
FastScatterPlot that = (FastScatterPlot) obj;
if (!ArrayUtilities.equal(this.data, that.data)) {
return false;
}
if (!ObjectUtilities.equal(this.domainAxis, that.domainAxis)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeAxis, that.rangeAxis)) {
return false;
}
if (!PaintUtilities.equal(this.paint, that.paint)) {
return false;
}
if (this.domainGridlinesVisible != that.domainGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.domainGridlinePaint,
that.domainGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.domainGridlineStroke,
that.domainGridlineStroke)) {
return false;
}
if (!this.rangeGridlinesVisible == that.rangeGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.rangeGridlinePaint,
that.rangeGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeGridlineStroke,
that.rangeGridlineStroke)) {
return false;
}
return true;
}
示例8: 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;
}
示例9: equals
import org.jfree.util.ArrayUtilities; //导入依赖的package包/类
/**
* Tests an arbitrary object for equality with this plot. Note that
* <code>FastScatterPlot</code> carries its data around with it (rather
* than referencing a dataset), and the data is included in the
* equality test.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof FastScatterPlot)) {
return false;
}
FastScatterPlot that = (FastScatterPlot) obj;
if (this.domainPannable != that.domainPannable) {
return false;
}
if (this.rangePannable != that.rangePannable) {
return false;
}
if (!ArrayUtilities.equal(this.data, that.data)) {
return false;
}
if (!ObjectUtilities.equal(this.domainAxis, that.domainAxis)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeAxis, that.rangeAxis)) {
return false;
}
if (!PaintUtilities.equal(this.paint, that.paint)) {
return false;
}
if (this.domainGridlinesVisible != that.domainGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.domainGridlinePaint,
that.domainGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.domainGridlineStroke,
that.domainGridlineStroke)) {
return false;
}
if (!this.rangeGridlinesVisible == that.rangeGridlinesVisible) {
return false;
}
if (!PaintUtilities.equal(this.rangeGridlinePaint,
that.rangeGridlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.rangeGridlineStroke,
that.rangeGridlineStroke)) {
return false;
}
return true;
}
示例10: 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;
}