SwmmFile.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 org.apache.commons.lang3.StringUtils;
import static utils.StringHelpers.splitWithQuotes;
/**
*
* @author Lucas Yaege
*/
public class SwmmFile {
String use;
String type;
String fileName;
public SwmmFile( String line )
{
String[] params = splitWithQuotes( line );
this.use = params[0];
this.type = params[1];
this.fileName = params[2];
}
public SwmmFile( String use, String type, String fileName )
{
this.use = use;
this.type = type;
this.fileName = fileName;
}
@Override
public String toString()
{
return toString( 17 );
}
public String toString( int padDistance )
{
StringBuilder sb = new StringBuilder();
sb.append( StringUtils.rightPad( this.use, padDistance ) );
sb.append( StringUtils.rightPad( this.type, padDistance ) );
sb.append( StringUtils.rightPad( "\"" + this.fileName + "\"", padDistance ) );
sb.append( "\n" );
return sb.toString();
}
}