Example usage for org.apache.poi.ss.usermodel Row createCell

List of usage examples for org.apache.poi.ss.usermodel Row createCell

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Row createCell.

Prototype

Cell createCell(int column);

Source Link

Document

Use this to create new cells within the row and return it.

Usage

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeActionActorClassTable(HSSFWorkbook workbook, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("<Action, ActorClass>");
    // Action Actor Class Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("Action and Actor Class Results");
    title.applyFont(titleFont);// w w  w  .  ja  va  2s . c o  m
    cell.setCellValue(title);

    Row row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
    row.createCell(0).setCellValue("Action");
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
    row.createCell(1).setCellValue("Actor Class");

    sheet.addMergedRegion(new CellRangeAddress(1, 1, 2, 7));
    row.createCell(2).setCellValue("Total Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 8, 12));
    row.createCell(8).setCellValue("Non Deferrable Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 13, 17));
    row.createCell(13).setCellValue("Critical Executions");

    row = sheet.createRow(2);
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 2, 3));
    row.createCell(2).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 4, 6));
    row.createCell(4).setCellValue("Clock Cycles");
    row.createCell(7).setCellValue("Slack");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 8, 9));
    row.createCell(8).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 10, 12));
    row.createCell(10).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 13, 14));
    row.createCell(13).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 15, 17));
    row.createCell(15).setCellValue("Clock Cycles");

    row = sheet.createRow(3);
    row.createCell(2).setCellValue("%");
    row.createCell(3).setCellValue("abs");
    row.createCell(4).setCellValue("%");
    row.createCell(5).setCellValue("mean");
    row.createCell(6).setCellValue("variance");
    row.createCell(7).setCellValue("min");
    row.createCell(8).setCellValue("%");
    row.createCell(9).setCellValue("abs");
    row.createCell(10).setCellValue("%");
    row.createCell(11).setCellValue("mean");
    row.createCell(12).setCellValue("variance");
    row.createCell(13).setCellValue("%");
    row.createCell(14).setCellValue("abs");
    row.createCell(15).setCellValue("%");
    row.createCell(16).setCellValue("mean");
    row.createCell(17).setCellValue("variance");

    Table<ActorClass, Action, ExtendExecData> cTable = analyzer.getSumDataTable(ActorClass.class,
            Key.CRITICAL_CLOCKCYCLES, Order.DECREASING);

    // row index
    int rowi = 4;
    for (Table.Cell<ActorClass, Action, ExtendExecData> entry : cTable.cellSet()) {

        row = sheet.createRow(rowi);
        rowi++;

        row.createCell(0).setCellValue(entry.getColumnKey().getId());
        row.createCell(1).setCellValue(entry.getRowKey().getName());

        ExtendExecData exec = entry.getValue();
        cell = row.createCell(2);
        cell.setCellFormula("D" + rowi + "/Summary!A14*100");
        row.createCell(3).setCellValue(exec.getTotalExec().getExecutions());
        cell = row.createCell(4);
        cell.setCellFormula("F" + rowi + "/Summary!B14*100");
        row.createCell(5).setCellValue(exec.getTotalExec().getClockCyclesMean());
        row.createCell(6).setCellValue(exec.getTotalExec().getClockCyclesVariance());

        double slack = exec.getSlack().getMin();
        slack = slack > AnalysisUtil.PRECISION_EPS ? slack : 0.0;
        row.createCell(7).setCellValue(slack);
        cell = row.createCell(8);
        cell.setCellFormula("J" + rowi + "/Summary!E14*100");
        row.createCell(9).setCellValue(exec.getNotDeferrableExec().getExecutions());
        cell = row.createCell(10);
        cell.setCellFormula("L" + rowi + "/Summary!G14*100");
        row.createCell(11).setCellValue(exec.getNotDeferrableExec().getClockCyclesMean());
        row.createCell(12).setCellValue(exec.getNotDeferrableExec().getClockCyclesVariance());
        cell = row.createCell(13);
        cell.setCellFormula("O" + rowi + "/Summary!J14*100");
        row.createCell(14).setCellValue(exec.getCriticalExec().getExecutions());
        cell = row.createCell(15);
        cell.setCellFormula("Q" + rowi + "/Summary!L14*100");
        row.createCell(16).setCellValue(exec.getCriticalExec().getClockCyclesMean());
        row.createCell(17).setCellValue(exec.getCriticalExec().getClockCyclesVariance());
    }
}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeActionActorTable(HSSFWorkbook workbook, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("<Action, Actor>");
    // Action Actor Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("Action and Actor Results");
    title.applyFont(titleFont);//from  w  w w . j  a  v  a 2s.com
    cell.setCellValue(title);
    Row row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
    row.createCell(0).setCellValue("Action");
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
    row.createCell(1).setCellValue("Actor");

    sheet.addMergedRegion(new CellRangeAddress(1, 1, 2, 9));
    row.createCell(2).setCellValue("Total Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 10, 14));
    row.createCell(10).setCellValue("Non Deferrable Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 15, 19));
    row.createCell(15).setCellValue("Critical Executions");

    row = sheet.createRow(2);
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 2, 3));
    row.createCell(2).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 4, 6));
    row.createCell(4).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 7, 9));
    row.createCell(7).setCellValue("Slack");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 10, 11));
    row.createCell(10).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 12, 14));
    row.createCell(12).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 15, 16));
    row.createCell(15).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 17, 19));
    row.createCell(17).setCellValue("Clock Cycles");

    row = sheet.createRow(3);
    row.createCell(2).setCellValue("%");
    row.createCell(3).setCellValue("abs");
    row.createCell(4).setCellValue("%");
    row.createCell(5).setCellValue("mean");
    row.createCell(6).setCellValue("variance");
    row.createCell(7).setCellValue("min");
    row.createCell(8).setCellValue("average");
    row.createCell(9).setCellValue("variance");
    row.createCell(10).setCellValue("%");
    row.createCell(11).setCellValue("abs");
    row.createCell(12).setCellValue("%");
    row.createCell(13).setCellValue("mean");
    row.createCell(14).setCellValue("variance");
    row.createCell(15).setCellValue("%");
    row.createCell(16).setCellValue("abs");
    row.createCell(17).setCellValue("%");
    row.createCell(18).setCellValue("mean");
    row.createCell(19).setCellValue("variance");

    Table<Actor, Action, ExtendExecData> aTable = analyzer.getSumDataTable(Actor.class,
            Key.CRITICAL_CLOCKCYCLES, Order.DECREASING);

    // row index
    int rowi = 4;
    for (Table.Cell<Actor, Action, ExtendExecData> entry : aTable.cellSet()) {
        row = sheet.createRow(rowi);
        rowi++;

        row.createCell(0).setCellValue(entry.getColumnKey().getId());
        row.createCell(1).setCellValue(entry.getRowKey().getId());

        ExtendExecData exec = entry.getValue();
        cell = row.createCell(2);
        cell.setCellFormula("D" + rowi + "/Summary!A14*100");
        row.createCell(3).setCellValue(exec.getTotalExec().getExecutions());
        cell = row.createCell(4);
        cell.setCellFormula("F" + rowi + "/Summary!B14*100");
        row.createCell(5).setCellValue(exec.getTotalExec().getClockCyclesMean());
        row.createCell(6).setCellValue(exec.getTotalExec().getClockCyclesVariance());

        double slack = exec.getSlack().getMin();
        slack = slack > AnalysisUtil.PRECISION_EPS ? slack : 0.0;
        row.createCell(7).setCellValue(slack);
        double slackAvg = exec.getSlack().getMean();
        slackAvg = slackAvg > AnalysisUtil.PRECISION_EPS ? slackAvg : 0.0;
        row.createCell(8).setCellValue(slackAvg);
        double slackVar = exec.getSlack().getVariance();
        slackVar = slackVar > AnalysisUtil.PRECISION_EPS ? slackVar : 0.0;
        row.createCell(9).setCellValue(slackVar);
        cell = row.createCell(10);
        cell.setCellFormula("L" + rowi + "/Summary!E14*100");
        row.createCell(11).setCellValue(exec.getNotDeferrableExec().getExecutions());
        cell = row.createCell(12);
        cell.setCellFormula("N" + rowi + "/Summary!G14*100");
        row.createCell(13).setCellValue(exec.getNotDeferrableExec().getClockCyclesMean());
        row.createCell(14).setCellValue(exec.getNotDeferrableExec().getClockCyclesVariance());
        cell = row.createCell(15);
        cell.setCellFormula("Q" + rowi + "/Summary!J14*100");
        row.createCell(16).setCellValue(exec.getCriticalExec().getExecutions());
        cell = row.createCell(17);
        cell.setCellFormula("S" + rowi + "/Summary!L14*100");
        row.createCell(18).setCellValue(exec.getCriticalExec().getClockCyclesMean());
        row.createCell(19).setCellValue(exec.getCriticalExec().getClockCyclesVariance());

    }

}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeActorClassesTable(HSSFWorkbook workbook, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("ActorClasses");

    // Actor classes Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("ActorClasses Results");
    title.applyFont(titleFont);/*from   w  ww.  j ava  2  s  . c o  m*/
    cell.setCellValue(title);

    Row row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
    row.createCell(0).setCellValue("Class");
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
    row.createCell(1).setCellValue("File");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 2, 3));
    row.createCell(2).setCellValue("Version");

    sheet.addMergedRegion(new CellRangeAddress(1, 1, 4, 8));
    row.createCell(4).setCellValue("Total Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 9, 13));
    row.createCell(9).setCellValue("Non Deferrable Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 14, 18));
    row.createCell(14).setCellValue("Critical Executions");

    row = sheet.createRow(2);
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 4, 5));
    row.createCell(4).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 6, 8));
    row.createCell(6).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 9, 10));
    row.createCell(9).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 11, 13));
    row.createCell(11).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 14, 15));
    row.createCell(14).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 16, 18));
    row.createCell(16).setCellValue("Clock Cycles");

    row = sheet.createRow(3);
    row.createCell(2).setCellValue("ID");
    row.createCell(3).setCellValue("Last Modification");
    row.createCell(4).setCellValue("%");
    row.createCell(5).setCellValue("abs");
    row.createCell(6).setCellValue("%");
    row.createCell(7).setCellValue("mean");
    row.createCell(8).setCellValue("variance");
    row.createCell(9).setCellValue("%");
    row.createCell(10).setCellValue("abs");
    row.createCell(11).setCellValue("%");
    row.createCell(12).setCellValue("mean");
    row.createCell(13).setCellValue("variance");
    row.createCell(14).setCellValue("%");
    row.createCell(15).setCellValue("abs");
    row.createCell(16).setCellValue("%");
    row.createCell(17).setCellValue("mean");
    row.createCell(18).setCellValue("variance");

    Map<ActorClass, ExtendExecData> cMap = analyzer.getSumDataMap(ActorClass.class, Key.CRITICAL_CLOCKCYCLES,
            Order.DECREASING);

    // row index
    int rowi = 4;
    for (Entry<ActorClass, ExtendExecData> entry : cMap.entrySet()) {
        ActorClass clazz = entry.getKey();
        ExtendExecData exec = entry.getValue();

        row = sheet.createRow(rowi);
        rowi++;

        row.createCell(0).setCellValue(clazz.getName());
        row.createCell(1).setCellValue(clazz.getSourceFile());
        row.createCell(2).setCellValue(clazz.getVersion().getId());
        cell = row.createCell(3);
        cell.setCellValue(clazz.getVersion().getLastModificationDate());
        cell.setCellStyle(cellStyle);
        cell = row.createCell(4);
        cell.setCellFormula("F" + rowi + "/Summary!A14*100");
        row.createCell(5).setCellValue(exec.getTotalExec().getExecutions());
        cell = row.createCell(6);
        cell.setCellFormula("H" + rowi + "/Summary!B14*100");
        row.createCell(7).setCellValue(exec.getTotalExec().getClockCyclesMean());
        row.createCell(8).setCellValue(exec.getTotalExec().getClockCyclesVariance());
        cell = row.createCell(9);
        cell.setCellFormula("K" + rowi + "/Summary!E14*100");
        row.createCell(10).setCellValue(exec.getNotDeferrableExec().getExecutions());
        cell = row.createCell(11);
        cell.setCellFormula("M" + rowi + "/Summary!G14*100");
        row.createCell(12).setCellValue(exec.getNotDeferrableExec().getClockCyclesMean());
        row.createCell(13).setCellValue(exec.getNotDeferrableExec().getClockCyclesVariance());
        cell = row.createCell(14);
        cell.setCellFormula("P" + rowi + "/Summary!J14*100");
        row.createCell(15).setCellValue(exec.getCriticalExec().getExecutions());
        cell = row.createCell(16);
        cell.setCellFormula("R" + rowi + "/Summary!L14*100");
        row.createCell(17).setCellValue(exec.getCriticalExec().getClockCyclesMean());
        row.createCell(18).setCellValue(exec.getCriticalExec().getClockCyclesVariance());

    }

}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeActorsTable(HSSFWorkbook workbook, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("Actors");

    // Actors Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("Actors Results");
    title.applyFont(titleFont);/* w ww .ja va  2s  .co  m*/
    cell.setCellValue(title);

    Row row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
    row.createCell(0).setCellValue("Actor");
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
    row.createCell(1).setCellValue("Class");

    sheet.addMergedRegion(new CellRangeAddress(1, 1, 2, 6));
    row.createCell(2).setCellValue("Total Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 7, 11));
    row.createCell(7).setCellValue("Non Deferrable Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 12, 16));
    row.createCell(12).setCellValue("Critical Executions");

    row = sheet.createRow(2);
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 2, 3));
    row.createCell(2).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 4, 6));
    row.createCell(4).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 7, 8));
    row.createCell(7).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 9, 11));
    row.createCell(9).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 12, 13));
    row.createCell(12).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 14, 16));
    row.createCell(14).setCellValue("Clock Cycles");

    row = sheet.createRow(3);
    row.createCell(2).setCellValue("%");
    row.createCell(3).setCellValue("abs");
    row.createCell(4).setCellValue("%");
    row.createCell(5).setCellValue("mean");
    row.createCell(6).setCellValue("variance");
    row.createCell(7).setCellValue("%");
    row.createCell(8).setCellValue("abs");
    row.createCell(9).setCellValue("%");
    row.createCell(10).setCellValue("mean");
    row.createCell(11).setCellValue("variance");
    row.createCell(12).setCellValue("%");
    row.createCell(13).setCellValue("abs");
    row.createCell(14).setCellValue("%");
    row.createCell(15).setCellValue("mean");
    row.createCell(16).setCellValue("variance");

    Map<Actor, ExtendExecData> aMap = analyzer.getSumDataMap(Actor.class, Key.CRITICAL_CLOCKCYCLES,
            Order.DECREASING);

    // row index
    int rowi = 4;
    for (Entry<Actor, ExtendExecData> entry : aMap.entrySet()) {
        Actor actor = entry.getKey();
        ExtendExecData exec = entry.getValue();

        row = sheet.createRow(rowi);
        rowi++;

        row.createCell(0).setCellValue(actor.getId());
        row.createCell(1).setCellValue(actor.getActorClass().getName());
        cell = row.createCell(2);
        cell.setCellFormula("D" + rowi + "/Summary!A14*100");
        row.createCell(3).setCellValue(exec.getTotalExec().getExecutions());
        cell = row.createCell(4);
        cell.setCellFormula("F" + rowi + "/Summary!B14*100");
        row.createCell(5).setCellValue(exec.getTotalExec().getClockCyclesMean());
        row.createCell(6).setCellValue(exec.getTotalExec().getClockCyclesVariance());
        cell = row.createCell(7);
        cell.setCellFormula("I" + rowi + "/Summary!E14*100");
        row.createCell(8).setCellValue(exec.getNotDeferrableExec().getExecutions());
        cell = row.createCell(9);
        cell.setCellFormula("K" + rowi + "/Summary!G14*100");
        row.createCell(10).setCellValue(exec.getNotDeferrableExec().getClockCyclesMean());
        row.createCell(11).setCellValue(exec.getNotDeferrableExec().getClockCyclesVariance());
        cell = row.createCell(12);
        cell.setCellFormula("N" + rowi + "/Summary!J14*100");
        row.createCell(13).setCellValue(exec.getCriticalExec().getExecutions());
        cell = row.createCell(14);
        cell.setCellFormula("P" + rowi + "/Summary!L14*100");
        row.createCell(15).setCellValue(exec.getCriticalExec().getClockCyclesMean());
        row.createCell(16).setCellValue(exec.getCriticalExec().getClockCyclesVariance());

    }

}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeImpactAnalysis(HSSFWorkbook workbook, ImpactData impact) {
    HSSFSheet sheet = workbook.createSheet("Impact Analysis");

    // Impact Analysis Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("Impact analysis");
    title.applyFont(titleFont);//from ww  w .  j a va2  s .c om
    cell.setCellValue(title);

    int colli = 0;
    Map<Integer, Row> rowsMap = new HashMap<Integer, Row>();
    for (ActionImpactData step : impact.getActionsData()) {
        // action row
        Row row = rowsMap.get(1);
        if (row == null) {
            row = sheet.createRow(1);
            rowsMap.put(1, row);
        }
        row.createCell(colli).setCellValue("Action");
        row.createCell(colli + 1).setCellValue(step.getAction().getId());

        // actor or actor class row
        row = rowsMap.get(2);
        if (row == null) {
            row = sheet.createRow(2);
            rowsMap.put(2, row);
        }
        if (impact.isActorsLevel()) {
            row.createCell(colli).setCellValue("Actor");
            row.createCell(colli + 1).setCellValue(step.getActors().get(0).getId());
        } else {
            row.createCell(colli).setCellValue("ActorClass");
            row.createCell(colli + 1).setCellValue(step.getActors().get(0).getActorClass().getName());
        }

        // reductions row
        row = rowsMap.get(3);
        if (row == null) {
            row = sheet.createRow(3);
            rowsMap.put(3, row);
        }
        row.createCell(colli).setCellValue("WL reduction");
        row.createCell(colli + 1).setCellValue("CP WL reduction");
        for (int i = 0; i < step.getCplReduction().size(); i++) {
            double wl = step.getWlReduction().get(i);
            double cp = step.getCplReduction().get(i);
            row = rowsMap.get(4 + i);
            if (row == null) {
                row = sheet.createRow(4 + i);
                rowsMap.put(4 + i, row);
            }
            row.createCell(colli).setCellValue(wl);
            row.createCell(colli + 1).setCellValue(cp);
        }

        colli += 2;
    }

}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeSummary(HSSFWorkbook workbook, Network network, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("Summary");

    // Network Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("Hotspots and Algorithmic Bottlenecks Report Summary");
    title.applyFont(titleFont);/*from w ww .  java 2 s  .  c  om*/
    cell.setCellValue(title);

    // network name
    Row row = sheet.createRow(2);
    row.createCell(0).setCellValue("Network");
    row.createCell(1).setCellValue(network.getName());

    // network cal project
    row = sheet.createRow(3);
    row.createCell(0).setCellValue("CAL Project");
    row.createCell(1).setCellValue(network.getCalProject());

    // network source file
    row = sheet.createRow(4);
    row.createCell(0).setCellValue("Source File");
    row.createCell(1).setCellValue(network.getSourceFile());

    // network version
    sheet.addMergedRegion(new CellRangeAddress(5, 7, 0, 0));
    row = sheet.createRow(5);
    row.createCell(0).setCellValue("Version");
    row.createCell(1).setCellValue("Id");
    row.createCell(2).setCellValue(network.getVersion().getId());
    row = sheet.createRow(6);
    row.createCell(1).setCellValue("Last Modification Date");
    cell = row.createCell(2);
    cell.setCellValue(network.getVersion().getLastModificationDate());
    cell.setCellStyle(cellStyle);
    row = sheet.createRow(7);
    row.createCell(1).setCellValue("Versioning Date");
    cell = row.createCell(2);
    cell.setCellValue(network.getVersion().getVersioningDate());
    cell.setCellStyle(cellStyle);

    // [total | non deferrable | critical]
    row = sheet.createRow(10);
    sheet.addMergedRegion(new CellRangeAddress(10, 10, 0, 2));
    cell = row.createCell(0);
    cell.setCellValue("Total Executions");

    sheet.addMergedRegion(new CellRangeAddress(10, 10, 3, 7));
    cell = row.createCell(3);
    cell.setCellValue("Non Deferrable Executions");

    sheet.addMergedRegion(new CellRangeAddress(10, 10, 8, 12));
    cell = row.createCell(8);
    cell.setCellValue("Critical Executions");

    // [Executions | Workload | slack || Executions | workload || Executions
    // | workload ]
    row = sheet.createRow(11);
    sheet.addMergedRegion(new CellRangeAddress(11, 12, 0, 0));
    cell = row.createCell(0);
    cell.setCellValue("Executions");

    sheet.addMergedRegion(new CellRangeAddress(11, 11, 1, 2));
    cell = row.createCell(1);
    cell.setCellValue("Clock Cycles");

    sheet.addMergedRegion(new CellRangeAddress(11, 11, 3, 4));
    cell = row.createCell(3);
    cell.setCellValue("Executions");

    sheet.addMergedRegion(new CellRangeAddress(11, 11, 5, 7));
    cell = row.createCell(5);
    cell.setCellValue("Clock Cycles");

    sheet.addMergedRegion(new CellRangeAddress(11, 11, 8, 9));
    cell = row.createCell(8);
    cell.setCellValue("Executions");

    sheet.addMergedRegion(new CellRangeAddress(11, 11, 10, 12));
    cell = row.createCell(10);
    cell.setCellValue("Clock Cycles");

    // [* | mean , variance, % ... ]
    row = sheet.createRow(12);
    row.createCell(1).setCellValue("mean");
    row.createCell(2).setCellValue("variance");
    row.createCell(3).setCellValue("%");
    row.createCell(4).setCellValue("abs");
    row.createCell(5).setCellValue("%");
    row.createCell(6).setCellValue("mean");
    row.createCell(7).setCellValue("variance");
    row.createCell(8).setCellValue("%");
    row.createCell(9).setCellValue("abs");
    row.createCell(10).setCellValue("%");
    row.createCell(11).setCellValue("mean");
    row.createCell(12).setCellValue("variance");

    // write down data
    ExtendExecData sumData = analyzer.getSumData();
    row = sheet.createRow(13);

    row.createCell(0).setCellValue(sumData.getTotalExec().getExecutions());
    row.createCell(1).setCellValue(sumData.getTotalExec().getClockCyclesMean());
    row.createCell(2).setCellValue(sumData.getTotalExec().getClockCyclesVariance());
    cell = row.createCell(3);
    cell.setCellFormula("E14/A14*100");
    row.createCell(4).setCellValue(sumData.getNotDeferrableExec().getExecutions());
    cell = row.createCell(5);
    cell.setCellFormula("G14/B14*100");
    row.createCell(6).setCellValue(sumData.getNotDeferrableExec().getClockCyclesMean());
    row.createCell(7).setCellValue(sumData.getNotDeferrableExec().getClockCyclesVariance());
    cell = row.createCell(8);
    cell.setCellFormula("J14/A14*100");
    row.createCell(9).setCellValue(sumData.getCriticalExec().getExecutions());
    cell = row.createCell(10);
    cell.setCellFormula("L14/B14*100");
    row.createCell(11).setCellValue(sumData.getCriticalExec().getClockCyclesMean());
    row.createCell(12).setCellValue(sumData.getCriticalExec().getClockCyclesVariance());
}

