public class FormattedOutput
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Method and Description |
|---|---|
int |
displayDecimal(java.io.PrintWriter out,
double number,
int width)
print decimal number with a prespecified number
of digits after the point
|
void |
displayInteger(java.io.PrintWriter out,
int num,
int maxNum)
print integer, aligned to a reference number,
(introducing space at the left side)
|
void |
displayIntegerWhite(java.io.PrintWriter out,
int maxNum)
print whitespace of length of a string displaying a given integer
|
void |
displayLabel(java.io.PrintWriter out,
java.lang.String label,
int width)
print label with a prespecified length
(label will be shortened or spaces will introduced, if necessary)
|
java.lang.String |
getDecimalString(double number,
int width)
Returns a decimal string representation of a number with
constrained width.
|
static FormattedOutput |
getInstance()
create instance of this class
(note that there is no public constructor
as this class is a singleton)
|
java.lang.String |
getSFString(double[] numbers,
int sf,
java.lang.String delimiter) |
java.lang.String |
getSFString(double number,
int sf) |
void |
multiplePrint(java.io.PrintWriter out,
char c,
int num)
repeatedly print a character
|
static java.lang.String |
space(int size,
char c)
returns of string of a given length of a single character.
|
public static FormattedOutput getInstance()
public int displayDecimal(java.io.PrintWriter out,
double number,
int width)
out - output streamnumber - to be printedwidth - number of fraction digitspublic java.lang.String getDecimalString(double number,
int width)
public java.lang.String getSFString(double[] numbers,
int sf,
java.lang.String delimiter)
public java.lang.String getSFString(double number,
int sf)
public void displayLabel(java.io.PrintWriter out,
java.lang.String label,
int width)
out - output streamlabel - label to be printedwidth - desired lengthpublic void displayInteger(java.io.PrintWriter out,
int num,
int maxNum)
out - output streamnum - number to be printedmaxNum - reference numberpublic void displayIntegerWhite(java.io.PrintWriter out,
int maxNum)
output - streammaxNum - numberpublic void multiplePrint(java.io.PrintWriter out,
char c,
int num)
out - output streamc - characternum - number of repeatspublic static java.lang.String space(int size,
char c)
size - length of the string requiredc - character