/* ===========================================================
 * 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.]
 *
 * ------------------------------
 * CategoryItemRendererState.java
 * ------------------------------
 * (C) Copyright 2003, 2004, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: CategoryItemRendererState.java,v 1.4 2004/01/05 17:11:47 mungady Exp $
 *
 * Changes (since 20-Oct-2003):
 * ----------------------------
 * 20-Oct-2003 : Added series running total (DG);
 *
 */

package org.jfree.chart.renderer;

import org.jfree.chart.plot.PlotRenderingInfo;

/**
 * An object that retains temporary state information for a {@link CategoryItemRenderer}.
 */
public class CategoryItemRendererState extends RendererState {

    /** The bar width. */
    private double barWidth;
    
    /** The series running total. */
    private double seriesRunningTotal;
    
    /**
     * Creates a new object for recording temporary state information for a renderer.
     * 
     * @param info  the plot rendering info.
     */
    public CategoryItemRendererState(PlotRenderingInfo info) {
        super(info);
        this.barWidth = 0.0;
        this.seriesRunningTotal = 0.0;
    }
    
    /**
     * Returns the bar width.
     * 
     * @return The bar width.
     */
    public double getBarWidth() {
        return this.barWidth;
    }
    
    /**
     * Sets the bar width.  The renderer calculates this value and stores it here - it is not 
     * intended that users can manually set the bar width.
     * 
     * @param width  the width.
     */
    public void setBarWidth(double width) {
        this.barWidth = width;
    }
    
    /**
     * Returns the series running total.
     * 
     * @return The running total.
     */
    public double getSeriesRunningTotal() {
        return this.seriesRunningTotal;    
    }
    
    /**
     * Sets the series running total (this method is intended for the use of the renderer only).
     * 
     * @param total  the new total.
     */
    void setSeriesRunningTotal(double total) {
        this.seriesRunningTotal = total;
    }
    
}
