public class StatisticsFormat extends TabularFormat<Statistics>
Statistics
object.
By default, newly created StatisticsFormat
instances will format statistical values
in a tabular format using spaces as the column separator.
Number of values: 8726 Minimum value: 6.853 Maximum value: 8.259 Mean value: 7.421 Root Mean Square: 7.846 Standard deviation: 6.489
Limitations:
StatisticsFormat
, like most java.text.Format
subclasses, is not thread-safe.Statistics.toString()
,
Serialized FormDefined in the sis-utility
module
Format.Field
beforeFill, columnSeparator, fillCharacter, lineSeparator, omitTrailingNulls
Constructor and Description |
---|
StatisticsFormat(Locale locale,
Locale headerLocale,
TimeZone timezone)
Constructs a new format for the given numeric and header locales.
|
Modifier and Type | Method and Description |
---|---|
StatisticsFormat |
clone()
Returns a clone of this format.
|
StringBuffer |
format(Object object,
StringBuffer toAppendTo,
FieldPosition pos)
Formats the given statistics.
|
void |
format(Statistics[] stats,
Appendable toAppendTo)
Formats the given statistics in a tabular format.
|
void |
format(Statistics stats,
Appendable toAppendTo)
Formats a localized string representation of the given statistics.
|
int |
getBorderWidth()
Returns the "width" of the border to drawn around the table, in number of lines.
|
static StatisticsFormat |
getInstance()
Returns an instance for the current system default locale.
|
static StatisticsFormat |
getInstance(Locale locale)
Returns an instance for the given locale.
|
Locale |
getLocale(Locale.Category category)
Returns the locale for the given category.
|
Class<Statistics> |
getValueType()
Returns the type of objects formatted by this class.
|
boolean |
isForAllPopulation()
Returns
true if this formatter shall consider that the statistics where computed
using the totality of the populations under study. |
Statistics |
parse(CharSequence text,
ParsePosition pos)
Not yet supported.
|
void |
setBorderWidth(int borderWidth)
Sets the "width" of the border to drawn around the table, in number of lines.
|
void |
setForAllPopulation(boolean allPopulation)
Sets whether this formatter shall consider that the statistics where computed using
the totality of the populations under study.
|
getColumnSeparatorMatcher, getColumnSeparatorPattern, getLineSeparator, setColumnSeparatorPattern, setLineSeparator
createFormat, getFormat, getLocale, getTimeZone, parseObject, parseObject
format, formatToCharacterIterator
public StatisticsFormat(Locale locale, Locale headerLocale, TimeZone timezone)
Statistics
are dates.locale
- the locale to use for numbers, dates and angles formatting,
or null
for the root locale.headerLocale
- the locale for row and column headers. Usually same as locale
.timezone
- the timezone, or null
for UTC.public static StatisticsFormat getInstance()
public static StatisticsFormat getInstance(Locale locale)
locale
- the locale for which to get a StatisticsFormat
instance.public Locale getLocale(Locale.Category category)
Locale.Category.DISPLAY
— the headerLocale
given at construction time.Locale.Category.FORMAT
— the locale
given at construction time,
used for all values below the header row.getLocale
in class CompoundFormat<Statistics>
category
- the category for which a locale is desired.null
).public final Class<Statistics> getValueType()
getValueType
in class CompoundFormat<Statistics>
Statistics.class
public boolean isForAllPopulation()
true
if this formatter shall consider that the statistics where computed
using the totality of the populations under study. This information impacts the standard
deviation values to be formatted.true
if the statistics to format where computed using the totality of
the populations under study.Statistics.standardDeviation(boolean)
public void setForAllPopulation(boolean allPopulation)
false
.allPopulation
- true
if the statistics to format where computed using
the totality of the populations under study.Statistics.standardDeviation(boolean)
public int getBorderWidth()
public void setBorderWidth(int borderWidth)
│
,─
)║
,═
)borderWidth
- the border width, in number of lines.public Statistics parse(CharSequence text, ParsePosition pos) throws ParseException
parse
in class CompoundFormat<Statistics>
text
- the character sequence for the object to parse.pos
- the position where to start the parsing.
On return, the position where the parsing stopped or where an error occurred.ParseException
- currently always thrown.public StringBuffer format(Object object, StringBuffer toAppendTo, FieldPosition pos)
format
in class CompoundFormat<Statistics>
object
- the object to format.toAppendTo
- where to format the object.pos
- ignored in current implementation.public void format(Statistics stats, Appendable toAppendTo) throws IOException
format
in class CompoundFormat<Statistics>
stats
- the statistics to format.toAppendTo
- where to format the statistics.IOException
- if an error occurred while writing to the given appendable.public void format(Statistics[] stats, Appendable toAppendTo) throws IOException
stats
- the statistics to format.toAppendTo
- where to format the statistics.IOException
- if an error occurred while writing to the given appendable.public StatisticsFormat clone()
clone
in class TabularFormat<Statistics>
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.