Package jebl.util
Class NumberFormatter
java.lang.Object
jebl.util.NumberFormatter
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 -
Method Summary
Modifier and TypeMethodDescriptionint
Get the number of decimal places to display when formatted.getFormattedValue
(double value) Returns a string containing the current value for this column with appropriate formatting.int
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.
-
Constructor Details
-
NumberFormatter
public NumberFormatter(int sf)
-
-
Method Details
-
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
Returns a string containing the current value for this column with appropriate formatting.- Returns:
- the formatted string.
-