StandardChartTheme.java

Index Score
org.jfree.chart
JFreeChart

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
DECL_COMMENTSComments in declarations
RETURNSNumber of return points from functions
DOC_COMMENTNumber of javadoc comment lines
COMMENTSComment lines
INTERFACE_COMPLEXITYInterface complexity
CYCLOMATICCyclomatic complexity
SIZESize of the file in bytes
BLOCKSNumber of blocks
LINESNumber of lines in the source file
EXITSProcedure exits
LOGICAL_LINESNumber of statements
OPERATORSNumber of operators
FUNCTIONSNumber of function declarations
PROGRAM_LENGTHHalstead program length
LOCLines of code
ELOCEffective lines of code
OPERANDSNumber of operands
UNIQUE_OPERANDSNumber of unique operands
COMPARISONSNumber of comparison operators
PROGRAM_VOCABHalstead program vocabulary
LOOPSNumber of loops
JAVA0254JAVA0254 Use enhanced for loop construct instead of Iterator
PARAMSNumber of formal parameter declarations
JAVA0145JAVA0145 Tab character used in source file
JAVA0034JAVA0034 Missing braces in if statement
EXEC_COMMENTSComments in executable code
JAVA0076JAVA0076 Use of magic number
JAVA0082JAVA0082 Unnecessary widening cast
WHITESPACENumber of whitespace lines
LINE_COMMENTNumber of line comments
JAVA0117JAVA0117 Missing javadoc: method 'method'
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0265JAVA0265 Use of Throwable.printStackTrace()
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
UNIQUE_OPERATORSNumber of unique operators
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2008, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ----------------------- * StandardChartTheme.java * ----------------------- * (C) Copyright 2008, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * * Changes * ------- * 14-Aug-2008 : Version 1 (DG); * */ package org.jfree.chart; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Paint; import java.awt.Stroke; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Iterator; import java.util.List; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.PeriodAxis; import org.jfree.chart.axis.PeriodAxisLabelInfo; import org.jfree.chart.axis.SymbolAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.block.Block; import org.jfree.chart.block.BlockContainer; import org.jfree.chart.block.LabelBlock; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.CombinedDomainCategoryPlot; import org.jfree.chart.plot.CombinedDomainXYPlot; import org.jfree.chart.plot.CombinedRangeCategoryPlot; import org.jfree.chart.plot.CombinedRangeXYPlot; import org.jfree.chart.plot.DefaultDrawingSupplier; import org.jfree.chart.plot.DrawingSupplier; import org.jfree.chart.plot.FastScatterPlot; import org.jfree.chart.plot.MeterPlot; import org.jfree.chart.plot.MultiplePiePlot; import org.jfree.chart.plot.PieLabelLinkStyle; import org.jfree.chart.plot.PiePlot; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PolarPlot; import org.jfree.chart.plot.SpiderWebPlot; import org.jfree.chart.plot.ThermometerPlot; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.AbstractRenderer; import org.jfree.chart.renderer.category.BarPainter; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.chart.renderer.category.BarRenderer3D; import org.jfree.chart.renderer.category.CategoryItemRenderer; import org.jfree.chart.renderer.category.GradientBarPainter; import org.jfree.chart.renderer.category.LineRenderer3D; import org.jfree.chart.renderer.category.MinMaxCategoryRenderer; import org.jfree.chart.renderer.category.StatisticalBarRenderer; import org.jfree.chart.renderer.xy.GradientXYBarPainter; import org.jfree.chart.renderer.xy.XYBarPainter; import org.jfree.chart.renderer.xy.XYBarRenderer; import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.chart.title.CompositeTitle; import org.jfree.chart.title.LegendTitle; import org.jfree.chart.title.PaintScaleLegend; import org.jfree.chart.title.TextTitle; import org.jfree.chart.title.Title; import org.jfree.chart.util.PaintUtilities; import org.jfree.chart.util.PublicCloneable; import org.jfree.chart.util.RectangleInsets; import org.jfree.chart.util.SerialUtilities; /** * A default implementation of the {@link ChartTheme} interface. This * implementation just collects a whole bunch of chart attributes and mimics * the manual process of applying each attribute to the right sub-object * within the JFreeChart instance. It's not elegant code, but it works. * * @since 1.0.11 */ public class StandardChartTheme implements ChartTheme, Cloneable, PublicCloneable, Serializable { /** The name of this theme. */ private String name; /** * The largest font size. Use for the main chart title. */ private Font extraLargeFont; /** * A large font. Used for subtitles. */ private Font largeFont; /** * The regular font size. Used for axis tick labels, legend items etc. */ private Font regularFont; /** The paint used to display the main chart title. */ private transient Paint titlePaint; /** The paint used to display subtitles. */ private transient Paint subtitlePaint; /** The background paint for the chart. */ private transient Paint chartBackgroundPaint; /** The legend background paint. */ private transient Paint legendBackgroundPaint; /** The legend item paint. */ private transient Paint legendItemPaint; /** The drawing supplier. */ private DrawingSupplier drawingSupplier; /** The background paint for the plot. */ private transient Paint plotBackgroundPaint; /** The plot outline paint. */ private transient Paint plotOutlinePaint; /** The label link style for pie charts. */ private PieLabelLinkStyle labelLinkStyle; /** The label link paint for pie charts. */ private transient Paint labelLinkPaint; /** The domain grid line paint. */ private transient Paint domainGridlinePaint; /** The range grid line paint. */ private transient Paint rangeGridlinePaint; /** The axis offsets. */ private RectangleInsets axisOffset; /** The axis label paint. */ private transient Paint axisLabelPaint; /** The tick label paint. */ private transient Paint tickLabelPaint; /** The item label paint. */ private transient Paint itemLabelPaint; /** * A flag that controls whether or not shadows are visible (for example, * in a bar renderer). */ private boolean shadowVisible; /** The shadow paint. */ private transient Paint shadowPaint; /** The bar painter. */ private BarPainter barPainter; /** The XY bar painter. */ private XYBarPainter xyBarPainter; /** The thermometer paint. */ private transient Paint thermometerPaint; /** * The paint used to fill the interior of the 'walls' in the background * of a plot with a 3D effect. Applied to BarRenderer3D. */ private transient Paint wallPaint; /** The error indicator paint for the {@link StatisticalBarRenderer}. */ private transient Paint errorIndicatorPaint; /** The grid band paint for a {@link SymbolAxis}. */ private transient Paint gridBandPaint = SymbolAxis.DEFAULT_GRID_BAND_PAINT; /** The grid band alternate paint for a {@link SymbolAxis}. */ private transient Paint gridBandAlternatePaint = SymbolAxis.DEFAULT_GRID_BAND_ALTERNATE_PAINT; /** * Creates and returns the default 'JFree' chart theme. * * @return A chart theme. */ public static ChartTheme createJFreeTheme() { return new StandardChartTheme("JFree"); } /** * Creates and returns a theme called "Darkness". In this theme, the * charts have a black background. * * @return The "Darkness" theme. */ public static ChartTheme createDarknessTheme() { StandardChartTheme theme = new StandardChartTheme("Darkness"); theme.titlePaint = Color.white; theme.subtitlePaint = Color.white; theme.legendBackgroundPaint = Color.black; theme.legendItemPaint = Color.white; theme.chartBackgroundPaint = Color.black; theme.plotBackgroundPaint = Color.black; theme.plotOutlinePaint = Color.yellow; theme.labelLinkPaint = Color.lightGray; theme.tickLabelPaint = Color.white; theme.axisLabelPaint = Color.white; theme.shadowPaint = Color.darkGray; theme.itemLabelPaint = Color.white; theme.drawingSupplier = new DefaultDrawingSupplier( new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587")}, new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC")}, new Stroke[] { new BasicStroke(2.0f)}, new Stroke[] { new BasicStroke(0.5f)}, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); theme.wallPaint = Color.darkGray; theme.errorIndicatorPaint = Color.lightGray; theme.gridBandPaint = new Color(255, 255, 255, 20); theme.gridBandAlternatePaint = new Color(255, 255, 255, 40); return theme; } /** * Creates and returns a {@link ChartTheme} that doesn't apply any changes * to the JFreeChart defaults. This produces the "legacy" look for * JFreeChart. * * @return A legacy theme. */ public static ChartTheme createLegacyTheme() { StandardChartTheme theme = new StandardChartTheme("Legacy") { public void apply(JFreeChart chart) { // do nothing at all } }; return theme; } /** * Creates a new default instance. * * @param name the name of the theme (<code>null</code> not permitted). */ public StandardChartTheme(String name) { if (name == null) { throw new IllegalArgumentException("Null 'name' argument."); } this.name = name; this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20); this.largeFont = new Font("Tahoma", Font.BOLD, 14); this.regularFont = new Font("Tahoma", Font.PLAIN, 12); this.titlePaint = Color.black; this.subtitlePaint = Color.black; this.legendBackgroundPaint = Color.white; this.legendItemPaint = Color.darkGray; this.chartBackgroundPaint = Color.white; this.drawingSupplier = new DefaultDrawingSupplier(); this.plotBackgroundPaint = Color.lightGray; this.plotOutlinePaint = Color.black; this.labelLinkPaint = Color.black; this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE; this.axisOffset = new RectangleInsets(4, 4, 4, 4); this.domainGridlinePaint = Color.white; this.rangeGridlinePaint = Color.white; this.axisLabelPaint = Color.darkGray; this.tickLabelPaint = Color.darkGray; this.barPainter = new GradientBarPainter(); this.xyBarPainter = new GradientXYBarPainter(); this.shadowVisible = true; this.shadowPaint = Color.gray; this.itemLabelPaint = Color.black; this.thermometerPaint = Color.white; this.wallPaint = BarRenderer3D.DEFAULT_WALL_PAINT; this.errorIndicatorPaint = Color.black; } /** * Returns the largest font for this theme. * * @return The largest font for this theme. * * @see #setExtraLargeFont(Font) */ public Font getExtraLargeFont() { return this.extraLargeFont; } /** * Sets the largest font for this theme. * * @param font the font (<code>null</code> not permitted). * * @see #getExtraLargeFont() */ public void setExtraLargeFont(Font font) { if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } this.extraLargeFont = font; } /** * Returns the large font for this theme. * * @return The large font (never <code>null</code>). * * @see #setLargeFont(Font) */ public Font getLargeFont() { return this.largeFont; } /** * Sets the large font for this theme. * * @param font the font (<code>null</code> not permitted). * * @see #getLargeFont() */ public void setLargeFont(Font font) { this.largeFont = font; } /** * Returns the regular font. * * @return The regular font (never <code>null</code>). * * @see #setRegularFont(Font) */ public Font getRegularFont() { return this.regularFont; } /** * Sets the regular font for this theme. * * @param font the font (<code>null</code> not permitted). * * @see #getRegularFont() */ public void setRegularFont(Font font) { this.regularFont = font; } /** * Returns the title paint. * * @return The title paint (never <code>null</code>). * * @see #setTitlePaint(Paint) */ public Paint getTitlePaint() { return this.titlePaint; } /** * Sets the title paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getTitlePaint() */ public void setTitlePaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.titlePaint = paint; } /** * Returns the subtitle paint. * * @return The subtitle paint (never <code>null</code>). * * @see #setSubtitlePaint(Paint) */ public Paint getSubtitlePaint() { return this.subtitlePaint; } /** * Sets the subtitle paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getSubtitlePaint() */ public void setSubtitlePaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.subtitlePaint = paint; } /** * Returns the chart background paint. * * @return The chart background paint (never <code>null</code>). * * @see #setChartBackgroundPaint(Paint) */ public Paint getChartBackgroundPaint() { return this.chartBackgroundPaint; } /** * Sets the chart background paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getChartBackgroundPaint() */ public void setChartBackgroundPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.chartBackgroundPaint = paint; } /** * Returns the legend background paint. * * @return The legend background paint (never <code>null</code>). * * @see #setLegendBackgroundPaint(Paint) */ public Paint getLegendBackgroundPaint() { return this.legendBackgroundPaint; } /** * Sets the legend background paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getLegendBackgroundPaint() */ public void setLegendBackgroundPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.legendBackgroundPaint = paint; } /** * Returns the legend item paint. * * @return The legend item paint (never <code>null</code>). * * @see #setLegendItemPaint(Paint) */ public Paint getLegendItemPaint() { return this.legendItemPaint; } /** * Sets the legend item paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getLegendItemPaint() */ public void setLegendItemPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.legendItemPaint = paint; } /** * Returns the plot background paint. * * @return The plot background paint (never <code>null</code>). * * @see #setPlotBackgroundPaint(Paint) */ public Paint getPlotBackgroundPaint() { return this.plotBackgroundPaint; } /** * Sets the plot background paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getPlotBackgroundPaint() */ public void setPlotBackgroundPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.plotBackgroundPaint = paint; } /** * Returns the plot outline paint. * * @return The plot outline paint (never <code>null</code>). * * @see #setPlotOutlinePaint(Paint) */ public Paint getPlotOutlinePaint() { return this.plotOutlinePaint; } /** * Sets the plot outline paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getPlotOutlinePaint() */ public void setPlotOutlinePaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.plotOutlinePaint = paint; } /** * Returns the label link style for pie charts. * * @return The label link style (never <code>null</code>). * * @see #setLabelLinkStyle(PieLabelLinkStyle) */ public PieLabelLinkStyle getLabelLinkStyle() { return this.labelLinkStyle; } /** * Sets the label link style for pie charts. * * @param style the style (<code>null</code> not permitted). * * @see #getLabelLinkStyle() */ public void setLabelLinkStyle(PieLabelLinkStyle style) { if (style == null) { throw new IllegalArgumentException("Null 'style' argument."); } this.labelLinkStyle = style; } /** * Returns the label link paint for pie charts. * * @return The label link paint (never <code>null</code>). * * @see #setLabelLinkPaint(Paint) */ public Paint getLabelLinkPaint() { return this.labelLinkPaint; } /** * Sets the label link paint for pie charts. * * @param paint the paint (<code>null</code> not permitted). * * @see #getLabelLinkPaint() */ public void setLabelLinkPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.labelLinkPaint = paint; } /** * Returns the domain grid line paint. * * @return The domain grid line paint (never <code>null<code>). * * @see #setDomainGridlinePaint(Paint) */ public Paint getDomainGridlinePaint() { return this.domainGridlinePaint; } /** * Sets the domain grid line paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getDomainGridlinePaint() */ public void setDomainGridlinePaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.domainGridlinePaint = paint; } /** * Returns the range grid line paint. * * @return The range grid line paint (never <code>null</code>). * * @see #setRangeGridlinePaint(Paint) */ public Paint getRangeGridlinePaint() { return this.rangeGridlinePaint; } /** * Sets the range grid line paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getRangeGridlinePaint() */ public void setRangeGridlinePaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.rangeGridlinePaint = paint; } /** * Returns the axis offsets. * * @return The axis offsets (never <code>null</code>). * * @see #setAxisOffset(RectangleInsets) */ public RectangleInsets getAxisOffset() { return this.axisOffset; } /** * Sets the axis offset. * * @param offset the offset (<code>null</code> not permitted). * * @see #getAxisOffset() */ public void setAxisOffset(RectangleInsets offset) { if (offset == null) { throw new IllegalArgumentException("Null 'offset' argument."); } this.axisOffset = offset; } /** * Returns the axis label paint. * * @return The axis label paint (never <code>null</code>). * * @see #setAxisLabelPaint(Paint) */ public Paint getAxisLabelPaint() { return this.axisLabelPaint; } /** * Sets the axis label paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getAxisLabelPaint() */ public void setAxisLabelPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.axisLabelPaint = paint; } /** * Returns the tick label paint. * * @return The tick label paint (never <code>null</code>). * * @see #setTickLabelPaint(Paint) */ public Paint getTickLabelPaint() { return this.tickLabelPaint; } /** * Sets the tick label paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getTickLabelPaint() */ public void setTickLabelPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.tickLabelPaint = paint; } /** * Returns the item label paint. * * @return The item label paint (never <code>null</code>). * * @see #setItemLabelPaint(Paint) */ public Paint getItemLabelPaint() { return this.itemLabelPaint; } /** * Sets the item label paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getItemLabelPaint() */ public void setItemLabelPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.itemLabelPaint = paint; } /** * Returns the shadow visibility flag. * * @return The shadow visibility flag. * * @see #setShadowVisible(boolean) */ public boolean isShadowVisible() { return this.shadowVisible; } /** * Sets the shadow visibility flag. * * @param visible the flag. * * @see #isShadowVisible() */ public void setShadowVisible(boolean visible) { this.shadowVisible = visible; } /** * Returns the shadow paint. * * @return The shadow paint (never <code>null</code>). * * @see #setShadowPaint(Paint) */ public Paint getShadowPaint() { return this.shadowPaint; } /** * Sets the shadow paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getShadowPaint() */ public void setShadowPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.shadowPaint = paint; } /** * Returns the bar painter. * * @return The bar painter (never <code>null</code>). * * @see #setBarPainter(BarPainter) */ public BarPainter getBarPainter() { return this.barPainter; } /** * Sets the bar painter. * * @param painter the painter (<code>null</code> not permitted). * * @see #getBarPainter() */ public void setBarPainter(BarPainter painter) { if (painter == null) { throw new IllegalArgumentException("Null 'painter' argument."); } this.barPainter = painter; } /** * Returns the XY bar painter. * * @return The XY bar painter (never <code>null</code>). * * @see #setXYBarPainter(XYBarPainter) */ public XYBarPainter getXYBarPainter() { return this.xyBarPainter; } /** * Sets the XY bar painter. * * @param painter the painter (<code>null</code> not permitted). * * @see #getXYBarPainter() */ public void setXYBarPainter(XYBarPainter painter) { if (painter == null) { throw new IllegalArgumentException("Null 'painter' argument."); } this.xyBarPainter = painter; } /** * Returns the thermometer paint. * * @return The thermometer paint (never <code>null</code>). * * @see #setThermometerPaint(Paint) */ public Paint getThermometerPaint() { return this.thermometerPaint; } /** * Sets the thermometer paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getThermometerPaint() */ public void setThermometerPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.thermometerPaint = paint; } /** * Returns the wall paint for charts with a 3D effect. * * @return The wall paint (never <code>null</code>). * * @see #setWallPaint(Paint) */ public Paint getWallPaint() { return this.wallPaint; } /** * Sets the wall paint for charts with a 3D effect. * * @param paint the paint (<code>null</code> not permitted). * * @see #getWallPaint() */ public void setWallPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.wallPaint = paint; } /** * Returns the error indicator paint. * * @return The error indicator paint (never <code>null</code>). * * @see #setErrorIndicatorPaint(Paint) */ public Paint getErrorIndicatorPaint() { return this.errorIndicatorPaint; } /** * Sets the error indicator paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getErrorIndicatorPaint() */ public void setErrorIndicatorPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.errorIndicatorPaint = paint; } /** * Returns the grid band paint. * * @return The grid band paint (never <code>null</code>). * * @see #setGridBandPaint(Paint) */ public Paint getGridBandPaint() { return this.gridBandPaint; } /** * Sets the grid band paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getGridBandPaint() */ public void setGridBandPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.gridBandPaint = paint; } /** * Returns the grid band alternate paint (used for a {@link SymbolAxis}). * * @return The paint (never <code>null</code>). * * @see #setGridBandAlternatePaint(Paint) */ public Paint getGridBandAlternatePaint() { return this.gridBandAlternatePaint; } /** * Sets the grid band alternate paint (used for a {@link SymbolAxis}). * * @param paint the paint (<code>null</code> not permitted). * * @see #getGridBandAlternatePaint() */ public void setGridBandAlternatePaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.gridBandAlternatePaint = paint; } /** * Returns the name of this theme. * * @return The name of this theme. */ public String getName() { return this.name; } /** * Returns a clone of the drawing supplier for this theme. * * @return A clone of the drawing supplier. */ public DrawingSupplier getDrawingSupplier() { DrawingSupplier result = null; if (this.drawingSupplier instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.drawingSupplier; try { result = (DrawingSupplier) pc.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } return result; } /** * Sets the drawing supplier for this theme. * * @param supplier the supplier (<code>null</code> not permitted). * * @see #getDrawingSupplier() */ public void setDrawingSupplier(DrawingSupplier supplier) { if (supplier == null) { throw new IllegalArgumentException("Null 'supplier' argument."); } this.drawingSupplier = supplier; } /** * Applies this theme to the supplied chart. * * @param chart the chart (<code>null</code> not permitted). */ public void apply(JFreeChart chart) { if (chart == null) { throw new IllegalArgumentException("Null 'chart' argument."); } TextTitle title = chart.getTitle(); if (title != null) { title.setFont(this.extraLargeFont); title.setPaint(this.titlePaint); } int subtitleCount = chart.getSubtitleCount(); for (int i = 0; i < subtitleCount; i++) { applyToTitle(chart.getSubtitle(i)); } chart.setBackgroundPaint(this.chartBackgroundPaint); // now process the plot if there is one Plot plot = chart.getPlot(); if (plot != null) { applyToPlot(plot); } } /** * Applies the attributes of this theme to the specified title. * * @param title the title. */ protected void applyToTitle(Title title) { if (title instanceof TextTitle) { TextTitle tt = (TextTitle) title; tt.setFont(this.largeFont); tt.setPaint(this.subtitlePaint); } else if (title instanceof LegendTitle) { LegendTitle lt = (LegendTitle) title; if (lt.getBackgroundPaint() != null) { lt.setBackgroundPaint(this.legendBackgroundPaint); } lt.setItemFont(this.regularFont); lt.setItemPaint(this.legendItemPaint); if (lt.getWrapper() != null) { applyToBlockContainer(lt.getWrapper()); } } else if (title instanceof PaintScaleLegend) { PaintScaleLegend psl = (PaintScaleLegend) title; psl.setBackgroundPaint(this.legendBackgroundPaint); ValueAxis axis = psl.getAxis(); if (axis != null) { applyToValueAxis(axis); } } else if (title instanceof CompositeTitle) { CompositeTitle ct = (CompositeTitle) title; BlockContainer bc = ct.getContainer(); List blocks = bc.getBlocks(); Iterator iterator = blocks.iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); if (b instanceof Title) { applyToTitle((Title) b); } } } } /** * Applies the attributes of this theme to the specified container. * * @param bc a block container (<code>null</code> not permitted). */ protected void applyToBlockContainer(BlockContainer bc) { Iterator iterator = bc.getBlocks().iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); applyToBlock(b); } } /** * Applies the attributes of this theme to the specified block. * * @param b the block. */ protected void applyToBlock(Block b) { if (b instanceof Title) { applyToTitle((Title) b); } else if (b instanceof LabelBlock) { LabelBlock lb = (LabelBlock) b; lb.setFont(this.regularFont); lb.setPaint(this.legendItemPaint); } } /** * Applies the attributes of this theme to a plot. * * @param plot the plot (<code>null</code>). */ protected void applyToPlot(Plot plot) { if (plot == null) { throw new IllegalArgumentException("Null 'plot' argument."); } if (plot.getDrawingSupplier() != null) { plot.setDrawingSupplier(getDrawingSupplier()); } if (plot.getBackgroundPaint() != null) { plot.setBackgroundPaint(this.plotBackgroundPaint); } plot.setOutlinePaint(this.plotOutlinePaint); // now handle specific plot types (and yes, I know this is some // really ugly code that has to be manually updated any time a new // plot type is added - I should have written something much cooler, // but I didn't and neither did anyone else). if (plot instanceof PiePlot) { applyToPiePlot((PiePlot) plot); } else if (plot instanceof MultiplePiePlot) { applyToMultiplePiePlot((MultiplePiePlot) plot); } else if (plot instanceof CategoryPlot) { applyToCategoryPlot((CategoryPlot) plot); } else if (plot instanceof XYPlot) { applyToXYPlot((XYPlot) plot); } else if (plot instanceof FastScatterPlot) { applyToFastScatterPlot((FastScatterPlot) plot); } else if (plot instanceof MeterPlot) { applyToMeterPlot((MeterPlot) plot); } else if (plot instanceof ThermometerPlot) { applyToThermometerPlot((ThermometerPlot) plot); } else if (plot instanceof SpiderWebPlot) { applyToSpiderWebPlot((SpiderWebPlot) plot); } else if (plot instanceof PolarPlot) { applyToPolarPlot((PolarPlot) plot); } } /** * Applies the attributes of this theme to a {@link PiePlot} instance. * This method also clears any set values for the section paint, outline * etc, so that the theme's {@link DrawingSupplier} will be used. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToPiePlot(PiePlot plot) { plot.setLabelLinkPaint(this.labelLinkPaint); plot.setLabelLinkStyle(this.labelLinkStyle); plot.setLabelFont(this.regularFont); // clear the section attributes so that the theme's DrawingSupplier // will be used if (plot.getAutoPopulateSectionPaint()) { plot.clearSectionPaints(false); } if (plot.getAutoPopulateSectionOutlinePaint()) { plot.clearSectionOutlinePaints(false); } if (plot.getAutoPopulateSectionOutlineStroke()) { plot.clearSectionOutlineStrokes(false); } } /** * Applies the attributes of this theme to a {@link MultiplePiePlot}. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToMultiplePiePlot(MultiplePiePlot plot) { apply(plot.getPieChart()); } /** * Applies the attributes of this theme to a {@link CategoryPlot}. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToCategoryPlot(CategoryPlot plot) { plot.setAxisOffset(this.axisOffset); plot.setDomainGridlinePaint(this.domainGridlinePaint); plot.setRangeGridlinePaint(this.rangeGridlinePaint); // process all domain axes int domainAxisCount = plot.getDomainAxisCount(); for (int i = 0; i < domainAxisCount; i++) { CategoryAxis axis = (CategoryAxis) plot.getDomainAxis(i); if (axis != null) { applyToCategoryAxis(axis); } } // process all range axes int rangeAxisCount = plot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; i++) { ValueAxis axis = (ValueAxis) plot.getRangeAxis(i); if (axis != null) { applyToValueAxis(axis); } } // process all renderers int rendererCount = plot.getRendererCount(); for (int i = 0; i < rendererCount; i++) { CategoryItemRenderer r = plot.getRenderer(i); if (r != null) { applyToCategoryItemRenderer(r); } } if (plot instanceof CombinedDomainCategoryPlot) { CombinedDomainCategoryPlot cp = (CombinedDomainCategoryPlot) plot; Iterator iterator = cp.getSubplots().iterator(); while (iterator.hasNext()) { CategoryPlot subplot = (CategoryPlot) iterator.next(); if (subplot != null) { applyToPlot(subplot); } } } if (plot instanceof CombinedRangeCategoryPlot) { CombinedRangeCategoryPlot cp = (CombinedRangeCategoryPlot) plot; Iterator iterator = cp.getSubplots().iterator(); while (iterator.hasNext()) { CategoryPlot subplot = (CategoryPlot) iterator.next(); if (subplot != null) { applyToPlot(subplot); } } } } /** * Applies the attributes of this theme to a {@link XYPlot}. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToXYPlot(XYPlot plot) { plot.setAxisOffset(this.axisOffset); plot.setDomainGridlinePaint(this.domainGridlinePaint); plot.setRangeGridlinePaint(this.rangeGridlinePaint); // process all domain axes int domainAxisCount = plot.getDomainAxisCount(); for (int i = 0; i < domainAxisCount; i++) { ValueAxis axis = (ValueAxis) plot.getDomainAxis(i); if (axis != null) { applyToValueAxis(axis); } } // process all range axes int rangeAxisCount = plot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; i++) { ValueAxis axis = (ValueAxis) plot.getRangeAxis(i); if (axis != null) { applyToValueAxis(axis); } } // process all renderers int rendererCount = plot.getRendererCount(); for (int i = 0; i < rendererCount; i++) { XYItemRenderer r = plot.getRenderer(i); if (r != null) { applyToXYItemRenderer(r); } } if (plot instanceof CombinedDomainXYPlot) { CombinedDomainXYPlot cp = (CombinedDomainXYPlot) plot; Iterator iterator = cp.getSubplots().iterator(); while (iterator.hasNext()) { XYPlot subplot = (XYPlot) iterator.next(); if (subplot != null) { applyToPlot(subplot); } } } if (plot instanceof CombinedRangeXYPlot) { CombinedRangeXYPlot cp = (CombinedRangeXYPlot) plot; Iterator iterator = cp.getSubplots().iterator(); while (iterator.hasNext()) { XYPlot subplot = (XYPlot) iterator.next(); if (subplot != null) { applyToPlot(subplot); } } } } /** * Applies the attributes of this theme to a {@link FastScatterPlot}. * @param plot */ protected void applyToFastScatterPlot(FastScatterPlot plot) { plot.setDomainGridlinePaint(this.domainGridlinePaint); plot.setRangeGridlinePaint(this.rangeGridlinePaint); ValueAxis xAxis = plot.getDomainAxis(); if (xAxis != null) { applyToValueAxis(xAxis); } ValueAxis yAxis = plot.getRangeAxis(); if (yAxis != null) { applyToValueAxis(yAxis); } } /** * Applies the attributes of this theme to a {@link PolarPlot}. This * method is called from the {@link #applyToPlot(Plot)} method. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToPolarPlot(PolarPlot plot) { plot.setAngleLabelFont(this.regularFont); plot.setAngleLabelPaint(this.tickLabelPaint); plot.setAngleGridlinePaint(this.domainGridlinePaint); plot.setRadiusGridlinePaint(this.rangeGridlinePaint); ValueAxis axis = plot.getAxis(); if (axis != null) { applyToValueAxis(axis); } } /** * Applies the attributes of this theme to a {@link SpiderWebPlot}. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToSpiderWebPlot(SpiderWebPlot plot) { plot.setLabelFont(this.regularFont); plot.setLabelPaint(this.axisLabelPaint); plot.setAxisLinePaint(this.axisLabelPaint); } /** * Applies the attributes of this theme to a {@link MeterPlot}. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToMeterPlot(MeterPlot plot) { plot.setDialBackgroundPaint(this.plotBackgroundPaint); plot.setValueFont(this.largeFont); plot.setValuePaint(this.axisLabelPaint); plot.setDialOutlinePaint(this.plotOutlinePaint); plot.setNeedlePaint(this.thermometerPaint); plot.setTickLabelFont(this.regularFont); plot.setTickLabelPaint(this.tickLabelPaint); } /** * Applies the attributes for this theme to a {@link ThermometerPlot}. * This method is called from the {@link #applyToPlot(Plot)} method. * * @param plot the plot. */ protected void applyToThermometerPlot(ThermometerPlot plot) { plot.setValueFont(this.largeFont); plot.setThermometerPaint(this.thermometerPaint); ValueAxis axis = plot.getRangeAxis(); if (axis != null) { applyToValueAxis(axis); } } /** * Applies the attributes for this theme to a {@link CategoryAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToCategoryAxis(CategoryAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); } /** * Applies the attributes for this theme to a {@link ValueAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToValueAxis(ValueAxis axis) { axis.setLabelFont(this.largeFont); axis.setLabelPaint(this.axisLabelPaint); axis.setTickLabelFont(this.regularFont); axis.setTickLabelPaint(this.tickLabelPaint); if (axis instanceof SymbolAxis) { applyToSymbolAxis((SymbolAxis) axis); } if (axis instanceof PeriodAxis) { applyToPeriodAxis((PeriodAxis) axis); } } /** * Applies the attributes for this theme to a {@link SymbolAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToSymbolAxis(SymbolAxis axis) { axis.setGridBandPaint(this.gridBandPaint); axis.setGridBandAlternatePaint(this.gridBandAlternatePaint); } /** * Applies the attributes for this theme to a {@link PeriodAxis}. * * @param axis the axis (<code>null</code> not permitted). */ protected void applyToPeriodAxis(PeriodAxis axis) { PeriodAxisLabelInfo[] info = axis.getLabelInfo(); for (int i = 0; i < info.length; i++) { PeriodAxisLabelInfo e = info[i]; PeriodAxisLabelInfo n = new PeriodAxisLabelInfo(e.getPeriodClass(), e.getDateFormat(), e.getPadding(), this.regularFont, this.tickLabelPaint, e.getDrawDividers(), e.getDividerStroke(), e.getDividerPaint()); info[i] = n; } axis.setLabelInfo(info); } /** * Applies the attributes for this theme to an {@link AbstractRenderer}. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToAbstractRenderer(AbstractRenderer renderer) { if (renderer.getAutoPopulateSeriesPaint()) { renderer.clearSeriesPaints(false); } if (renderer.getAutoPopulateSeriesStroke()) { renderer.clearSeriesStrokes(false); } } /** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) { if (renderer == null) { throw new IllegalArgumentException("Null 'renderer' argument."); } if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); // now we handle some special cases - yes, UGLY code alert! // BarRenderer if (renderer instanceof BarRenderer) { BarRenderer br = (BarRenderer) renderer; br.setBarPainter(this.barPainter); br.setShadowVisible(this.shadowVisible); br.setShadowPaint(this.shadowPaint); } // BarRenderer3D if (renderer instanceof BarRenderer3D) { BarRenderer3D br3d = (BarRenderer3D) renderer; br3d.setWallPaint(this.wallPaint); } // LineRenderer3D if (renderer instanceof LineRenderer3D) { LineRenderer3D lr3d = (LineRenderer3D) renderer; lr3d.setWallPaint(this.wallPaint); } // StatisticalBarRenderer if (renderer instanceof StatisticalBarRenderer) { StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer; sbr.setErrorIndicatorPaint(this.errorIndicatorPaint); } // MinMaxCategoryRenderer if (renderer instanceof MinMaxCategoryRenderer) { MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer; mmcr.setGroupPaint(this.errorIndicatorPaint); } } /** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { if (renderer == null) { throw new IllegalArgumentException("Null 'renderer' argument."); } if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } } /** * Tests this theme for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StandardChartTheme)) { return false; } StandardChartTheme that = (StandardChartTheme) obj; if (!this.name.equals(that.name)) { return false; } if (!this.extraLargeFont.equals(that.extraLargeFont)) { return false; } if (!this.largeFont.equals(that.largeFont)) { return false; } if (!this.regularFont.equals(that.regularFont)) { return false; } if (!PaintUtilities.equal(this.titlePaint, that.titlePaint)) { return false; } if (!PaintUtilities.equal(this.subtitlePaint, that.subtitlePaint)) { return false; } if (!PaintUtilities.equal(this.chartBackgroundPaint, that.chartBackgroundPaint)) { return false; } if (!PaintUtilities.equal(this.legendBackgroundPaint, that.legendBackgroundPaint)) { return false; } if (!PaintUtilities.equal(this.legendItemPaint, that.legendItemPaint)) { return false; } if (!this.drawingSupplier.equals(that.drawingSupplier)) { return false; } if (!PaintUtilities.equal(this.plotBackgroundPaint, that.plotBackgroundPaint)) { return false; } if (!PaintUtilities.equal(this.plotOutlinePaint, that.plotOutlinePaint)) { return false; } if (!this.labelLinkStyle.equals(that.labelLinkStyle)) { return false; } if (!PaintUtilities.equal(this.labelLinkPaint, that.labelLinkPaint)) { return false; } if (!PaintUtilities.equal(this.domainGridlinePaint, that.domainGridlinePaint)) { return false; } if (!PaintUtilities.equal(this.rangeGridlinePaint, that.rangeGridlinePaint)) { return false; } if (!this.axisOffset.equals(that.axisOffset)) { return false; } if (!PaintUtilities.equal(this.axisLabelPaint, that.axisLabelPaint)) { return false; } if (!PaintUtilities.equal(this.tickLabelPaint, that.tickLabelPaint)) { return false; } if (!PaintUtilities.equal(this.itemLabelPaint, that.itemLabelPaint)) { return false; } if (this.shadowVisible != that.shadowVisible) { return false; } if (!PaintUtilities.equal(this.shadowPaint, that.shadowPaint)) { return false; } if (!this.barPainter.equals(that.barPainter)) { return false; } if (!this.xyBarPainter.equals(that.xyBarPainter)) { return false; } if (!PaintUtilities.equal(this.thermometerPaint, that.thermometerPaint)) { return false; } if (!PaintUtilities.equal(this.wallPaint, that.wallPaint)) { return false; } if (!PaintUtilities.equal(this.errorIndicatorPaint, that.errorIndicatorPaint)) { return false; } if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint)) { return false; } if (!PaintUtilities.equal(this.gridBandAlternatePaint, that.gridBandAlternatePaint)) { return false; } return true; } /** * Returns a clone of this theme. * * @return A clone. * * @throws CloneNotSupportedException if the theme cannot be cloned. */ public Object clone() throws CloneNotSupportedException { return super.clone(); } /** * Provides serialization support. * * @param stream the output stream (<code>null</code> not permitted). * * @throws IOException if there is an I/O error. */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtilities.writePaint(this.titlePaint, stream); SerialUtilities.writePaint(this.subtitlePaint, stream); SerialUtilities.writePaint(this.chartBackgroundPaint, stream); SerialUtilities.writePaint(this.legendBackgroundPaint, stream); SerialUtilities.writePaint(this.legendItemPaint, stream); SerialUtilities.writePaint(this.plotBackgroundPaint, stream); SerialUtilities.writePaint(this.plotOutlinePaint, stream); SerialUtilities.writePaint(this.labelLinkPaint, stream); SerialUtilities.writePaint(this.domainGridlinePaint, stream); SerialUtilities.writePaint(this.rangeGridlinePaint, stream); SerialUtilities.writePaint(this.axisLabelPaint, stream); SerialUtilities.writePaint(this.tickLabelPaint, stream); SerialUtilities.writePaint(this.itemLabelPaint, stream); SerialUtilities.writePaint(this.shadowPaint, stream); SerialUtilities.writePaint(this.thermometerPaint, stream); SerialUtilities.writePaint(this.wallPaint, stream); SerialUtilities.writePaint(this.errorIndicatorPaint, stream); SerialUtilities.writePaint(this.gridBandPaint, stream); SerialUtilities.writePaint(this.gridBandAlternatePaint, stream); } /** * Provides serialization support. * * @param stream the input stream (<code>null</code> not permitted). * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.titlePaint = SerialUtilities.readPaint(stream); this.subtitlePaint = SerialUtilities.readPaint(stream); this.chartBackgroundPaint = SerialUtilities.readPaint(stream); this.legendBackgroundPaint = SerialUtilities.readPaint(stream); this.legendItemPaint = SerialUtilities.readPaint(stream); this.plotBackgroundPaint = SerialUtilities.readPaint(stream); this.plotOutlinePaint = SerialUtilities.readPaint(stream); this.labelLinkPaint = SerialUtilities.readPaint(stream); this.domainGridlinePaint = SerialUtilities.readPaint(stream); this.rangeGridlinePaint = SerialUtilities.readPaint(stream); this.axisLabelPaint = SerialUtilities.readPaint(stream); this.tickLabelPaint = SerialUtilities.readPaint(stream); this.itemLabelPaint = SerialUtilities.readPaint(stream); this.shadowPaint = SerialUtilities.readPaint(stream); this.thermometerPaint = SerialUtilities.readPaint(stream); this.wallPaint = SerialUtilities.readPaint(stream); this.errorIndicatorPaint = SerialUtilities.readPaint(stream); this.gridBandPaint = SerialUtilities.readPaint(stream); this.gridBandAlternatePaint = SerialUtilities.readPaint(stream); } }

The table below shows all metrics for StandardChartTheme.java.

MetricValueDescription
BLOCKS221.00Number of blocks
BLOCK_COMMENT39.00Number of block comment lines
COMMENTS663.00Comment lines
COMMENT_DENSITY 0.94Comment density
COMPARISONS100.00Number of comparison operators
CYCLOMATIC220.00Cyclomatic complexity
DECL_COMMENTS117.00Comments in declarations
DOC_COMMENT604.00Number of javadoc comment lines
ELOC709.00Effective lines of code
EXEC_COMMENTS16.00Comments in executable code
EXITS146.00Procedure exits
FUNCTIONS87.00Number of function declarations
HALSTEAD_DIFFICULTY85.87Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY275.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 0.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 0.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 1.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA0034 0.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 0.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 1.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 0.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 8.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 0.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 4.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 1.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 0.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 0.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 1.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 1.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 0.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 1.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 0.00JAVA0144 Line exceeds maximum M characters
JAVA01452260.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 0.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 0.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 0.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 1.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 6.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 0.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 1.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 0.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES1735.00Number of lines in the source file
LINE_COMMENT20.00Number of line comments
LOC931.00Lines of code
LOGICAL_LINES476.00Number of statements
LOOPS14.00Number of loops
NEST_DEPTH 4.00Maximum nesting depth
OPERANDS1969.00Number of operands
OPERATORS4059.00Number of operators
PARAMS54.00Number of formal parameter declarations
PROGRAM_LENGTH6028.00Halstead program length
PROGRAM_VOCAB536.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS221.00Number of return points from functions
SIZE50212.00Size of the file in bytes
UNIQUE_OPERANDS493.00Number of unique operands
UNIQUE_OPERATORS43.00Number of unique operators
WHITESPACE141.00Number of whitespace lines