org.jfree.util.ArrayUtilities Java Examples
The following examples show how to use
org.jfree.util.ArrayUtilities.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DatasetUtilities.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #2
Source File: DatasetUtilities.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #3
Source File: DatasetUtilities.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * 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; }
Example #4
Source File: DatasetUtilities.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example #5
Source File: DatasetUtilities.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #6
Source File: DatasetUtilities.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #7
Source File: FastScatterPlot.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * 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; }
Example #8
Source File: FastScatterPlot.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * 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; }
Example #9
Source File: FastScatterPlot.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * 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; }
Example #10
Source File: FastScatterPlot.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * 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; }
Example #11
Source File: FastScatterPlot.java From opensim-gui with Apache License 2.0 | 4 votes |
/** * 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; }
Example #12
Source File: DatasetUtilities.java From opensim-gui with Apache License 2.0 | 4 votes |
/** * 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; }
Example #13
Source File: FastScatterPlot.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * 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; }
Example #14
Source File: FastScatterPlot.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * 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; }