Conduit.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;
/**
*
* @author Lucas Yaege
*/
public class Conduit
{
public String name;
public String fromNode;
public String toNode;
public int length;
public double roughness;
public int inOffset;
public int outOffset;
public double initFlow;
public double maxFlow;
public Conduit( String name, String fromNode, String toNode, int length, double roughness, int inOffset, int outOffset, double initFlow, double maxFlow )
{
this.name = name;
this.fromNode = fromNode;
this.toNode = toNode;
this.length = length;
this.roughness = roughness;
this.inOffset = inOffset;
this.outOffset = outOffset;
this.initFlow = initFlow;
this.maxFlow = maxFlow;
}
public Conduit( String name, String fromNode, String toNode )
{
this.name = name;
this.fromNode = fromNode;
this.toNode = toNode;
this.length = 400;
this.roughness = 0.01;
this.inOffset = 0;
this.outOffset = 0;
this.initFlow = 0;
this.maxFlow = 0;
}
@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.name, namePadDistance ) );
sb.append( StringUtils.rightPad( this.fromNode, namePadDistance ) );
sb.append( StringUtils.rightPad( this.toNode, padDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.length ), padDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.roughness ), padDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.inOffset ), padDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.outOffset ), padDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.initFlow ), padDistance ) );
sb.append( StringUtils.rightPad( String.valueOf( this.maxFlow ), padDistance ) );
sb.append("\n");
return sb.toString();
}
}