/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package usda.weru.nrmv;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import org.apache.commons.lang.WordUtils;

/**
 *
 * @author Benjamin.Todd
 */
public class ConvertDecomp extends NrmvConverter {

    public ConvertDecomp() {
    }

    /**
     *
     */
    @Override
    public void setLinesToSkip() {
        this.linesToSkip = 12;
    }

    /**
     *
     */
    @Override
    public void setVariables() {
        variables = new ArrayList<String>();
        variables.add("time");
   
        variables.add("minimum Temperature");
        variables.add("maximum Temperature");
        variables.add("average temperature");
        variables.add("Temperature factor above ground");
        variables.add("water rain irrigation snow melt");
        variables.add("water factor standing residue");
        variables.add("water factor flat residue");
        variables.add("decomposition days standing residue");
        variables.add("decomposition days flat residue");
        variables.add("mass standing age pool 1");
        variables.add("mass standing age pool 2");
        variables.add("mass standing age pool 3");
        variables.add("mass standing all age pools");
        variables.add("mass flat age pool 1");
        variables.add("mass flat age pool 2");
        variables.add("mass flat age pool 3");
        variables.add("mass flat all age pools");
        variables.add("mass all above ground");
        variables.add("mass buried age pool 1");
        variables.add("mass buried age pool 2");
        variables.add("mass buried age pool 3");
        variables.add("mass buried all age pools");
        variables.add("mass roots age pool 1");
        variables.add("mass roots age pool 2");
        variables.add("mass roots age pool 3");
        variables.add("mass roots all age pools");
        variables.add("cover standing age pool 1");
        variables.add("cover standing age pool 2");
        variables.add("cover standing age pool 3");
        variables.add("cover standing all age pools");
        variables.add("cover flat age pool 1");
        variables.add("cover flat age pool 2");
        variables.add("cover flat age pool 3");
        variables.add("cover flat all age pools");
        variables.add("cover standing + flat age pool 1");
        variables.add("cover standing + flat age pool 2");
        variables.add("cover standing + flat age pool 3");
        variables.add("cover standing + flat all age pools");
        variables.add("stem area index age pool 1");
        variables.add("stem area index age pool 2");
        variables.add("stem area index age pool 3");
        variables.add("stem area index all age pools");
        variables.add("leaf area index age pool 1");
        variables.add("leaf area index age pool 2");
        variables.add("leaf area index age pool 3");
        variables.add("leaf area index all age pools");
        variables.add("stem and leaf biodrag");
        variables.add("stem count age pool 1");
        variables.add("stem count age pool 2");
        variables.add("stem count age pool 3");
        variables.add("stem count all age pools");
        variables.add("stem height age pool 1");
        variables.add("stem height age pool 2");
        variables.add("stem height age pool 3");
        variables.add("stem height all age pools");
        variables.add("mass roots top 4 inches soil");
        for (int i = 0; i < variables.size(); i++) {
            variables.set(i, WordUtils.capitalize(variables.get(i)));
        }
    }

    /**
     *
     * @param al
     * @return
     */
    @Override
    public ArrayList<String> changeData(ArrayList<String> al) {
        int i = Integer.parseInt(al.get(0));
        String str = convertNumber(i);
        al.set(0, str);
        al.subList(1, 3).clear();
       // al.set(1, "1");
        correctDoubleDecimal(al);

        return al;
    }

    /**
     *
     * @param pw
     */
  /*  @Override
    public void printUnits(PrintWriter pw) {
        pw.println();
        pw.println("unit,,,C,C,C,0-1, mm,0-1,0-1,days,days,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,"
                + "kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,fraction,fraction,fraction,fraction,"
                + "fraction,fraction,fraction,fraction,fraction,fraction,fraction,fraction,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2"
                + "m^2/m^2,m^2/m^2,Coefficant,#/m^2,#/m^2,#/m^2,#/m^2,m,m,m,m,kg/m^2");

    }*/

    @Override
    public void printSummaryUnits(PrintWriter pw) {
         pw.println();
        pw.println("unit,,C,C,C,0-1, mm,0-1,0-1,days,days,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,"
                + "kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,fraction,fraction,fraction,fraction,"
                + "fraction,fraction,fraction,fraction,fraction,fraction,fraction,fraction,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2"
                + "m^2/m^2,m^2/m^2,Coefficant,#/m^2,#/m^2,#/m^2,#/m^2,m,m,m,m,kg/m^2");

    }

    @Override
    public void setUnits() {
        units = new ArrayList<String>();
       String sUnit = ",Date,C,C,C,0-1, mm,0-1,0-1,days,days,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,"
                + "kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,kg/m^2,fraction,fraction,fraction,fraction,"
                + "fraction,fraction,fraction,fraction,fraction,fraction,fraction,fraction,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2,m^2/m^2"
                + "m^2/m^2,m^2/m^2,Coefficant,#/m^2,#/m^2,#/m^2,#/m^2,m,m,m,m,kg/m^2";
       StringTokenizer st = new StringTokenizer(sUnit,",", false);
       while(st.hasMoreTokens())
               {
        units.add(st.nextToken());
    }
       
    }
}
