⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultboxandwhiskerxydataset.java

📁 这是一个segy数据显示程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2004, by Object Refinery Limited and Contributors. * * Project Info:  http://www.jfree.org/jfreechart/index.html * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc.  * in the United States and other countries.] * * ---------------------------------- * DefaultBoxAndWhiskerXYDataset.java * ---------------------------------- * (C) Copyright 2003, by David Browning and Contributors. * * Original Author:  David Browning (for Australian Institute of Marine Science); * Contributor(s):   David Gilbert (for Object Refinery Limited); * * $Id: DefaultBoxAndWhiskerXYDataset.java,v 1.6 2004/05/06 07:42:47 mungady Exp $ * * Changes * ------- * 05-Aug-2003 : Version 1, contributed by David Browning (DG); * 08-Aug-2003 : Minor changes to comments (DB) *               Allow average to be null  - average is a perculiar AIMS requirement *                 which probably should be stripped out and overlaid if required... *               Added a number of methods to allow the max and min non-outlier and *                 non-farout values to be calculated * 12-Aug-2003   Changed the getYValue to return the highest outlier value *               Added getters and setters for outlier and farout coefficients * 27-Aug-2003 : Renamed DefaultBoxAndWhiskerDataset --> DefaultBoxAndWhiskerXYDataset (DG); * 06-May-2004 : Now extends AbstractXYDataset (DG); * */package org.jfree.data.statistics;import java.util.ArrayList;import java.util.Date;import java.util.List;import org.jfree.data.AbstractXYDataset;import org.jfree.data.Range;import org.jfree.data.RangeInfo;/** * A simple implementation of the {@link BoxAndWhiskerXYDataset}. * * @author David Browning */public class DefaultBoxAndWhiskerXYDataset extends AbstractXYDataset                                            implements BoxAndWhiskerXYDataset,                                                      RangeInfo {    /** The series name. */    private String seriesName;    /** Storage for the dates. */    private List dates;    /** Storage for the box and whisker statistics. */    private List items;    /** The minimum range value. */    private Number minimumRangeValue;    /** The maximum range value. */    private Number maximumRangeValue;    /** The range of values. */    private Range valueRange;    /** The coefficient used to calculate outliers. Tukey's default value is 1.5 (see EDA)     * Any value which is greater than Q3 + (interquartile range * outlier coefficient) is     * considered to be an outlier.     * Can be altered if the data is particularly skewed.     */    private double outlierCoefficient = 1.5;    /** The coefficient used to calculate farouts. Tukey's default value is 2 (see EDA)     * Any value which is greater than Q3 + (interquartile range * farout coefficient) is     * considered to be a farout.     *  Can be altered if the data is particularly skewed.     */    private double faroutCoefficient = 2.0;    /**     * Constructs a new box and whisker dataset.     * <p>     * The current implementation allows only one series in the dataset.     * This may be extended in a future version.     *     * @param seriesName  the name of the series.     */    public DefaultBoxAndWhiskerXYDataset(final String seriesName) {        this.seriesName = seriesName;        this.dates = new ArrayList();        this.items = new ArrayList();        this.minimumRangeValue = null;        this.maximumRangeValue = null;        this.valueRange = null;            }    /**     * Adds an item to the dataset.     *      * @param date  the date.     * @param item  the item.     */    public void add(final Date date, final BoxAndWhiskerItem item) {        this.dates.add(date);        this.items.add(item);        if (this.minimumRangeValue == null) {            this.minimumRangeValue = item.getMinRegularValue();        }        else {            if (item.getMinRegularValue().doubleValue() < this.minimumRangeValue.doubleValue()) {                this.minimumRangeValue = item.getMinRegularValue();            }        }        if (this.maximumRangeValue == null) {            this.maximumRangeValue = item.getMaxRegularValue();        }        else {            if (item.getMaxRegularValue().doubleValue() > this.maximumRangeValue.doubleValue()) {                this.maximumRangeValue = item.getMaxRegularValue();            }        }        this.valueRange = new Range(this.minimumRangeValue.doubleValue(),                                     this.maximumRangeValue.doubleValue());    }        /**     * Returns the name of the series stored in this dataset.     *     * @param i  the index of the series. Currently ignored.     * @return the name of this series.     */    public String getSeriesName(final int i) {        return this.seriesName;    }    /**     * Returns the x-value for one item in a series.     * <p>     * The value returned is a Long object generated from the underlying Date object.     *     * @param series  the series (zero-based index).     * @param item  the item (zero-based index).     *     * @return the x-value.     */    public Number getXValue(final int series, final int item) {        return new Long(((Date) this.dates.get(item)).getTime());    }    /**     * Returns the x-value for one item in a series, as a Date.     * <p>     * This method is provided for convenience only.     *     * @param series  the series (zero-based index).     * @param item  the item (zero-based index).     *     * @return the x-value as a Date.     */    public Date getXDate(final int series, final int item) {        return (Date) this.dates.get(item);    }    /**     * Returns the y-value for one item in a series.     * <p>     * This method (from the XYDataset interface) is mapped to the getMaxNonOutlierValue(...)      * method.     *     * @param series  the series (zero-based index).     * @param item  the item (zero-based index).     *     * @return the y-value.     */    public Number getYValue(final int series, final int item) {        return new Double(this.getMeanValue(series, item).doubleValue());      }    /**     * Returns the mean for the specified series and item.     *     * @param series  the series (zero-based index).     * @param item  the item (zero-based index).     *     * @return the mean for the specified series and item.     */    public Number getMeanValue(final int series, final int item) {        Number result = null;        final BoxAndWhiskerItem stats = (BoxAndWhiskerItem) this.items.get(item);        if (stats != null) {            result = stats.getMean();        }        return result;    }    /**     * Returns the median-value for the specified series and item.     *     * @param series  the series (zero-based index).     * @param item  the item (zero-based index).     *     * @return the median-value for the specified series and item.     */    public Number getMedianValue(final int series, final int item) {        Number result = null;        final BoxAndWhiskerItem stats = (BoxAndWhiskerItem) this.items.get(item);        if (stats != null) {            result = stats.getMedian();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -