Package jebl.util
Class NumberFormatter
- java.lang.Object
-
- jebl.util.NumberFormatter
-
public class NumberFormatter extends java.lang.Object
An interface for a numerical column in a log.- Version:
- $Id: NumberFormatter.java 1003 2009-06-05 04:18:57Z stevensh $
- Author:
- Andrew Rambaut, Alexei Drummond
-
-
Constructor Summary
Constructors Constructor Description NumberFormatter(int sf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDecimalPlaces()
Get the number of decimal places to display when formatted.java.lang.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.
-
-
-
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 java.lang.String getFormattedValue(double value)
Returns a string containing the current value for this column with appropriate formatting.- Returns:
- the formatted string.
-
-