|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormat
umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormatExcel
public class PerformanceMeasureFormatExcel
Provides methods used to format matrices of performance measures into
Microsoft Excel spreadsheets. This class uses the JExcel API library to
construct a workbook in memory, i.e., an instance of WritableWorkbook
.
Some methods are provided to add sheets to the current workbook, and tables
of results to the current sheet. Methods are finally available to transfer
the in-memory workbook into a disk file that can be read by Microsoft Excel,
OpenOffice.org Calc, etc.
For example, the following code creates an Excel file containing three sheets
containing the statistics for each aggregate performance measures (e.g.,
service level for all contact types, over all periods), the statistics for
time-aggregate measures (e.g., service level for contacts of type k over
all periods, for all k), and statistics for all performance measures (e.g.,
service level for contacts of type k during period p, for all k and
p). The variable sim corresponds to any instance of
ContactCenterSim
.
PerformanceMeasureFormatExcel2fmt = new PerformanceMeasureFormatExcel2(); fmt.newSheet ("Summary"); fmt.formatStatisticsSummary (sim, 0.95, sim.getPerformanceMeasures()); fmt.newSheet ("Detailed, without individual period"); for (PerformanceMeasureType pm : sim.getPerformanceMeasures()) fmt.formatStatisticsDetailedHidePeriods (sim, 0.95, pm); fmt.newSheet ("Detailed, with individual periods"); for (PerformanceMeasureType pm : sim.getPerformanceMeasures()) fmt.formatStatisticsDetailed (sim, 0.95, pm); fmt.writeWorkbook (new File ("output.xls"));
Field Summary | |
---|---|
static String |
defaultDetailedSheetNameWithoutPeriods
|
static String |
defaultDetailedSheetNameWithPeriods
|
static String |
defaultObsSheetName
|
static String |
defaultSummarySheetName
|
Fields inherited from class umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormat |
---|
agentGroupProperties, contactTypeProperties, histogramList |
Constructor Summary | |
---|---|
PerformanceMeasureFormatExcel(WritableWorkbook wb)
Constructs a new performance measure formatter with the workbook wb. |
|
PerformanceMeasureFormatExcel(WritableWorkbook wb,
ReportParams reportParams)
|
Method Summary | |
---|---|
WritableCellFormat |
createTitleCellStyle()
Creates a cell style for cells containing titles for tables of results. |
WritableCellFormat |
createVerticalTitleCellStyle()
|
boolean |
formatInfo(Map<String,Object> info)
Appends rows containing the evaluation information info to the current spreadsheet. |
boolean |
formatObservations(ContactCenterSimWithObservations sim,
ReportParams reportParams)
For each element PerformanceMeasureParams
returned by ReportParams.getPrintedObs() ,
formats the complete list of observations
generated by the simulator sim
for the referred performance measure. |
boolean |
formatStatistics(ContactCenterSim sim,
ReportParams reportParams)
Similar to formatValues(ContactCenterEval,ReportParams) , except
this formats a full statistical report using
formatStatisticsSummary(ContactCenterSim,double,String,PerformanceMeasureType[]) ,
and
formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType) . |
boolean |
formatStatisticsDetailed(ContactCenterSim sim,
double level,
PerformanceMeasureType pm)
Adds a statistical report for all the values of the performance measure pm estimated by the simulator sim, with confidence intervals with level level, to the current spreadsheet. |
boolean |
formatStatisticsDetailedHidePeriods(ContactCenterSim sim,
double level,
PerformanceMeasureType pm)
Similar to formatStatisticsDetailedMatrix(ContactCenterSim,double,PerformanceMeasureType)
but does not format per-period statistics. |
boolean |
formatStatisticsDetailedMatrix(ContactCenterSim sim,
double level,
PerformanceMeasureType pm)
|
boolean |
formatStatisticsSummary(ContactCenterSim sim,
double level,
String description,
PerformanceMeasureType... pms)
Adds a statistical report for all the performance measures in pms supported by the contact center simulator sim to the current spreadsheet. |
void |
formatValueRow(String name,
Date val,
boolean borderTop,
boolean borderBottom,
boolean borderBefore,
boolean borderBetween,
boolean borderAfter)
Similar to formatValueRow(String,String,boolean,boolean,boolean,boolean,boolean,boolean) ,
with val being a date. |
void |
formatValueRow(String name,
double val,
boolean percent,
TimeUnit timeUnit,
boolean borderTop,
boolean borderBottom,
boolean borderBefore,
boolean borderBetween,
boolean borderAfter)
Similar to formatValueRow(String,String,boolean,boolean,boolean,boolean,boolean,boolean) ,
with val being a numeric value. |
void |
formatValueRow(String name,
int value,
boolean borderTop,
boolean borderBottom,
boolean borderBefore,
boolean borderBetween,
boolean borderAfter)
Similar to formatValueRow(String,String,boolean,boolean,boolean,boolean,boolean,boolean) ,
with val being an integer. |
void |
formatValueRow(String name,
String val,
boolean borderTop,
boolean borderBottom,
boolean borderBefore,
boolean borderBetween,
boolean borderAfter,
boolean wrapText)
Adds a new row containing the value val of a string with name name. |
boolean |
formatValues(ContactCenterEval eval,
ReportParams reportParams)
Formats a workbook containing the report of the last evaluation performed by the system eval. |
boolean |
formatValuesDetailed(ContactCenterEval eval,
PerformanceMeasureType pm)
Adds a table containing the current values of the performance measures of type pm estimated by the evaluation system eval to the current spreadsheet. |
boolean |
formatValuesDetailedHidePeriods(ContactCenterEval eval,
PerformanceMeasureType pm)
Similar to formatValuesDetailedMatrix(ContactCenterEval,PerformanceMeasureType)
except per-period values are not displayed. |
boolean |
formatValuesDetailedMatrix(ContactCenterEval eval,
PerformanceMeasureType pm)
Adds a table containing the current values of the performance measures of type pm estimated by the evaluation system eval to the current spreadsheet. |
boolean |
formatValuesMatrix(ContactCenterInfo eval,
PerformanceMeasureType pm,
DoubleMatrix2D valm,
int row,
int column,
int height,
int width,
boolean transposedValm,
String description)
This is similar to formatValuesSingleColumn(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,String) ,
except that the formatted table has dimensions a×b. |
boolean |
formatValuesSingleColumn(ContactCenterInfo eval,
PerformanceMeasureType pm,
DoubleMatrix2D valm,
int row,
int column,
int height,
int width,
String description)
Adds a table to the current spreadsheet containing the values in a matrix valm. viewPart
(row, column, height, width) concerning performance measures of
type pm obtained with the evaluation system eval. |
boolean |
formatValuesSummary(ContactCenterEval eval,
String description,
PerformanceMeasureType... pms)
Adds a report for all the performance measures pms supported by the evaluation system eval into the current spreadsheet. |
boolean |
getColumnOutlines()
Determines if column outlines are created by formatting methods. |
int |
getCurrentRow()
Returns the index of the current row into the current spreadsheet. |
WritableSheet |
getCurrentSheet()
Returns the high-level object representing the current spreadsheet. |
WritableWorkbook |
getCurrentWorkbook()
Returns the high-level object representing the current workbook. |
RowType[] |
getDestinationRowTypes()
|
int |
getMaxColumns()
Returns the maximal number of columns a spreadsheet may contain. |
boolean |
getRowOutlines()
Determines if row outlines are created by formatting methods. |
boolean |
getRowOverwrite()
Determines the status of row overwriting which affects how rows are managed when the current row index is smaller than the number of rows. |
int |
getStartingColumn()
Returns the index of the starting column of subsequent tables of results. |
void |
groupColumn(int fromColumn,
int toColumn)
Similar to groupRow(int,int) , for creating column outlines. |
void |
groupRow(int fromRow,
int toRow)
This method does nothing as JExcel API does not support outlining yet. |
void |
newSheet(String sheetName)
Creates a new WritableSheet with name sheetName, and sets
this new sheet as the current one. |
void |
setColumnOutlines(boolean columnOutlines)
Sets the column outlines flag to columnOutlines. |
void |
setCurrentRow(int currentRow)
Sets the index of the current row to currentRow |
void |
setCurrentSheet(WritableSheet sheet)
Sets the current sheet to sheet, and resets the current row and starting column to 0. |
void |
setCurrentWorkbook(WritableWorkbook workbook)
Sets the current workbook to workbook. |
void |
setMaxColumns(int maxColumns)
Sets the maximal number of columns in a spreadsheet to maxColumns. |
void |
setRowOutlines(boolean rowOutlines)
Sets the row outlines flag to rowOutlines. |
void |
setRowOverwrite(boolean rowOverwrite)
Sets the status of row overwriting to rowOverwrite. |
void |
setStartingColumn(int startingColumn)
Sets the index of the starting column to startingColumn. |
void |
skipRow()
Increments the current row index to leave a blank row in the current spreadsheet. |
void |
writeWorkbook()
Writes the current workbook.. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String defaultSummarySheetName
public static final String defaultDetailedSheetNameWithoutPeriods
public static final String defaultDetailedSheetNameWithPeriods
public static final String defaultObsSheetName
Constructor Detail |
---|
public PerformanceMeasureFormatExcel(WritableWorkbook wb)
wb
- the workbook used for formatting.public PerformanceMeasureFormatExcel(WritableWorkbook wb, ReportParams reportParams)
Method Detail |
---|
public void newSheet(String sheetName)
WritableSheet
with name sheetName, and sets
this new sheet as the current one. This method resets the current row
index to 0, and the starting column to 0.
If a sheet with the given name already exists, this method appends a number to the given name. The number is incremented until the resulting resulting sheet name is unused.
sheetName
- the name of the new sheet.public int getCurrentRow()
public void setCurrentRow(int currentRow)
currentRow
- the new index of the current row.public int getStartingColumn()
public void setStartingColumn(int startingColumn)
startingColumn
- the new starting column.public WritableWorkbook getCurrentWorkbook()
public void setCurrentWorkbook(WritableWorkbook workbook)
workbook
- the new current workbook.public WritableSheet getCurrentSheet()
public void setCurrentSheet(WritableSheet sheet)
sheet
- the new current sheet.public boolean getRowOverwrite()
public void setRowOverwrite(boolean rowOverwrite)
rowOverwrite
- the new status of row overwriting.public boolean getColumnOutlines()
public void setColumnOutlines(boolean columnOutlines)
columnOutlines
- the new value of the flag.public boolean getRowOutlines()
public void setRowOutlines(boolean rowOutlines)
rowOutlines
- the new value of the flag.public int getMaxColumns()
formatValuesMatrix(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,boolean,String)
,
and
formatStatisticsDetailedMatrix(ContactCenterSim,double,PerformanceMeasureType)
work.
public void setMaxColumns(int maxColumns)
maxColumns
- the maximal number of columns in a spreadsheet.public void writeWorkbook() throws IOException
IOException
- if an I/O error occurs during writing.public void groupRow(int fromRow, int toRow)
fromRow
- the starting row of the outline.toRow
- the ending row of the outline.public void groupColumn(int fromColumn, int toColumn)
groupRow(int,int)
, for creating column outlines.
fromColumn
- the starting column.toColumn
- the ending column.public WritableCellFormat createTitleCellStyle() throws WriteException
By default, this method uses the CellFormat
no-argument
constructor to create the cell style, and sets its alignment to
``center''. One can override this method to apply user-defined cell styles
(colors, fill patterns, borders, etc.).
WriteException
public WritableCellFormat createVerticalTitleCellStyle() throws WriteException
WriteException
public void formatValueRow(String name, String val, boolean borderTop, boolean borderBottom, boolean borderBefore, boolean borderBetween, boolean borderAfter, boolean wrapText) throws WriteException
name
- the name of the quantity.val
- the value of the quantity.borderTop
- determines if a top border must be set for the cells.borderBottom
- determines if a bottom border must be set for the cells.borderBefore
- determines if a left border must be set for the first cell.borderBetween
- determines if a border must separate the two cells.borderAfter
- determines if a right border must be set for the second cell.wrapText
- determines if text can be wrapped.
WriteException
public void formatValueRow(String name, double val, boolean percent, TimeUnit timeUnit, boolean borderTop, boolean borderBottom, boolean borderBefore, boolean borderBetween, boolean borderAfter) throws WriteException
formatValueRow(String,String,boolean,boolean,boolean,boolean,boolean,boolean)
,
with val being a numeric value. The value is formatted with the
general (default) style if percent is false, or in
percentage notation if percent is true.
name
- the name of the quantity.val
- the value of the quantity.percent
- determines if the percentage notation must be used.timeUnit
- the time unit of the formatted value, or
null if the value does not correspond to a time.borderTop
- determines if the cell containing the value has a top border.borderBottom
- determines if the cell containing the value has a bottom border.borderBefore
- determines if a left border must be set for the first cell.borderBetween
- determines if a border must separate the two cells.borderAfter
- determines if a right border must be set for the second cell.
WriteException
public void formatValueRow(String name, int value, boolean borderTop, boolean borderBottom, boolean borderBefore, boolean borderBetween, boolean borderAfter) throws WriteException
formatValueRow(String,String,boolean,boolean,boolean,boolean,boolean,boolean)
,
with val being an integer.
name
- the name of the quantity.value
- the value of the quantity.borderTop
- determines if a top border must be set for the first cell.borderBottom
- determines if a bottom border must be set for the first cell.borderBefore
- determines if a left border must be set for the first cell.borderBetween
- determines if a border must separate the two cells.borderAfter
- determines if a right border must be set for the second cell.
WriteException
public void formatValueRow(String name, Date val, boolean borderTop, boolean borderBottom, boolean borderBefore, boolean borderBetween, boolean borderAfter) throws WriteException
formatValueRow(String,String,boolean,boolean,boolean,boolean,boolean,boolean)
,
with val being a date.
name
- the name of the quantity.val
- the value of the quantity.borderTop
- determines if a top border must be set for the first cell.borderBottom
- determines if a bottom border must be set for the first cell.borderBefore
- determines if a left border must be set for the first cell.borderBetween
- determines if a border must separate the two cells.borderAfter
- determines if a right border must be set for the second cell.
WriteException
public void skipRow()
public boolean formatValuesSummary(ContactCenterEval eval, String description, PerformanceMeasureType... pms) throws WriteException
ContactCenterEval.getPerformanceMeasure(umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureType)
method to obtain
a matrix of values for each performance measure in pms supported
by eval. Considering the element at the bottom right of this
matrix as the aggregate value, the method then, for each performance
measure, adds a row containing the aggregate value.
The resulting table of results contains one row for each type of performance measure, and two columns (name of measure, and value).
eval
- the contact center evaluation system.pms
- the array of performance measures.
WriteException
public boolean formatValuesDetailed(ContactCenterEval eval, PerformanceMeasureType pm) throws WriteException
formatValuesSingleColumn(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,String)
with a matrix of values obtained via
eval.getPerformanceMeasure
, and a description obtained via
pm.getDescription()
.
eval
- the contact center evaluation system.pm
- the performance measure of interest.
WriteException
public boolean formatValuesDetailedMatrix(ContactCenterEval eval, PerformanceMeasureType pm) throws WriteException
formatValuesMatrix(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,boolean,String)
with a matrix of values obtained via
eval.getPerformanceMeasure
, and a description obtained via
pm.getDescription()
.
eval
- the contact center evaluation system.pm
- the performance measure of interest.
WriteException
public boolean formatValuesDetailedHidePeriods(ContactCenterEval eval, PerformanceMeasureType pm) throws WriteException
formatValuesDetailedMatrix(ContactCenterEval,PerformanceMeasureType)
except per-period values are not displayed.
eval
- the evaluation system.pm
- the type of performance measure.
WriteException
public boolean formatValuesSingleColumn(ContactCenterInfo eval, PerformanceMeasureType pm, DoubleMatrix2D valm, int row, int column, int height, int width, String description) throws WriteException
viewPart
(row, column, height, width) concerning performance measures of
type pm obtained with the evaluation system eval. The
string description provides a description for the matrix which is
displayed in a row preceding the table.
Suppose that the given matrix has dimensions a×b. For example, the
matrix can contain averages or sample variances for different contact
types and periods. This method formats the results as a
ab×1
matrix with one row for each element of valm. The names of rows
are constructed using
getName
(eval, pm, i, j).
eval
- the evaluation system.pm
- the type of performance measures concerned.valm
- the matrix of values.row
- the starting row of the matrix to be formatted.column
- the starting column of the matrix to be formatted.height
- the height of the formatted matrix.width
- the width of the formatted matrix.description
- the description for the formatted matrix.
WriteException
public boolean formatValuesMatrix(ContactCenterInfo eval, PerformanceMeasureType pm, DoubleMatrix2D valm, int row, int column, int height, int width, boolean transposedValm, String description) throws WriteException
formatValuesSingleColumn(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,String)
,
except that the formatted table has dimensions a×b. Tables
obtained via this method are often more readable than with the preceding
one, but they can contain excessively long lines if width is
large. If width is greater than getMaxColumns()
, this
method calls the result of
formatValuesSingleColumn(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,String)
.
If transposedValm is true, the given matrix is
considered to be transposed, i.e., the meaning of its rows and columns is
inverted with respect to a typical matrix of performance measures of type
pm. For example, let pm correspond to
PerformanceMeasureType.SERVEDRATES
. Usually, each row of
valm corresponds to a contact type. With transposedValm
enabled, each row of valm corresponds to an agent group. This
flag only affects how rows and columns are named; it does not change the
values being formatted.
eval
- the evaluation system.pm
- the type of performance measures concerned.valm
- the matrix of values.row
- the starting row of the matrix to be formatted.column
- the starting column of the matrix to be formatted.height
- the height of the formatted matrix.width
- the width of the formatted matrix.transposedValm
- determines if valm is transposed with respect to a
typical matrix of performance measures of type pm.description
- the description for the formatted matrix.
WriteException
public boolean formatStatisticsSummary(ContactCenterSim sim, double level, String description, PerformanceMeasureType... pms) throws WriteException
formatValuesSummary(umontreal.iro.lecuyer.contactcenters.app.ContactCenterEval, java.lang.String, umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureType...)
, with
additional statistical information such as miminum, maximum, standard
deviation, and confidence intervals with confidence level level,
if available.
sim
- the contact center simulator.level
- the confidence level of the confidence intervals.pms
- the array of performance measures.
WriteException
public boolean formatStatisticsDetailed(ContactCenterSim sim, double level, PerformanceMeasureType pm) throws WriteException
sim
- the contact center simulator.level
- the level of confidence intervals.pm
- the performance measure of interest.
WriteException
public boolean formatStatisticsDetailedMatrix(ContactCenterSim sim, double level, PerformanceMeasureType pm) throws WriteException
WriteException
public boolean formatStatisticsDetailedHidePeriods(ContactCenterSim sim, double level, PerformanceMeasureType pm) throws WriteException
formatStatisticsDetailedMatrix(ContactCenterSim,double,PerformanceMeasureType)
but does not format per-period statistics.
sim
- the contact center simulator.level
- the confidence level of the intervals.pm
- the type of performance measures.
WriteException
public boolean formatInfo(Map<String,Object> info) throws WriteException
Number
are turned into numeric
cells, and instances of Date
are converted to numeric cells
formatted as dates. Any other non-null value is formatted using
the Object.toString()
method to become a string cell.
info
- the evaluation information.
WriteException
public RowType[] getDestinationRowTypes()
public boolean formatObservations(ContactCenterSimWithObservations sim, ReportParams reportParams) throws WriteException
PerformanceMeasureParams
returned by ReportParams.getPrintedObs()
,
formats the complete list of observations
generated by the simulator sim
for the referred performance measure.
Each performance measure is formatted as a separate
column in the current sheet.
sim
- the simulator to get observations from.reportParams
- the report parameters.
WriteException
- if an error happens
when writing to the current sheet.public boolean formatValues(ContactCenterEval eval, ReportParams reportParams) throws WriteException
ContactCenterEval.formatStatisticsExcel(WritableWorkbook)
.
Assuming that the current workbook is empty, this method creates a new
sheet with name given by summarySheetName, and calls
formatInfo(Map)
with the evaluation information of eval
to add the information to the new sheet. It then formats a summary report
using
formatValuesSummary(ContactCenterEval,String,PerformanceMeasureType[])
into the same sheet. The method then creates a second sheet with name
given by detailedSheetNameWithoutPeriods for the detailed report.
For each performance measure a detailed report is reuqested for, the
method calls
formatValuesDetailedHidePeriods(ContactCenterEval,PerformanceMeasureType)
.
Finally, the method creates a third sheet with name given by
detailedSheetNameWithPeriods and containing detailed information
with individual periods, using
formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType)
to create the new cells. The two last sheets are not created if they would
be empty. The creation of any of the third sheet can be disabled by giving
a null or empty name for that sheet. Information that would be
presented on an omitted sheet is written on the next requested sheet.
The types of performance measures to include in the report are selected using printedStats which can be null or empty; in these two latter cases, the report includes all performance measures supported by eval. Each element of printedStats specifies a type of performance measure to include in the report (if supported by eval), whether a detailed report must be included, and if this detailed report includes information about each individual period.
eval
- the evaluation system.reportParams
- the report parameters.
WriteException
public boolean formatStatistics(ContactCenterSim sim, ReportParams reportParams) throws WriteException
formatValues(ContactCenterEval,ReportParams)
, except
this formats a full statistical report using
formatStatisticsSummary(ContactCenterSim,double,String,PerformanceMeasureType[])
,
and
formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType)
.
If the given report parameters contains information
about observations to print,
the method also calls
formatObservations(ContactCenterSimWithObservations,ReportParams)
,
and creates a sheet with the results.
sim
- the contact center simulator.reportParams
- the report parameters.
WriteException
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |