LIDSurface.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 LIDSurface
{
    /**
     * when confining walls or berms are present this is the maximum depth to which 
     * water can pond above the surface of the unit before overflow occurs (in inches or mm). 
     * For LIDs that experience overland flow it is the height of any surface depression storage. 
     * For swales, it is the height of its trapezoidal cross section.
     */
    public double storeHt;
    /**
     * fraction of the surface storage volume that is filled with vegetation.
     */
    public double vegFrac;
    /**
     * Manning's n for overland flow over surface soil cover, pavement, roof surface or a 
     * vegetative swale. Use 0 for other types of LIDs.
     */
    public double rough;
    /**
     * slope of a roof surface, pavement surface or vegetative swale (percent). 
     * Use 0 for other types of LIDs.
     */
    public double slope;
    /**
     * slope (run over rise) of the side walls of a vegetative swale's cross section. 
     * Use 0 for other types of LIDs.  Only used for vegetative swale LID type.
     */
    public double xSlope;
    
    private DecimalFormat df = new DecimalFormat("#.###");
    
    public LIDSurface(double storeHt, double vegFrac, double rough, double slope, double xSlope)
    {
        this.storeHt = storeHt;
        this.vegFrac = vegFrac;
        this.rough = rough;
        this.slope = slope;
        this.xSlope = xSlope;
    }
    
    public LIDSurface(double storeHt, double vegFrac, double rough, double slope)
    {
        this.storeHt = storeHt;
        this.vegFrac = vegFrac;
        this.rough = rough;
        this.slope = slope;
        this.xSlope = 0;
    }
    
    @Override
    public String toString()
    {
        return toString(17);
    }
    
    public String toString(int padDistance)
    {
        StringBuilder sb = new StringBuilder();

        //Data
        sb.append( StringUtils.rightPad( df.format( this.storeHt ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.vegFrac ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.rough ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.slope ), padDistance ) );
        sb.append( StringUtils.rightPad( df.format( this.xSlope ), padDistance ) );

        return sb.toString();
    }
}