package net.sf.jasperreports.charts.base;

import net.sf.jasperreports.charts.JRHighLowDataset;
import net.sf.jasperreports.engine.JRChartDataset;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.base.JRBaseChartDataset;
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
import net.sf.jasperreports.engine.design.JRVerifier;

public class JRBaseHighLowDataset extends JRBaseChartDataset implements JRHighLowDataset {
  private static final long serialVersionUID = 10200L;
  
  protected JRExpression seriesExpression;
  
  protected JRExpression dateExpression;
  
  protected JRExpression highExpression;
  
  protected JRExpression lowExpression;
  
  protected JRExpression openExpression;
  
  protected JRExpression closeExpression;
  
  protected JRExpression volumeExpression;
  
  private JRHyperlink itemHyperlink;
  
  public JRBaseHighLowDataset(JRChartDataset dataset) {
    super(dataset);
  }
  
  public JRBaseHighLowDataset(JRHighLowDataset dataset, JRBaseObjectFactory factory) {
    super((JRChartDataset)dataset, factory);
    this.seriesExpression = factory.getExpression(dataset.getSeriesExpression());
    this.dateExpression = factory.getExpression(dataset.getDateExpression());
    this.highExpression = factory.getExpression(dataset.getHighExpression());
    this.lowExpression = factory.getExpression(dataset.getLowExpression());
    this.openExpression = factory.getExpression(dataset.getOpenExpression());
    this.closeExpression = factory.getExpression(dataset.getCloseExpression());
    this.volumeExpression = factory.getExpression(dataset.getVolumeExpression());
    this.itemHyperlink = factory.getHyperlink(dataset.getItemHyperlink());
  }
  
  public JRExpression getSeriesExpression() {
    return this.seriesExpression;
  }
  
  public JRExpression getDateExpression() {
    return this.dateExpression;
  }
  
  public JRExpression getHighExpression() {
    return this.highExpression;
  }
  
  public JRExpression getLowExpression() {
    return this.lowExpression;
  }
  
  public JRExpression getOpenExpression() {
    return this.openExpression;
  }
  
  public JRExpression getCloseExpression() {
    return this.closeExpression;
  }
  
  public JRExpression getVolumeExpression() {
    return this.volumeExpression;
  }
  
  public byte getDatasetType() {
    return 7;
  }
  
  public void collectExpressions(JRExpressionCollector collector) {
    collector.collect(this);
  }
  
  public JRHyperlink getItemHyperlink() {
    return this.itemHyperlink;
  }
  
  public void validate(JRVerifier verifier) {
    verifier.verify(this);
  }
  
  public Object clone() {
    JRBaseHighLowDataset clone = (JRBaseHighLowDataset)super.clone();
    if (this.seriesExpression != null)
      clone.seriesExpression = (JRExpression)this.seriesExpression.clone(); 
    if (this.dateExpression != null)
      clone.dateExpression = (JRExpression)this.dateExpression.clone(); 
    if (this.highExpression != null)
      clone.highExpression = (JRExpression)this.highExpression.clone(); 
    if (this.lowExpression != null)
      clone.lowExpression = (JRExpression)this.lowExpression.clone(); 
    if (this.openExpression != null)
      clone.openExpression = (JRExpression)this.openExpression.clone(); 
    if (this.closeExpression != null)
      clone.closeExpression = (JRExpression)this.closeExpression.clone(); 
    if (this.volumeExpression != null)
      clone.volumeExpression = (JRExpression)this.volumeExpression.clone(); 
    if (this.itemHyperlink != null)
      clone.itemHyperlink = (JRHyperlink)this.itemHyperlink.clone(); 
    return clone;
  }
}
