import org.apache.poi.hssf.usermodel.HSSFSheet; //导入方法依赖的package包/类
private void writeActorsSummary(HSSFWorkbook workbook, List actorsData) {
HSSFSheet worksheet = workbook.createSheet("Actors Summary");
// row 0: title
int cRow = 0;
HSSFRow row = worksheet.createRow(cRow);
HSSFCell cell = row.createCell(0);
cell.setCellValue("Actors and actions operator calls");
setBold(workbook, cell, (short) 14);
cRow++;
row = worksheet.createRow(cRow);
cell = row.createCell(0);
cell.setCellValue("Actor");
setBold(workbook, cell);
cell = row.createCell(1);
cell.setCellValue("Operator");
setBold(workbook, cell);
cell = row.createCell(2);
cell.setCellValue("Mean");
setBold(workbook, cell);
cell = row.createCell(3);
cell.setCellValue("Min");
setBold(workbook, cell);
cell = row.createCell(4);
cell.setCellValue("Max");
setBold(workbook, cell);
cell = row.createCell(5);
cell.setCellValue("Sum");
setBold(workbook, cell);
// row 1: actor | operator | values
for (ActorDynamicData aData : actorsData) {
cRow++;
row = worksheet.createRow(cRow);
int initialRow = cRow;
Map opsMap = aData.getOperandsCalls();
StatisticalData s = sum(opsMap.values());
row.createCell(0).setCellValue(aData.getActor().getName());
row.createCell(2).setCellValue(s.getMean());
row.createCell(3).setCellValue(s.getMin());
row.createCell(4).setCellValue(s.getMax());
row.createCell(5).setCellValue(s.getSum());
// operands details
for (Entry e : opsMap.entrySet()) {
s = e.getValue();
cRow++;
row = worksheet.createRow(cRow);
row.createCell(1).setCellValue(e.getKey().getLiteral());
row.createCell(2).setCellValue(s.getMean());
row.createCell(3).setCellValue(s.getMin());
row.createCell(4).setCellValue(s.getMax());
row.createCell(5).setCellValue(s.getSum());
}
worksheet.groupRow(initialRow + 1, cRow);
worksheet.setRowGroupCollapsed(initialRow + 1, true);
}
}