jebl.util
Class NumberFormatter

java.lang.Object
  extended by jebl.util.NumberFormatter

public class NumberFormatter
extends Object

An interface for a numerical column in a log.

Author:
Andrew Rambaut, Alexei Drummond

Constructor Summary
NumberFormatter(int sf)
           
 
Method Summary
 int getDecimalPlaces()
          Get the number of decimal places to display when formatted.
 String getFormattedValue(double value)
          Returns a string containing the current value for this column with appropriate formatting.
 int getSignificantFigures()
          Get the number of significant figures to display when formatted.
 void setDecimalPlaces(int dp)
          Set the number of decimal places to display when formatted.
 void setSignificantFigures(int sf)
          Set the number of significant figures to display when formatted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberFormatter

public NumberFormatter(int sf)
Method Detail

setSignificantFigures

public void setSignificantFigures(int sf)
Set the number of significant figures to display when formatted. Setting this overrides the decimal places option.


getSignificantFigures

public int getSignificantFigures()
Get the number of significant figures to display when formatted. Returns -1 if maximum s.f. are to be used.


setDecimalPlaces

public void setDecimalPlaces(int dp)
Set the number of decimal places to display when formatted. Setting this overrides the significant figures option.


getDecimalPlaces

public int getDecimalPlaces()
Get the number of decimal places to display when formatted. Returns -1 if maximum d.p. are to be used.


getFormattedValue

public String getFormattedValue(double value)
Returns a string containing the current value for this column with appropriate formatting.

Returns:
the formatted string.