LIDStorage.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 LIDStorage
{
    /**
     * thickness of the storage layer or height of a rain barrel (inches or mm).
     */
    public double height;
    /**
     * void ratio (volume of void space relative to the volume of solids in the
     * layer). Note that porosity = void ratio / (1 + void ratio).
     */
    public double vRatio;
    /**
     * the rate at which water seeps from the layer into the underlying native
     * soil when first constructed (in/hr or mm/hr). If there is an impermeable
     * floor or liner below the layer then use a value of 0.
     */
    public double seepage;
    /**
     * number of storage layer void volumes of runoff treated it takes to
     * completely clog the layer. Use a value of 0 to ignore clogging.
     */
    public int vClog; 

    private DecimalFormat df = new DecimalFormat("#.###");
    
    LIDStorage( int height, double vRatio, double seepage, int vClog )
    {
        this.height = height;
        this.vRatio = vRatio;
        this.seepage = seepage;
        this.vClog = vClog;
    }
    
    @Override
    public String toString()
    {
        return toString( 17 );
    }

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

        //Data
        sb.append( StringUtils.rightPad( df.format( this.height ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.vRatio ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.seepage ), padDistance ) );
        sb.append(StringUtils.rightPad(String.valueOf(this.vClog ), padDistance ) );

        return sb.toString();
    }
}