From source file:co.turnus.analysis.data.buffers.io.XlsBufferMinimizationDataWriter.java

License:Open Source License

private void writeData(HSSFWorkbook workbook, BuffersData data, Network netork, String algorithm,
        int solutionId) {
    HSSFSheet sheet = workbook.createSheet("Solution " + solutionId);

    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString(algorithm + " Results");
    title.applyFont(titleFont);/*from www  .j av  a 2  s . c o m*/
    cell.setCellValue(title);

    Row row = sheet.createRow(3);
    sheet.addMergedRegion(new CellRangeAddress(3, 3, 0, 3));
    row.createCell(0).setCellValue("Algorithm specific Parameters");
    row = sheet.createRow(4);
    int cellNum = 0;
    for (String attrName : data.getKeyAttributes()) {
        row.createCell(cellNum++).setCellValue(attrName);
        Object val = data.getAttribute(attrName);
        row.createCell(cellNum++).setCellValue(val.toString());
    }

    row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 5));
    row.createCell(0).setCellValue("Generic Parameters");
    row = sheet.createRow(2);
    row.createCell(0).setCellValue("Total bits");
    row.createCell(1).setCellValue(data.getTotalBitSize());
    row.createCell(2).setCellValue("Total Tokens");
    row.createCell(3).setCellValue(data.getTotalTokenSize());
    row.createCell(4).setCellValue("Solution Time (ms)");
    row.createCell(5).setCellValue(data.getExecutionTime());
    row.createCell(6).setCellValue("number of Actors");
    row.createCell(7).setCellValue(netork.getActors().size());
    row.createCell(8).setCellValue("number of Fifos");
    row.createCell(9).setCellValue(netork.getFifos().size());
    row.createCell(10).setCellValue("bit accurate");
    row.createCell(11).setCellValue(data.isBitAccurate());
    row.createCell(12).setCellValue("deadlock free");
    row.createCell(13).setCellValue(data.isDeadlockFree());

    row = sheet.createRow(5);
    sheet.addMergedRegion(new CellRangeAddress(5, 5, 0, 6));
    row.createCell(0).setCellValue("Buffers Size Configuration");
    row = sheet.createRow(6);
    sheet.addMergedRegion(new CellRangeAddress(6, 7, 0, 0));
    row.createCell(0).setCellValue("Source Actor");
    sheet.addMergedRegion(new CellRangeAddress(6, 7, 1, 1));
    row.createCell(1).setCellValue("Source Port");
    sheet.addMergedRegion(new CellRangeAddress(6, 7, 2, 2));
    row.createCell(2).setCellValue("Traget Actor");
    sheet.addMergedRegion(new CellRangeAddress(6, 7, 3, 4));
    row.createCell(3).setCellValue("Traget Port");
    sheet.addMergedRegion(new CellRangeAddress(6, 7, 4, 4));
    row.createCell(4).setCellValue("Type");
    sheet.addMergedRegion(new CellRangeAddress(6, 6, 5, 6));
    row.createCell(5).setCellValue("Size");
    sheet.addMergedRegion(new CellRangeAddress(6, 6, 8, 9));
    row.createCell(8).setCellValue("Algorithm Starting Point");
    row = sheet.createRow(7);
    row.createCell(5).setCellValue("bit");
    row.createCell(6).setCellValue("tokens");
    row.createCell(8).setCellValue("bit");
    row.createCell(9).setCellValue("tokens");

    int rowi = 8;
    for (Entry<Fifo, Integer> entry : data.getFifosSize().getFifosSizeMap().entrySet()) {
        Fifo fifo = entry.getKey();
        int tokens = entry.getValue();

        row = sheet.createRow(rowi++);
        row.createCell(0).setCellValue(fifo.getSourceActor().getId());
        row.createCell(1).setCellValue(fifo.getSourcePort().getName());
        row.createCell(2).setCellValue(fifo.getTargetActor().getId());
        row.createCell(3).setCellValue(fifo.getTargetPort().getName());
        row.createCell(4).setCellValue(fifo.getType().toString());
        row.createCell(5).setCellValue(tokens * fifo.getType().getBits());
        row.createCell(6).setCellValue(tokens);

        // do the same for the starting point (if it exists)
        tokens = data.getStartingPoint().containsKey(fifo) ? data.getStartingPoint().get(fifo) : 0;
        row.createCell(8).setCellValue(tokens * fifo.getType().getBits());
        row.createCell(9).setCellValue(tokens);
    }

}

From source file:co.turnus.analysis.data.partitioning.io.XlsPartitioningDataWriter.java

License:Open Source License

private void writeData(HSSFWorkbook workbook, PartitionsData data, Network network, String algorithm,
        int solutionId) {
    HSSFSheet sheet = workbook.createSheet("Partition " + solutionId);

    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString(algorithm + " Results");
    title.applyFont(titleFont);//from   ww w.  j a v  a  2  s .  co m
    cell.setCellValue(title);

    Row row = sheet.createRow(3);
    sheet.addMergedRegion(new CellRangeAddress(3, 3, 0, 3));
    row.createCell(0).setCellValue("Algorithm specific Parameters");
    row = sheet.createRow(4);
    int cellNum = 0;
    for (String attrName : data.getKeyAttributes()) {
        row.createCell(cellNum++).setCellValue(attrName);
        Object val = data.getAttribute(attrName);
        row.createCell(cellNum++).setCellValue(val.toString());
    }

    row = sheet.createRow(5);
    sheet.addMergedRegion(new CellRangeAddress(5, 5, 0, 1));
    row.createCell(0).setCellValue("Partitions");

    row = sheet.createRow(6);
    row.createCell(0).setCellValue("id");
    row.createCell(1).setCellValue("Actors");

    int rown = 7;
    row = sheet.createRow(rown);
    for (ActorsMapping p : data.getMapping().getActorsMappings()) {
        row.createCell(0).setCellValue(p.getId());
        for (Actor a : p.getActors()) {
            row.createCell(1).setCellValue(a.getId());
            row = sheet.createRow(++rown);
        }
    }

}

