package net.sf.jasperreports.engine.base;

import java.io.Serializable;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRSubreportReturnValue;

public class JRBaseSubreportReturnValue implements JRSubreportReturnValue, Serializable {
  private static final long serialVersionUID = 10200L;
  
  protected String subreportVariable = null;
  
  protected String toVariable = null;
  
  protected byte calculation = 0;
  
  protected String incrementerFactoryClassName = null;
  
  protected JRBaseSubreportReturnValue() {}
  
  protected JRBaseSubreportReturnValue(JRSubreportReturnValue returnValue, JRBaseObjectFactory factory) {
    factory.put(returnValue, this);
    this.subreportVariable = returnValue.getSubreportVariable();
    this.toVariable = returnValue.getToVariable();
    this.calculation = returnValue.getCalculation();
    this.incrementerFactoryClassName = returnValue.getIncrementerFactoryClassName();
  }
  
  public String getSubreportVariable() {
    return this.subreportVariable;
  }
  
  public String getToVariable() {
    return this.toVariable;
  }
  
  public byte getCalculation() {
    return this.calculation;
  }
  
  public String getIncrementerFactoryClassName() {
    return this.incrementerFactoryClassName;
  }
  
  public Object clone() {
    try {
      return super.clone();
    } catch (CloneNotSupportedException e) {
      throw new JRRuntimeException(e);
    } 
  }
}
