Package jsl.utilities.reporting
Class StatisticReporter
- java.lang.Object
-
- jsl.utilities.reporting.StatisticReporter
-
public class StatisticReporter extends java.lang.Object
A class to help with making useful statistical reports. Creates summary reports as StringBuilders based on the supplied list of statistics
-
-
Field Summary
Fields Modifier and Type Field Description static java.text.DecimalFormat
D2FORMAT
java.lang.String
DEFAULT_HEADER_FORMAT
java.lang.String
DEFAULT_ROW_FORMAT
java.lang.StringBuilder
myRowFormat
-
Constructor Summary
Constructors Constructor Description StatisticReporter()
Creates a Statistic Reporter with no statisticsStatisticReporter(java.util.List<StatisticAccessorIfc> listOfStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Statistic
addStatistic()
Creates and adds a statistic with no name to the reporterStatistic
addStatistic(java.lang.String name)
void
addStatistic(StatisticAccessorIfc statistic)
int
findSizeOfLongestName()
Finds the number of characters of the statistic with the longest namejava.lang.StringBuilder
getCSVStatistics()
Gets all the statistics in comma separated value format (includes header)java.lang.StringBuilder
getCSVStatistics(boolean header)
Gets all the statistics in comma separated value formatjava.lang.StringBuilder
getHalfWidthSummaryReport()
The summary statistics are presented with half-widths 95% confidence level with no titlejava.lang.StringBuilder
getHalfWidthSummaryReport(double confLevel)
The summary statistics are presented with half-widthsjava.lang.StringBuilder
getHalfWidthSummaryReport(java.lang.String title)
The summary statistics are presented with half-widths with default 95% confidence leveljava.lang.StringBuilder
getHalfWidthSummaryReport(java.lang.String title, double confLevel)
The summary statistics are presented with half-widthsjava.util.List<java.lang.StringBuilder>
getHalfWidthSummaryReportAsLaTeXTables()
List of StringBuilder representing LaTeX tables max 60 rowsjava.util.List<java.lang.StringBuilder>
getHalfWidthSummaryReportAsLaTeXTables(double confLevel)
List of StringBuilder representing LaTeX tables max 60 rowsjava.util.List<java.lang.StringBuilder>
getHalfWidthSummaryReportAsLaTeXTables(int maxRows, double confLevel)
List of StringBuilder representing LaTeX tablesjava.util.List<java.lang.StringBuilder>
getHalfWidthSummaryReportAsLaTeXTabular()
Gets statistics as LaTeX tabular.java.util.List<java.lang.StringBuilder>
getHalfWidthSummaryReportAsLaTeXTabular(double confLevel)
Gets statistics as LaTeX tabular.java.util.List<java.lang.StringBuilder>
getHalfWidthSummaryReportAsLaTeXTabular(int maxRows, double confLevel)
Gets statistics as LaTeX tabular.boolean
getReportLabelFlag()
Whether or not the report labeling occursjava.lang.String
getReportTitle()
Gets the report titlejava.lang.StringBuilder
getSummaryReport()
Gets the Summary Report as a StringBuilder with no titlejava.lang.StringBuilder
getSummaryReport(java.lang.String title)
Gets the Summary Report as a StringBuilderjava.util.List<java.lang.StringBuilder>
getSummaryReportAsLaTeXTables()
List of StringBuilder representing LaTeX tables max 60 rowsjava.util.List<java.lang.StringBuilder>
getSummaryReportAsLaTeXTables(int maxRows)
List of StringBuilder representing LaTeX tablesjava.util.List<java.lang.StringBuilder>
getSummaryReportAsLaTeXTabular()
Gets statistics as LaTeX tabular.java.util.List<java.lang.StringBuilder>
getSummaryReportAsLaTeXTabular(int maxRows)
Gets statistics as LaTeX tabular.boolean
getTimeDateFlag()
Whether or not the time and date are on the reportvoid
setDecimalPlaces(int n)
Changes the number of decimal places in the average reporting.void
setNameFieldSize(int n)
Changes the number of spaces for printing the namesvoid
setReportLabelFlag(boolean flag)
void
setReportTitle(java.lang.String title)
Sets the report title.void
setTimeDateFlag(boolean flag)
Indicate whether to have time/date on the report
-
-
-
Field Detail
-
D2FORMAT
public static final java.text.DecimalFormat D2FORMAT
-
DEFAULT_ROW_FORMAT
public final java.lang.String DEFAULT_ROW_FORMAT
- See Also:
- Constant Field Values
-
DEFAULT_HEADER_FORMAT
public final java.lang.String DEFAULT_HEADER_FORMAT
- See Also:
- Constant Field Values
-
myRowFormat
public final java.lang.StringBuilder myRowFormat
-
-
Constructor Detail
-
StatisticReporter
public StatisticReporter()
Creates a Statistic Reporter with no statistics
-
StatisticReporter
public StatisticReporter(java.util.List<StatisticAccessorIfc> listOfStats)
- Parameters:
listOfStats
- a list containing the StatisticAccessorIfc instances
-
-
Method Detail
-
addStatistic
public final Statistic addStatistic()
Creates and adds a statistic with no name to the reporter- Returns:
- the created statistic
-
addStatistic
public final Statistic addStatistic(java.lang.String name)
- Parameters:
name
- the name of the statistic to add to the reporter- Returns:
- the created statistic
-
addStatistic
public final void addStatistic(StatisticAccessorIfc statistic)
- Parameters:
statistic
- the statistic to add, must not be null
-
getReportTitle
public final java.lang.String getReportTitle()
Gets the report title- Returns:
- the title as a string
-
setReportTitle
public final void setReportTitle(java.lang.String title)
Sets the report title. The title appears as the first line of any report.- Parameters:
title
- the title
-
findSizeOfLongestName
public int findSizeOfLongestName()
Finds the number of characters of the statistic with the longest name- Returns:
- number of characters
-
setNameFieldSize
public final void setNameFieldSize(int n)
Changes the number of spaces for printing the names- Parameters:
n
- must be between 10 and 99
-
setDecimalPlaces
public final void setDecimalPlaces(int n)
Changes the number of decimal places in the average reporting.- Parameters:
n
- must be between 0 and 9
-
setReportLabelFlag
public final void setReportLabelFlag(boolean flag)
- Parameters:
flag
- true means labeling is on report
-
getReportLabelFlag
public final boolean getReportLabelFlag()
Whether or not the report labeling occurs- Returns:
- true means labeling is on report
-
setTimeDateFlag
public final void setTimeDateFlag(boolean flag)
Indicate whether to have time/date on the report- Parameters:
flag
- true means yes
-
getTimeDateFlag
public final boolean getTimeDateFlag()
Whether or not the time and date are on the report- Returns:
- true means it is
-
getHalfWidthSummaryReport
public java.lang.StringBuilder getHalfWidthSummaryReport()
The summary statistics are presented with half-widths 95% confidence level with no title- Returns:
- a StringBuilder holding the report
-
getHalfWidthSummaryReport
public java.lang.StringBuilder getHalfWidthSummaryReport(java.lang.String title)
The summary statistics are presented with half-widths with default 95% confidence level- Parameters:
title
- optional title of the report- Returns:
- a StringBuilder holding the report
-
getHalfWidthSummaryReport
public java.lang.StringBuilder getHalfWidthSummaryReport(double confLevel)
The summary statistics are presented with half-widths- Parameters:
confLevel
- confidence level for the half-widths- Returns:
- a StringBuilder holding the report
-
getHalfWidthSummaryReport
public java.lang.StringBuilder getHalfWidthSummaryReport(java.lang.String title, double confLevel)
The summary statistics are presented with half-widths- Parameters:
title
- optional title of the reportconfLevel
- confidence level for the half-widths- Returns:
- a StringBuilder holding the report
-
getSummaryReport
public java.lang.StringBuilder getSummaryReport()
Gets the Summary Report as a StringBuilder with no title- Returns:
- the StringBuilder
-
getSummaryReport
public java.lang.StringBuilder getSummaryReport(java.lang.String title)
Gets the Summary Report as a StringBuilder- Parameters:
title
- an optional title for the report- Returns:
- the StringBuilder
-
getSummaryReportAsLaTeXTabular
public java.util.List<java.lang.StringBuilder> getSummaryReportAsLaTeXTabular()
Gets statistics as LaTeX tabular. Each StringBuilder in the list represents a tabular with a maximum number of rows = 60confidence limit is 0.95
Response Name Average Std. Dev.
Note: If the name has any special LaTeX characters the resulting tabular may not compile.
- Returns:
- a List of StringBuilders
-
getSummaryReportAsLaTeXTabular
public java.util.List<java.lang.StringBuilder> getSummaryReportAsLaTeXTabular(int maxRows)
Gets statistics as LaTeX tabular. Each StringBuilder in the list represents a tabular with a maximum number of rowsconfidence limit is 0.95
Response Name Average Std. Dev.
Note: If the name has any special LaTeX characters the resulting tabular may not compile.
- Parameters:
maxRows
- maximum number of rows in each tabular- Returns:
- a List of StringBuilders
-
getHalfWidthSummaryReportAsLaTeXTabular
public java.util.List<java.lang.StringBuilder> getHalfWidthSummaryReportAsLaTeXTabular()
Gets statistics as LaTeX tabular. Each StringBuilder in the list represents a tabular with a maximum number of rows = 60 and 0.95 confidence limitResponse Name Average Half-width
Note: If the name has any special LaTeX characters the resulting tabular may not compile.
- Returns:
- a List of StringBuilders
-
getHalfWidthSummaryReportAsLaTeXTabular
public java.util.List<java.lang.StringBuilder> getHalfWidthSummaryReportAsLaTeXTabular(double confLevel)
Gets statistics as LaTeX tabular. Each StringBuilder in the list represents a tabular with a maximum number of rows = 60Response Name Average Half-width
Note: If the name has any special LaTeX characters the resulting tabular may not compile.
- Parameters:
confLevel
- the confidence level for the half-width calculation- Returns:
- a List of StringBuilders
-
getHalfWidthSummaryReportAsLaTeXTabular
public java.util.List<java.lang.StringBuilder> getHalfWidthSummaryReportAsLaTeXTabular(int maxRows, double confLevel)
Gets statistics as LaTeX tabular. Each StringBuilder in the list represents a tabular with a maximum number of rowsResponse Name Average Half-width
Note: If the name has any special LaTeX characters the resulting tabular may not compile.
- Parameters:
maxRows
- maximum number of rows in each tabularconfLevel
- the confidence level for the half-width calculation- Returns:
- a List of StringBuilders
-
getHalfWidthSummaryReportAsLaTeXTables
public final java.util.List<java.lang.StringBuilder> getHalfWidthSummaryReportAsLaTeXTables()
List of StringBuilder representing LaTeX tables max 60 rows- Returns:
- the tables as StringBuilders
-
getHalfWidthSummaryReportAsLaTeXTables
public final java.util.List<java.lang.StringBuilder> getHalfWidthSummaryReportAsLaTeXTables(double confLevel)
List of StringBuilder representing LaTeX tables max 60 rows- Parameters:
confLevel
- the confidence level for the half-width- Returns:
- the tables as StringBuilders
-
getHalfWidthSummaryReportAsLaTeXTables
public final java.util.List<java.lang.StringBuilder> getHalfWidthSummaryReportAsLaTeXTables(int maxRows, double confLevel)
List of StringBuilder representing LaTeX tables- Parameters:
maxRows
- the max number of rowsconfLevel
- the confidence level- Returns:
- the tables as StringBuilders
-
getSummaryReportAsLaTeXTables
public final java.util.List<java.lang.StringBuilder> getSummaryReportAsLaTeXTables()
List of StringBuilder representing LaTeX tables max 60 rows- Returns:
- the tables as StringBuilders
-
getSummaryReportAsLaTeXTables
public final java.util.List<java.lang.StringBuilder> getSummaryReportAsLaTeXTables(int maxRows)
List of StringBuilder representing LaTeX tables- Parameters:
maxRows
- the maximum number of rows in a table- Returns:
- the tables as StringBuilders
-
getCSVStatistics
public final java.lang.StringBuilder getCSVStatistics()
Gets all the statistics in comma separated value format (includes header)- Returns:
- the csv as a StringBuilder
-
getCSVStatistics
public final java.lang.StringBuilder getCSVStatistics(boolean header)
Gets all the statistics in comma separated value format- Parameters:
header
- true means 1st line is header- Returns:
- the csv as a StringBuilder
-
-