package net.sf.jasperreports.charts.util;

import java.awt.Color;
import java.io.Serializable;
import net.sf.jasperreports.charts.JRDataRange;
import net.sf.jasperreports.charts.base.JRBaseDataRange;
import net.sf.jasperreports.engine.JRCloneable;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;

public class JRMeterInterval implements JRCloneable, Serializable {
  protected JRDataRange dataRange = null;
  
  protected String label = null;
  
  protected Color backgroundColor = null;
  
  protected double alpha = 1.0D;
  
  private static final long serialVersionUID = 10200L;
  
  public JRMeterInterval() {}
  
  public JRMeterInterval(JRMeterInterval meterInterval, JRBaseObjectFactory factory) {
    this.dataRange = (JRDataRange)new JRBaseDataRange(meterInterval.getDataRange(), factory);
    this.label = meterInterval.getLabel();
    this.backgroundColor = meterInterval.getBackgroundColor();
    this.alpha = meterInterval.getAlpha();
  }
  
  public JRDataRange getDataRange() {
    return this.dataRange;
  }
  
  public void setDataRange(JRDataRange dataRange) {
    this.dataRange = dataRange;
  }
  
  public String getLabel() {
    return this.label;
  }
  
  public void setLabel(String label) {
    this.label = label;
  }
  
  public Color getBackgroundColor() {
    return this.backgroundColor;
  }
  
  public void setBackgroundColor(Color backgroundColor) {
    this.backgroundColor = backgroundColor;
  }
  
  public double getAlpha() {
    return this.alpha;
  }
  
  public void setAlpha(double alpha) {
    this.alpha = alpha;
  }
  
  public Object clone() {
    JRMeterInterval clone = null;
    try {
      clone = (JRMeterInterval)super.clone();
    } catch (CloneNotSupportedException e) {
      throw new JRRuntimeException(e);
    } 
    if (this.dataRange != null)
      clone.dataRange = (JRDataRange)this.dataRange.clone(); 
    return clone;
  }
}
