package net.sf.jasperreports.engine.fill;

public class JRDoubleIncrementerFactory extends JRAbstractExtendedIncrementerFactory {
  protected static final Double ZERO = new Double(0.0D);
  
  private static JRDoubleIncrementerFactory mainInstance = new JRDoubleIncrementerFactory();
  
  public static JRDoubleIncrementerFactory getInstance() {
    return mainInstance;
  }
  
  public JRExtendedIncrementer getExtendedIncrementer(byte calculation) {
    JRExtendedIncrementer incrementer = null;
    switch (calculation) {
      case 1:
        incrementer = JRDoubleCountIncrementer.getInstance();
        return incrementer;
      case 2:
        incrementer = JRDoubleSumIncrementer.getInstance();
        return incrementer;
      case 3:
        incrementer = JRDoubleAverageIncrementer.getInstance();
        return incrementer;
      case 4:
      case 5:
        incrementer = JRComparableIncrementerFactory.getInstance().getExtendedIncrementer(calculation);
        return incrementer;
      case 6:
        incrementer = JRDoubleStandardDeviationIncrementer.getInstance();
        return incrementer;
      case 7:
        incrementer = JRDoubleVarianceIncrementer.getInstance();
        return incrementer;
      case 10:
        incrementer = JRDoubleDistinctCountIncrementer.getInstance();
        return incrementer;
    } 
    incrementer = JRDefaultIncrementerFactory.getInstance().getExtendedIncrementer(calculation);
    return incrementer;
  }
}
