From: <mu...@us...> - 2012-09-23 09:09:46
|
Revision: 2504 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=2504&view=rev Author: mungady Date: 2012-09-23 09:09:36 +0000 (Sun, 23 Sep 2012) Log Message: ----------- Fix some minor FindBugs warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CombinedRangeXYPlot.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Marker.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Plot.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PolarPlot.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/SpiderWebPlot.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CombinedRangeXYPlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CombinedRangeXYPlot.java 2012-09-18 20:54:32 UTC (rev 2503) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CombinedRangeXYPlot.java 2012-09-23 09:09:36 UTC (rev 2504) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2011, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2012, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -21,13 +21,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * - * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * ------------------------ * CombinedRangeXYPlot.java * ------------------------ - * (C) Copyright 2001-2008, by Bill Kelemen and Contributors. + * (C) Copyright 2001-2012, by Bill Kelemen and Contributors. * * Original Author: Bill Kelemen; * Contributor(s): David Gilbert (for Object Refinery Limited); @@ -114,6 +114,7 @@ import org.jfree.chart.event.PlotChangeEvent; import org.jfree.chart.event.PlotChangeListener; import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.chart.util.ParamChecks; import org.jfree.data.Range; import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; @@ -173,7 +174,9 @@ /** * Returns the space between subplots. * - * @return The gap + * @return The gap. + * + * @see #setGap(double) */ public double getGap() { return this.gap; @@ -182,7 +185,9 @@ /** * Sets the amount of space between subplots. * - * @param gap the gap between subplots + * @param gap the gap between subplots. + * + * @see #getGap() */ public void setGap(double gap) { this.gap = gap; @@ -208,12 +213,11 @@ * You must ensure that the subplot has a non-null domain axis. The range * axis for the subplot will be set to <code>null</code>. * - * @param subplot the subplot. + * @param subplot the subplot (<code>null</code> not permitted). * @param weight the weight (must be 1 or greater). */ public void add(XYPlot subplot, int weight) { - - // verify valid weight + ParamChecks.nullNotPermitted(subplot, "subplot"); if (weight <= 0) { String msg = "The 'weight' must be positive."; throw new IllegalArgumentException(msg); @@ -237,9 +241,7 @@ * @param subplot the subplot (<code>null</code> not permitted). */ public void remove(XYPlot subplot) { - if (subplot == null) { - throw new IllegalArgumentException(" Null 'subplot' argument."); - } + ParamChecks.nullNotPermitted(subplot, "subplot"); int position = -1; int size = this.subplots.size(); int i = 0; @@ -370,11 +372,8 @@ * @param info collects chart drawing information (<code>null</code> * permitted). */ - public void draw(Graphics2D g2, - Rectangle2D area, - Point2D anchor, - PlotState parentState, - PlotRenderingInfo info) { + public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, + PlotState parentState, PlotRenderingInfo info) { // set up info collection... if (info != null) { @@ -507,7 +506,7 @@ } } } - + /** * Pans all domain axes by the specified percentage. * @@ -534,7 +533,7 @@ } } } - + /** * Returns the subplot (if any) that contains the (x, y) point (specified * in Java2D space). @@ -545,12 +544,8 @@ * @return A subplot (possibly <code>null</code>). */ public XYPlot findSubplot(PlotRenderingInfo info, Point2D source) { - if (info == null) { - throw new IllegalArgumentException("Null 'info' argument."); - } - if (source == null) { - throw new IllegalArgumentException("Null 'source' argument."); - } + ParamChecks.nullNotPermitted(info, "info"); + ParamChecks.nullNotPermitted(source, "source"); XYPlot result = null; int subplotIndex = info.getSubplotIndex(source); if (subplotIndex >= 0) { @@ -569,17 +564,14 @@ * @param renderer the new renderer. */ public void setRenderer(XYItemRenderer renderer) { - super.setRenderer(renderer); // not strictly necessary, since the // renderer set for the // parent plot is not used - Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setRenderer(renderer); } - } /** @@ -588,15 +580,12 @@ * @param orientation the orientation. */ public void setOrientation(PlotOrientation orientation) { - super.setOrientation(orientation); - Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setOrientation(orientation); } - } /** @@ -646,7 +635,6 @@ * @param info object containing information about the plot dimensions. */ public void handleClick(int x, int y, PlotRenderingInfo info) { - Rectangle2D dataArea = info.getDataArea(); if (dataArea.contains(x, y)) { for (int i = 0; i < this.subplots.size(); i++) { @@ -655,7 +643,6 @@ subplot.handleClick(x, y, subplotInfo); } } - } /** Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Marker.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Marker.java 2012-09-18 20:54:32 UTC (rev 2503) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Marker.java 2012-09-23 09:09:36 UTC (rev 2504) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2011, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2012, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -21,7 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * - * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * ----------- @@ -177,9 +177,10 @@ if (stroke == null) { throw new IllegalArgumentException("Null 'stroke' argument."); } - if (alpha < 0.0f || alpha > 1.0f) + if (alpha < 0.0f || alpha > 1.0f) { throw new IllegalArgumentException( "The 'alpha' value must be in the range 0.0f to 1.0f"); + } this.paint = paint; this.stroke = stroke; @@ -325,9 +326,10 @@ * @see #getAlpha() */ public void setAlpha(float alpha) { - if (alpha < 0.0f || alpha > 1.0f) + if (alpha < 0.0f || alpha > 1.0f) { throw new IllegalArgumentException( "The 'alpha' value must be in the range 0.0f to 1.0f"); + } this.alpha = alpha; notifyListeners(new MarkerChangeEvent(this)); } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Plot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Plot.java 2012-09-18 20:54:32 UTC (rev 2503) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/Plot.java 2012-09-23 09:09:36 UTC (rev 2504) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2011, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2012, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -21,13 +21,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * - * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * --------- * Plot.java * --------- - * (C) Copyright 2000-2011, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2012, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Sylvain Vieujot; @@ -748,9 +748,10 @@ * @see #getBackgroundImageAlpha() */ public void setBackgroundImageAlpha(float alpha) { - if (alpha < 0.0f || alpha > 1.0f) + if (alpha < 0.0f || alpha > 1.0f) { throw new IllegalArgumentException( "The 'alpha' value must be in the range 0.0f to 1.0f."); + } if (this.backgroundImageAlpha != alpha) { this.backgroundImageAlpha = alpha; fireChangeEvent(); Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PolarPlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PolarPlot.java 2012-09-18 20:54:32 UTC (rev 2503) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PolarPlot.java 2012-09-23 09:09:36 UTC (rev 2504) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2011, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2012, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -21,7 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * - * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * -------------- @@ -127,7 +127,7 @@ /** The default margin. */ private static final int DEFAULT_MARGIN = 20; - + /** The annotation margin. */ private static final double ANNOTATION_MARGIN = 7.0; @@ -140,11 +140,11 @@ /** * The default angle offset. - * + * * @since 1.0.14 */ public static final double DEFAULT_ANGLE_OFFSET = -90.0; - + /** The default grid line stroke. */ public static final Stroke DEFAULT_GRIDLINE_STROKE = new BasicStroke( 0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, @@ -183,18 +183,18 @@ /** * An offset for the angles, to start with 0 degrees at north, east, south * or west. - * + * * @since 1.0.14 */ private double angleOffset; /** * A flag indicating if the angles increase counterclockwise or clockwise. - * + * * @since 1.0.14 */ private boolean counterClockwise; - + /** A flag that controls whether or not the angle labels are visible. */ private boolean angleLabelsVisible = true; @@ -227,17 +227,17 @@ * @since 1.0.15 */ private boolean radiusMinorGridlinesVisible; - + /** The annotations for the plot. */ private List cornerTextItems = new ArrayList(); - /** + /** * The actual margin in pixels. * * @since 1.0.14 */ private int margin; - + /** * An optional collection of legend items that can be returned by the * getLegendItems() method. @@ -298,7 +298,7 @@ this.axisLocations.set(5, PolarAxisLocation.NORTH_RIGHT); this.axisLocations.set(6, PolarAxisLocation.WEST_ABOVE); this.axisLocations.set(7, PolarAxisLocation.SOUTH_LEFT); - + this.renderers = new ObjectList(); this.renderers.set(0, renderer); if (renderer != null) { @@ -347,7 +347,7 @@ * @return The axis (<code>null</code> possible). * * @see #setAxis(int, ValueAxis) - * + * * @since 1.0.14 */ public ValueAxis getAxis(int index) { @@ -576,7 +576,7 @@ * @param dataset the dataset (<code>null</code> permitted). * * @see #getDataset(int) - * + * * @since 1.0.14 */ public void setDataset(int index, XYDataset dataset) { @@ -742,7 +742,7 @@ /** * Returns the offset that is used for all angles. - * + * * @return The offset for the angles. * @since 1.0.14 */ @@ -753,10 +753,10 @@ /** * Sets the offset that is used for all angles and sends a * {@link PlotChangeEvent} to all registered listeners. - * + * * This is useful to let 0 degrees be at the north, east, south or west * side of the chart. - * + * * @param offset The offset * @since 1.0.14 */ @@ -767,7 +767,7 @@ /** * Get the direction for growing angle degrees. - * + * * @return <code>true</code> if angle increases counterclockwise, * <code>false</code> otherwise. * @since 1.0.14 @@ -778,10 +778,10 @@ /** * Sets the flag for increasing angle degrees direction. - * + * * <code>true</code> for counterclockwise, <code>false</code> for * clockwise. - * + * * @param counterClockwise The flag. * @since 1.0.14 */ @@ -1034,11 +1034,11 @@ this.radiusGridlinePaint = paint; fireChangeEvent(); } - + /** * Return the current value of the flag indicating if radial minor * grid-lines will be drawn or not. - * + * * @return Returns <code>true</code> if radial minor grid-lines are drawn. * @since 1.0.15 */ @@ -1059,7 +1059,7 @@ /** * Returns the margin around the plot area. - * + * * @return The actual margin in pixels. * * @since 1.0.14 @@ -1071,7 +1071,7 @@ /** * Set the margin around the plot area and sends a * {@link PlotChangeEvent} to all registered listeners. - * + * * @param margin The new margin in pixels. * * @since 1.0.14 @@ -1166,7 +1166,7 @@ List ticks = new ArrayList(); for (double currentTickVal = 0.0; currentTickVal < 360.0; currentTickVal += this.angleTickUnit.getSize()) { - + TextAnchor ta = calculateTextAnchor(currentTickVal); NumberTick tick = new NumberTick(new Double(currentTickVal), this.angleTickUnit.valueToString(currentTickVal), @@ -1178,7 +1178,7 @@ /** * Calculate the text position for the given degrees. - * + * * @return The optimal text anchor. * @since 1.0.14 */ @@ -1191,7 +1191,7 @@ while (offset < 0.0) { offset += 360.0; } - double normalizedAngle = (((this.counterClockwise ? -1 : 1) + double normalizedAngle = (((this.counterClockwise ? -1 : 1) * angleDegrees) + offset) % 360; while (this.counterClockwise && (normalizedAngle < 0.0)) { normalizedAngle += 360.0; @@ -1314,7 +1314,7 @@ } return valueAxis; } - + /** * Returns the index of the given axis. * @@ -1532,7 +1532,7 @@ result = axis.draw(g2, centerY, plotArea, dataArea, RectangleEdge.BOTTOM, null); } - + return result; } @@ -1617,7 +1617,7 @@ /** * Create a list of ticks based on the given list and plot properties. * Only ticks of a specific type may be in the result list. - * + * * @param allTicks A list of all available ticks for the primary axis. * <code>null</code> not permitted. * @return Ticks to use for radial gridlines. @@ -1630,8 +1630,9 @@ while (it.hasNext()) { ValueTick tick = (ValueTick) it.next(); if (isRadiusMinorGridlinesVisible() || - TickType.MAJOR.equals(tick.getTickType())) + TickType.MAJOR.equals(tick.getTickType())) { ticks.add(tick); + } } return ticks; } @@ -1910,7 +1911,7 @@ } clone.cornerTextItems = new ArrayList(this.cornerTextItems); - + return clone; } @@ -2116,8 +2117,9 @@ public Point translateToJava2D(double angleDegrees, double radius, ValueAxis axis, Rectangle2D dataArea) { - if (counterClockwise) + if (counterClockwise) { angleDegrees = -angleDegrees; + } double radians = Math.toRadians(angleDegrees + this.angleOffset); double minx = dataArea.getMinX() + this.margin; @@ -2130,17 +2132,17 @@ double midX = minx + halfWidth; double midY = miny + halfHeight; - + double l = Math.min(halfWidth, halfHeight); Rectangle2D quadrant = new Rectangle2D.Double(midX, midY, l, l); double axisMin = axis.getLowerBound(); double adjustedRadius = Math.max(radius, axisMin); - + double length = axis.valueToJava2D(adjustedRadius, quadrant, RectangleEdge.BOTTOM) - midX; float x = (float) (midX + Math.cos(radians) * length); float y = (float) (midY + Math.sin(radians) * length); - + int ix = Math.round(x); int iy = Math.round(y); Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/SpiderWebPlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/SpiderWebPlot.java 2012-09-18 20:54:32 UTC (rev 2503) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/SpiderWebPlot.java 2012-09-23 09:09:36 UTC (rev 2504) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2011, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2012, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -21,7 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * - * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * * ------------------ @@ -65,7 +65,7 @@ * 02-Jun-2008 : Fixed bug with chart entities using TableOrder.BY_COLUMN (DG); * 02-Jun-2008 : Fixed bug with null dataset (DG); * 01-Jun-2009 : Set series key in getLegendItems() (DG); - * + * */ package org.jfree.chart.plot; @@ -1091,7 +1091,7 @@ if (keys == null) { return result; } - + int series = 0; Iterator iterator = keys.iterator(); Shape shape = getLegendItemShape(); @@ -1178,8 +1178,9 @@ } // ensure we have a maximum value to use on the axes - if (this.maxValue == DEFAULT_MAX_VALUE) + if (this.maxValue == DEFAULT_MAX_VALUE) { calculateMaxValue(seriesCount, catCount); + } // Next, setup the plot area This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |