Package pal.io
Class FormattedOutput
java.lang.Object
pal.io.FormattedOutput
- All Implemented Interfaces:
Serializable
tools to simplify formatted output to a stream
- Version:
- $Id: FormattedOutput.java,v 1.17 2003/04/03 05:55:53 matt Exp $
- Author:
- Korbinian Strimmer, Alexei Drummond
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintdisplayDecimal(PrintWriter out, double number, int width) print decimal number with a prespecified number of digits after the pointvoiddisplayInteger(PrintWriter out, int num, int maxNum) print integer, aligned to a reference number, (introducing space at the left side)voiddisplayIntegerWhite(PrintWriter out, int maxNum) print whitespace of length of a string displaying a given integervoiddisplayLabel(PrintWriter out, String label, int width) print label with a prespecified length (label will be shortened or spaces will introduced, if necessary)getDecimalString(double number, int width) Returns a decimal string representation of a number with constrained width.static FormattedOutputcreate instance of this class (note that there is no public constructor as this class is a singleton)getSFString(double[] numbers, int sf, String delimiter) getSFString(double number, int sf) voidmultiplePrint(PrintWriter out, char c, int num) repeatedly print a characterstatic Stringspace(int size, char c) returns of string of a given length of a single character.
-
Method Details
-
getInstance
create instance of this class (note that there is no public constructor as this class is a singleton) -
displayDecimal
print decimal number with a prespecified number of digits after the point- Parameters:
out- output streamnumber- to be printedwidth- number of fraction digits- Returns:
- length of the string printed
-
getDecimalString
Returns a decimal string representation of a number with constrained width. -
getSFString
-
getSFString
-
displayLabel
print label with a prespecified length (label will be shortened or spaces will introduced, if necessary)- Parameters:
out- output streamlabel- label to be printedwidth- desired length
-
displayInteger
print integer, aligned to a reference number, (introducing space at the left side)- Parameters:
out- output streamnum- number to be printedmaxNum- reference number
-
displayIntegerWhite
print whitespace of length of a string displaying a given integer- Parameters:
output- streammaxNum- number
-
multiplePrint
repeatedly print a character- Parameters:
out- output streamc- characternum- number of repeats
-
space
returns of string of a given length of a single character.- Parameters:
size- length of the string requiredc- character
-