package net.sf.jasperreports.charts.base;

import java.io.Serializable;
import net.sf.jasperreports.charts.JRXyzSeries;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;

public class JRBaseXyzSeries implements JRXyzSeries, Serializable {
  private static final long serialVersionUID = 10200L;
  
  protected JRExpression seriesExpression = null;
  
  protected JRExpression xValueExpression = null;
  
  protected JRExpression yValueExpression = null;
  
  protected JRExpression zValueExpression = null;
  
  protected JRHyperlink itemHyperlink;
  
  public JRBaseXyzSeries() {}
  
  public JRBaseXyzSeries(JRXyzSeries xyzSeries, JRBaseObjectFactory factory) {
    factory.put(xyzSeries, this);
    this.seriesExpression = factory.getExpression(xyzSeries.getSeriesExpression());
    this.xValueExpression = factory.getExpression(xyzSeries.getXValueExpression());
    this.yValueExpression = factory.getExpression(xyzSeries.getYValueExpression());
    this.zValueExpression = factory.getExpression(xyzSeries.getZValueExpression());
    this.itemHyperlink = factory.getHyperlink(xyzSeries.getItemHyperlink());
  }
  
  public JRExpression getSeriesExpression() {
    return this.seriesExpression;
  }
  
  public JRExpression getXValueExpression() {
    return this.xValueExpression;
  }
  
  public JRExpression getYValueExpression() {
    return this.yValueExpression;
  }
  
  public JRExpression getZValueExpression() {
    return this.zValueExpression;
  }
  
  public JRHyperlink getItemHyperlink() {
    return this.itemHyperlink;
  }
  
  public Object clone() {
    JRBaseXyzSeries clone = null;
    try {
      clone = (JRBaseXyzSeries)super.clone();
    } catch (CloneNotSupportedException e) {
      throw new JRRuntimeException(e);
    } 
    if (this.seriesExpression != null)
      clone.seriesExpression = (JRExpression)this.seriesExpression.clone(); 
    if (this.xValueExpression != null)
      clone.xValueExpression = (JRExpression)this.xValueExpression.clone(); 
    if (this.yValueExpression != null)
      clone.yValueExpression = (JRExpression)this.yValueExpression.clone(); 
    if (this.zValueExpression != null)
      clone.zValueExpression = (JRExpression)this.zValueExpression.clone(); 
    if (this.itemHyperlink != null)
      clone.itemHyperlink = (JRHyperlink)this.itemHyperlink.clone(); 
    return clone;
  }
}
