LIDSoil.java [src/SwmmObjects] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package SwmmObjects;

import java.text.DecimalFormat;
import org.apache.commons.lang3.StringUtils;

/**
 *
 * @author Lucas Yaege
 */
public class LIDSoil
{

    /**
     * thickness of the soil layer (inches or mm).
     */
    public double thick;
    /**
     * soil porosity (volume of pore space relative to total volume).
     */
    public double por;
    /**
     * soil field capacity (volume of pore water relative to total volume after
     * the soil has been allowed to drain fully).
     */
    public double fc;
    /**
     * soil wilting point (volume of pore water relative to total volume for a
     * well dried soil where only bound water remains).
     */
    public double wp;
    /**
     * soil’s saturated hydraulic conductivity (in/hr or mm/hr).
     */
    public double kSat;
    /**
     * slope of the curve of log(conductivity) versus soil moisture content
     * (dimensionless).
     */
    public double kCoeff;
    /**
     * soil capillary suction (in or mm).
     */
    public double suct;
    
    private DecimalFormat df = new DecimalFormat("#.###");
    
    
    public LIDSoil(double thick, double por, double fc, double wp, double kSat, double kCoeff, double suct)
    {
        this.thick = thick;
        this.por = por;
        this.fc = fc;
        this.wp = wp;
        this.kSat = kSat;
        this.kCoeff = kCoeff;
        this.suct = suct;
    }

    @Override
    public String toString()
    {
        return toString( 17 );
    }

    public String toString( int padDistance )
    {
        StringBuilder sb = new StringBuilder();

        //Data
        sb.append( StringUtils.rightPad( df.format( this.thick ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.por ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.fc ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.wp ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.kSat ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.kCoeff ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.suct ), padDistance ) );

        return sb.toString();
    }
}