From source file:co.turnus.analysis.data.pipelining.io.XlsSimplePipeliningDataWriter.java

License:Open Source License

public void write(SimplePipelingData report, File file) {
    try {/*from  w w w  . ja v  a  2s  .co  m*/

        HSSFWorkbook workbook = new HSSFWorkbook();

        titleFont = workbook.createFont();
        titleFont.setFontName("Arial");
        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        cellStyle = workbook.createCellStyle();
        cellStyle.setDataFormat(workbook.getCreationHelper().createDataFormat().getFormat("m/d/yy h:mm"));

        HSSFSheet sheet = workbook.createSheet("Pipelinable <Actor, Action>");
        // Action Actor Class Results
        Cell cell = sheet.createRow(0).createCell(0);
        HSSFRichTextString title = new HSSFRichTextString("Action and Actor Pipelining Results");
        title.applyFont(titleFont);
        cell.setCellValue(title);

        Row row = sheet.createRow(1);
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
        row.createCell(0).setCellValue("Actor");
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
        row.createCell(1).setCellValue("Action");
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 2, 2));
        row.createCell(2).setCellValue("pipelinable");
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 3, 10));
        row.createCell(3).setCellValue("Consecutive Executions");
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 11, 11));
        row.createCell(11).setCellValue("Splittable Actions");

        row = sheet.createRow(2);
        sheet.addMergedRegion(new CellRangeAddress(2, 2, 3, 6));
        row.createCell(3).setCellValue("Pipelinable");
        sheet.addMergedRegion(new CellRangeAddress(2, 2, 7, 10));
        row.createCell(7).setCellValue("Unconstrained");
        row = sheet.createRow(3);
        row.createCell(3).setCellValue("min");
        row.createCell(4).setCellValue("mean");
        row.createCell(5).setCellValue("max");
        row.createCell(6).setCellValue("var");
        row.createCell(7).setCellValue("min");
        row.createCell(8).setCellValue("mean");
        row.createCell(9).setCellValue("max");
        row.createCell(10).setCellValue("var");

        int rowId = 4;
        Map<Actor, Map<Action, SimpleActionPipeliningData>> table = report.asTable().rowMap();
        for (Map<Action, SimpleActionPipeliningData> ac : table.values()) {
            for (SimpleActionPipeliningData data : ac.values()) {
                row = sheet.createRow(rowId);
                row.createCell(0).setCellValue(data.getActor().getId());
                row.createCell(1).setCellValue(data.getAction().getId());

                row.createCell(2).setCellValue(data.isPipelinable());

                StatisticalData stat = data.getPipelinableRepetitions();
                if (stat.getSamples() > 0) {
                    row.createCell(3).setCellValue(stat.getMin());
                    row.createCell(4).setCellValue(stat.getMean());
                    row.createCell(5).setCellValue(stat.getMax());
                    row.createCell(6).setCellValue(stat.getVariance());
                } else {
                    row.createCell(3).setCellValue("-");
                    row.createCell(4).setCellValue("-");
                    row.createCell(5).setCellValue("-");
                    row.createCell(6).setCellValue("-");
                }

                stat = data.getUnconstrainedRepetitions();
                if (stat.getSamples() > 0) {
                    row.createCell(7).setCellValue(stat.getMin());
                    row.createCell(8).setCellValue(stat.getMean());
                    row.createCell(9).setCellValue(stat.getMax());
                    row.createCell(10).setCellValue(stat.getVariance());
                } else {
                    row.createCell(7).setCellValue("-");
                    row.createCell(8).setCellValue("-");
                    row.createCell(9).setCellValue("-");
                    row.createCell(10).setCellValue("-");
                }

                StringBuffer b = new StringBuffer();
                for (Action action : data.getSplittableActions()) {
                    b.append(action.getId()).append(" ");
                }
                row.createCell(11).setCellValue(b.toString());

                rowId++;
            }
        }

        OutputStream out = new FileOutputStream(file);
        out = new BufferedOutputStream(out);
        workbook.write(out);
        out.close();

    } catch (Exception e) {
        throw new TurnusRuntimeException("Error writing the excel file " + file, e.getCause());
    }
}

