From: David G. <mu...@us...> - 2007-05-21 15:32:16
|
Update of /cvsroot/jfreechart/jfreechart/source/org/jfree/data/statistics In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31154/source/org/jfree/data/statistics Modified Files: Tag: STABLE_1-0-0 SimpleHistogramDataset.java Log Message: 2007-05-21 David Gilbert <dav...@ob...> * source/org/jfree/data/statistics/SimpleHistogramDataset.java (clearObservations): New method, (removeAllBins): Likewise, * tests/org/jfree/data/statistics/junit/SimpleHistogramDatasetTests.java (testClearObservations): New method, (testRemoveAllBins): Likewise. Index: SimpleHistogramDataset.java =================================================================== RCS file: /cvsroot/jfreechart/jfreechart/source/org/jfree/data/statistics/SimpleHistogramDataset.java,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** SimpleHistogramDataset.java 25 Oct 2005 21:34:46 -0000 1.7.2.1 --- SimpleHistogramDataset.java 21 May 2007 15:32:11 -0000 1.7.2.2 *************** *** 3,7 **** * =========================================================== * ! * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html --- 3,7 ---- * =========================================================== * ! * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html *************** *** 28,35 **** * SimpleHistogramDataset.java * --------------------------- ! * (C) Copyright 2005 by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); ! * Contributor(s): -; * * $Id$ --- 28,35 ---- * SimpleHistogramDataset.java * --------------------------- ! * (C) Copyright 2005, 2007, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); ! * Contributor(s): Sergei Ivanov; * * $Id$ *************** *** 38,41 **** --- 38,42 ---- * ------- * 10-Jan-2005 : Version 1 (DG); + * 21-May-2007 : Added clearObservations() and removeAllBins() (SI); * */ *************** *** 213,217 **** * Adds a set of values to the dataset. * ! * @param values the values. */ public void addObservations(double[] values) { --- 214,218 ---- * Adds a set of values to the dataset. * ! * @param values the values (<code>null</code> not permitted). */ public void addObservations(double[] values) { *************** *** 223,226 **** --- 224,253 ---- /** + * Removes all current observation data and sends a + * {@link DatasetChangeEvent} to all registered listeners. + * + * @since 1.0.6 + */ + public void clearObservations() { + Iterator iterator = this.bins.iterator(); + while (iterator.hasNext()) { + SimpleHistogramBin bin = (SimpleHistogramBin) iterator.next(); + bin.setItemCount(0); + } + notifyListeners(new DatasetChangeEvent(this, this)); + } + + /** + * Removes all bins and sends a {@link DatasetChangeEvent} to all + * registered listeners. + * + * @since 1.0.6 + */ + public void removeAllBins() { + this.bins = new ArrayList(); + notifyListeners(new DatasetChangeEvent(this, this)); + } + + /** * Returns the x-value for an item within a series. The x-values may or * may not be returned in ascending order, that is up to the class |