LIDUsage.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 LIDUsage
{
public String subcatchment;
public String LID;
public int number;
public double area;
public double width;
public double initSat;
public double fromImp;
public double toPerv;
public String rptFile;
public String drainTo;
public double fromPerv;
private DecimalFormat df = new DecimalFormat( "#.###" );
public LIDUsage( String subcat, String LID, int number, double area, double width, double initSat,
double fromImp, double toPerv, String rptFile, String drainTo, double fromPerv )
{
this.subcatchment = subcat;
this.LID = LID;
this.number = number;
this.area = area;
this.width = width;
this.initSat = initSat;
this.fromImp = fromImp;
this.toPerv = toPerv;
this.rptFile = rptFile;
this.drainTo = drainTo;
this.fromPerv = fromPerv;
}
public LIDUsage( String subcat, String LID, int number, double area, double width, String drainTo )
{
this.subcatchment = subcat;
this.LID = LID;
this.number = number;
this.area = area;
this.width = width;
this.initSat = 0;
this.fromImp = 100;
this.toPerv = 0;
this.rptFile = "*";
this.drainTo = drainTo;
this.fromPerv = 100;
}
@Override
public String toString()
{
return toString( 17, 40 );
}
public String toString( int padDistance, int namePadDistance )
{
StringBuilder sb = new StringBuilder();
//Data
sb.append(StringUtils.rightPad(this.subcatchment, namePadDistance ) );
sb.append( StringUtils.rightPad( this.LID, namePadDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.number ), padDistance ) );
sb.append( StringUtils.rightPad( df.format( this.area ), padDistance ) );
sb.append( StringUtils.rightPad( df.format( this.width ), padDistance ) );
sb.append( StringUtils.rightPad( df.format( this.initSat ), padDistance ) );
sb.append( StringUtils.rightPad( df.format( this.fromImp ), padDistance ) );
sb.append( StringUtils.rightPad( df.format( this.toPerv ), padDistance ) );
sb.append( StringUtils.rightPad( this.rptFile, padDistance ) );
sb.append( StringUtils.rightPad( this.drainTo, namePadDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.fromPerv ), padDistance ) );
sb.append( "\n" );
return sb.toString();
}
}