From source file:co.turnus.profiling.io.XlsHalsteadAnalysisWriter.java

License:Open Source License

private void writeActorClassesTable(HSSFWorkbook workbook, SourceCodeData report) {
    int sheetNumber = 0;
    for (ActorClassStaticData aData : report.getActorsData()) {
        HalsteadAnalyser a = new HalsteadAnalyser(aData);
        String aClass = aData.getActorClass().getName();

        HSSFSheet sheet = workbook.createSheet("Class n." + sheetNumber++);
        // Action Actor Class Results
        Cell cell = sheet.createRow(0).createCell(0);
        HSSFRichTextString title = new HSSFRichTextString("Halstead Analysis for the Actor Class: " + aClass);
        title.applyFont(titleFont);//www  .jav a  2s.  co m
        cell.setCellValue(title);

        Row row = sheet.createRow(2);
        row.createCell(0).setCellValue("Summary");
        row.createCell(1).setCellValue("n1");
        row.createCell(2).setCellValue("n2");
        row.createCell(3).setCellValue("n");
        row.createCell(4).setCellValue("N1");
        row.createCell(5).setCellValue("N2");
        row.createCell(6).setCellValue("N");
        row.createCell(7).setCellValue("cN");
        row.createCell(8).setCellValue("V");
        row.createCell(9).setCellValue("D");
        row.createCell(10).setCellValue("E");
        row.createCell(11).setCellValue("T");
        row.createCell(12).setCellValue("B");
        row.createCell(13).setCellValue("I");
        row.createCell(14).setCellValue("NoL");

        row = sheet.createRow(3);
        row.createCell(1).setCellValue(a.getn1());
        row.createCell(2).setCellValue(a.getn2());
        row.createCell(3).setCellValue(a.getn());
        row.createCell(4).setCellValue(a.getN1());
        row.createCell(5).setCellValue(a.getN2());
        row.createCell(6).setCellValue(a.getN());
        row.createCell(7).setCellValue(a.getcN());
        row.createCell(8).setCellValue(a.getV());
        row.createCell(9).setCellValue(a.getD());
        row.createCell(10).setCellValue(a.getE());
        row.createCell(11).setCellValue(a.getT());
        row.createCell(12).setCellValue(a.getB());
        row.createCell(13).setCellValue(a.getI());
        row.createCell(14).setCellValue(aData.getNumberOfLines());

        int i = 5;
        row = sheet.createRow(i++);
        row.createCell(0).setCellValue("Action");
        row.createCell(1).setCellValue("n1");
        row.createCell(2).setCellValue("n2");
        row.createCell(3).setCellValue("n");
        row.createCell(4).setCellValue("N1");
        row.createCell(5).setCellValue("N2");
        row.createCell(6).setCellValue("N");
        row.createCell(7).setCellValue("cN");
        row.createCell(8).setCellValue("V");
        row.createCell(9).setCellValue("D");
        row.createCell(10).setCellValue("E");
        row.createCell(11).setCellValue("T");
        row.createCell(12).setCellValue("B");
        row.createCell(13).setCellValue("I");
        for (ActionStaticData actionData : aData.getActionsData()) {
            a = new HalsteadAnalyser(actionData);
            row = sheet.createRow(i++);
            row.createCell(0).setCellValue(actionData.getAction().getId());
            row.createCell(1).setCellValue(a.getn1());
            row.createCell(2).setCellValue(a.getn2());
            row.createCell(3).setCellValue(a.getn());
            row.createCell(4).setCellValue(a.getN1());
            row.createCell(5).setCellValue(a.getN2());
            row.createCell(6).setCellValue(a.getN());
            row.createCell(7).setCellValue(a.getcN());
            row.createCell(8).setCellValue(a.getV());
            row.createCell(9).setCellValue(a.getD());
            row.createCell(10).setCellValue(a.getE());
            row.createCell(11).setCellValue(a.getT());
            row.createCell(12).setCellValue(a.getB());
            row.createCell(13).setCellValue(a.getI());
        }

        /*
         * i++; row = sheet.createRow(i++);
         * row.createCell(0).setCellValue("Procedure");
         * row.createCell(1).setCellValue("n1");
         * row.createCell(2).setCellValue("n2");
         * row.createCell(3).setCellValue("n");
         * row.createCell(4).setCellValue("N1");
         * row.createCell(5).setCellValue("N2");
         * row.createCell(6).setCellValue("N");
         * row.createCell(7).setCellValue("cN");
         * row.createCell(8).setCellValue("V");
         * row.createCell(9).setCellValue("D");
         * row.createCell(10).setCellValue("E");
         * row.createCell(11).setCellValue("T");
         * row.createCell(12).setCellValue("B");
         * row.createCell(13).setCellValue("I");
         * 
         * for (ProcedureStaticData pData : aData.getProceduresData()) { a =
         * new HalsteadAnalyser(pData); row = sheet.createRow(i++);
         * row.createCell(0).setCellValue(pData.getProcedure().getName());
         * row.createCell(1).setCellValue(a.getn1());
         * row.createCell(2).setCellValue(a.getn2());
         * row.createCell(3).setCellValue(a.getn());
         * row.createCell(4).setCellValue(a.getN1());
         * row.createCell(5).setCellValue(a.getN2());
         * row.createCell(6).setCellValue(a.getN());
         * row.createCell(7).setCellValue(a.getcN());
         * row.createCell(8).setCellValue(a.getV());
         * row.createCell(9).setCellValue(a.getD());
         * row.createCell(10).setCellValue(a.getE());
         * row.createCell(11).setCellValue(a.getT());
         * row.createCell(12).setCellValue(a.getB());
         * row.createCell(13).setCellValue(a.getI()); }
         */
    }

}