Class StatisticsFormat

  • All Implemented Interfaces:
    Serializable, Cloneable, Localized

    public class StatisticsFormat
    extends TabularFormat<Statistics>
    Formats a Statistics object. By default, newly created Statistics­Format instances will format statistical values in a tabular format using spaces as the column separator.
    Example:
    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:

    • The current implementation can only format features — parsing is not yet implemented.
    • Statistics­Format, like most java​.text​.Format subclasses, is not thread-safe.
    Since:
    0.3
    See Also:
    Statistics​.to­String(), Serialized Form

    Defined in the sis-utility module

    • Constructor Detail

      • StatisticsFormat

        public StatisticsFormat​(Locale locale,
                                Locale headerLocale,
                                TimeZone timezone)
        Constructs a new format for the given numeric and header locales. The timezone is used only if the values added to the Statistics are dates.
        Parameters:
        locale - the locale to use for numbers, dates and angles formatting, or null for the root locale.
        header­Locale - the locale for row and column headers. Usually same as locale.
        timezone - the timezone, or null for UTC.
    • Method Detail

      • getInstance

        public static StatisticsFormat getInstance()
        Returns an instance for the current system default locale.
        Returns:
        a statistics format instance for the current default locale.
      • getInstance

        public static StatisticsFormat getInstance​(Locale locale)
        Returns an instance for the given locale.
        Parameters:
        locale - the locale for which to get a Statistics­Format instance.
        Returns:
        a statistics format instance for the given locale.
      • isForAllPopulation

        public boolean isForAllPopulation()
        Returns 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.
        Returns:
        true if the statistics to format where computed using the totality of the populations under study.
        See Also:
        Statistics​.standard­Deviation(boolean)
      • setForAllPopulation

        public void setForAllPopulation​(boolean allPopulation)
        Sets whether this formatter shall consider that the statistics where computed using the totality of the populations under study. The default value is false.
        Parameters:
        all­Population - true if the statistics to format where computed using the totality of the populations under study.
        See Also:
        Statistics​.standard­Deviation(boolean)
      • getBorderWidth

        public int getBorderWidth()
        Returns the "width" of the border to drawn around the table, in number of lines. The default width is 0, which stands for no border.
        Returns:
        the border "width" in number of lines.
      • setBorderWidth

        public void setBorderWidth​(int borderWidth)
        Sets the "width" of the border to drawn around the table, in number of lines. The value can be any of the following:
        • 0 (the default) for no border
        • 1 for single line (,)
        • 2 for double lines (,)
        Parameters:
        border­Width - the border width, in number of lines.
      • format

        public void format​(Statistics stats,
                           Appendable toAppendTo)
                    throws IOException
        Formats a localized string representation of the given statistics. If statistics on differences are associated to the given object, they will be formatted too.
        Specified by:
        format in class Compound­Format<Statistics>
        Parameters:
        stats - the statistics to format.
        to­Append­To - where to format the statistics.
        Throws:
        IOException - if an error occurred while writing to the given appendable.
      • format

        public void format​(Statistics[] stats,
                           Appendable toAppendTo)
                    throws IOException
        Formats the given statistics in a tabular format. This method does not check for the statistics on differences - if such statistics are wanted, they must be included in the given array.
        Parameters:
        stats - the statistics to format.
        to­Append­To - where to format the statistics.
        Throws:
        IOException - if an error occurred while writing to the given appendable.