1 package org.broadinstitute.hellbender.utils.report; 2 3 /** 4 * Column width and left/right alignment. 5 */ 6 public final class GATKReportColumnFormat { 7 public enum Alignment { LEFT, RIGHT } 8 private final int width; 9 private final Alignment alignment; 10 GATKReportColumnFormat(int width, Alignment alignment)11 public GATKReportColumnFormat(int width, Alignment alignment) { 12 this.width = width; 13 this.alignment = alignment; 14 } 15 getWidth()16 public int getWidth() { 17 return width; 18 } 19 getAlignment()20 public Alignment getAlignment() { 21 return alignment; 22 } 23 getNameFormat()24 public String getNameFormat() { 25 return "%-" + width + "s"; 26 } 27 getValueFormat()28 public String getValueFormat() { 29 switch (alignment) { 30 case LEFT: 31 return "%-" + width + "s"; 32 case RIGHT: 33 return "%" + width + "s"; 34 default: 35 throw new UnsupportedOperationException("Unknown alignment: " + alignment); 36 } 37 } 38 } 39