XSection.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 XSection
{
    String link;
    String shape;
    double geom1;
    double geom2;
    double geom3;
    double geom4;
    int barrels;
    int culvert;
    
    public XSection(String link)
    {
        this.link = link;
        this.shape = "DUMMY";
        this.geom1 = this.geom2 = this.geom3 = this.geom4 = 0;
        this.barrels = 1;
    }
    
    @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.link, namePadDistance ) );
        sb.append( StringUtils.rightPad( this.shape, padDistance ) );
        sb.append( StringUtils.rightPad( String.valueOf( this.geom1 ), padDistance ) );
        sb.append( StringUtils.rightPad( String.valueOf( this.geom2 ), padDistance ) );
        sb.append( StringUtils.rightPad( String.valueOf( this.geom3 ), padDistance ) );
        sb.append( StringUtils.rightPad( String.valueOf( this.geom4 ), padDistance ) );
        sb.append( StringUtils.rightPad( String.valueOf( this.barrels ), padDistance ) );
        sb.append("\n");
        
        return sb.toString();
    }
}