Example usage for java.lang Integer doubleValue

List of usage examples for java.lang Integer doubleValue

Introduction

In this page you can find the example usage for java.lang Integer doubleValue.

Prototype

public double doubleValue() 

Source Link

Document

Returns the value of this Integer as a double after a widening primitive conversion.

Usage

From source file:ru.codemine.ccms.router.TaskRouter.java

@Secured("ROLE_OFFICE")
@RequestMapping(value = "/reports/tasks/data", method = RequestMethod.GET)
public @ResponseBody List<Map<String, Object>> tasksReportData(ModelMap model,
        @RequestParam(required = false) String dateStartStr,
        @RequestParam(required = false) String dateEndStr) {
    List<Map<String, Object>> recordsList = new ArrayList<>();
    List<Employee> allEmps = employeeService.getActive();

    DateTimeFormatter formatter = DateTimeFormat.forPattern("dd.MM.YYYY");
    LocalDate dateStart = dateStartStr == null ? LocalDate.now().withDayOfMonth(1)
            : formatter.parseLocalDate(dateStartStr);
    LocalDate dateEnd = dateEndStr == null ? LocalDate.now().dayOfMonth().withMaximumValue()
            : formatter.parseLocalDate(dateEndStr);

    for (Employee employee : allEmps) {
        Map<String, Object> record = new HashMap<>();

        Integer tasksClosed = taskService.getClosedTasksByPerformerCount(employee, dateStart, dateEnd);
        Integer tasksOverdue = taskService.getOverdueTasksByPerformerCount(employee, dateStart, dateEnd);

        record.put("username", employee.getFullName());
        record.put("tasksClosed", tasksClosed);
        record.put("tasksOverdue", tasksOverdue);
        record.put("overduePercent", tasksClosed == 0 ? 0.0 : tasksOverdue.doubleValue() / tasksClosed * 100);
        record.put("midTime", taskService.getMidTimeByPerformerStr(employee, dateStart, dateEnd));

        recordsList.add(record);/*  w w w .ja  va  2  s.  c  o m*/
    }

    return recordsList;
}

From source file:org.jutge.joc.porra.controller.base.BetController.java

private RoundsBet createRoundsBetInstance(final Integer kudos, final String jugador, final Integer rondes,
        final EntityStash entityStash) {
    final Account account = entityStash.getAccount();
    final String league = EntityStashAspect.DEFAULT_LEAGUE_NAME;
    final RoundsBet roundsBet = new RoundsBet();
    roundsBet.setAccount(account.getName());
    roundsBet.setLeague(league);//from  www  .  j  a v  a 2 s .  co m
    roundsBet.setPlayer(jugador);
    roundsBet.setKudos(kudos.doubleValue());
    roundsBet.setEnduresRounds(rondes);
    return roundsBet;
}

From source file:org.csml.tommo.sugar.heatmap.MeanQualityMatrix.java

public Double getMeanRatio() {

    Double result = 0.0;/* w  w w . ja  va2s  .  c  o m*/
    Integer valueCounter = 0;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            result += meanValues[i][j] * totalValueCounter[i][j];
            valueCounter += totalValueCounter[i][j];
        }
    }

    if (valueCounter > 0)
        result = result / valueCounter.doubleValue();

    return result;
}

From source file:net.refractions.udig.style.sld.editor.raster.SingleBandEditorPage.java

private void init() {
    Layer l = getSelectedLayer();//from   www  .j  av  a 2s .c  o  m

    for (IColorMapTypePanel pnl : stylePanels) {
        pnl.setFormatter(this.formatter);
    }
    try {
        GridCoverage coverage = l.getGeoResource().resolve(GridCoverage.class, null);

        if (coverage.getNumSampleDimensions() > 0) {
            formatter.setRawDataType(coverage.getSampleDimension(0).getSampleDimensionType());
            this.noDataValues = coverage.getSampleDimension(0).getNoDataValues();
        }
    } catch (Exception ex) {
        //eat me 
    }
    if (colorRules != null) {
        colorRules.dispose();
        colorRules = null;
    }
    colorRules = new PredefinedColorRules(getGridCoverageReader(), this.noDataValues);

    Style style = (Style) l.getStyleBlackboard().get(SLDContent.ID);

    RasterSymbolizer symbolizer = SLD.rasterSymbolizer(style);
    if (symbolizer == null || symbolizer.getColorMap() == null) {
        //no symbolizer

    } else {
        ColorMap cm = symbolizer.getColorMap();
        for (IColorMapTypePanel pnl : stylePanels) {
            if (pnl.canSupport(cm.getType())) {
                pnl.init(cm);
                cmbThemingStyle.setSelection(new StructuredSelection(pnl));
                cmbThemingStyle.getControl().notifyListeners(SWT.Selection, new Event());
            }
        }
        if (formatter.getRawDataType() == DataType.INTEGER) {
            //if some of the entries are doubles we want to format in double
            //regardless of the fact that the raster is an integer raster.
            try {
                for (ColorMapEntry e : cm.getColorMapEntries()) {
                    Double dvalue = (Double) e.getQuantity().evaluate(null, Double.class);
                    Integer ivalue = (Integer) e.getQuantity().evaluate(null, Integer.class);
                    if (ivalue.doubleValue() != dvalue) {
                        formatter.setDataType(DataType.DOUBLE);
                    }
                }
            } catch (Exception ex) {
                //eatme
            }
        }

    }

    //set inputs based on brewer and colorRules
    List<Object> inputs = new ArrayList<Object>();
    BrewerPalette[] palettes = getBrewer().getPalettes(ColorBrewer.ALL);
    Arrays.sort(palettes, 0, palettes.length, new Comparator<BrewerPalette>() {
        @Override
        public int compare(BrewerPalette arg0, BrewerPalette arg1) {
            return Collator.getInstance().compare(brewerLblProvider.getText(arg0),
                    brewerLblProvider.getText(arg1));
        }
    });
    for (BrewerPalette p : palettes) {
        inputs.add(p);
    }
    inputs.add(Messages.SingleBandEditorPage_predefinedStyleSeperator);
    for (PredefinedColorRule key : colorRules.getPredefinedSets()) {
        inputs.add(key);
    }
    cmbPalette.setInput(inputs);

    /* reselect based on blackboard setting */
    String paletteName = (String) l.getStyleBlackboard().get("net.refractions.udig.style.raster.palette"); //$NON-NLS-1$
    if (paletteName != null) {
        ColorBrewer cb = getBrewer();
        BrewerPalette palette = cb.getPalette(paletteName);
        if (palette != null) {
            cmbPalette.setSelection(new StructuredSelection(cb.getPalette(paletteName)));
        } else {
            PredefinedColorRule cm = colorRules.getPredefinedRule(paletteName);
            if (cm != null) {
                cmbPalette.setSelection(new StructuredSelection(cm));
            }
        }
    }

}

From source file:org.locationtech.udig.style.sld.editor.raster.SingleBandEditorPage.java

private void init() {
    Layer l = getSelectedLayer();//ww w.  java  2s .co m

    for (IColorMapTypePanel pnl : stylePanels) {
        pnl.setFormatter(this.formatter);
    }
    try {
        GridCoverage coverage = l.getGeoResource().resolve(GridCoverage.class, null);

        if (coverage.getNumSampleDimensions() > 0) {
            formatter.setRawDataType(coverage.getSampleDimension(0).getSampleDimensionType());
            this.noDataValues = coverage.getSampleDimension(0).getNoDataValues();
        }
    } catch (Exception ex) {
        //eat me 
    }
    if (colorRules != null) {
        colorRules.dispose();
        colorRules = null;
    }
    colorRules = new PredefinedColorRules(getGridCoverageReader(), this.noDataValues);

    Style style = (Style) l.getStyleBlackboard().get(SLDContent.ID);

    RasterSymbolizer symbolizer = SLD.rasterSymbolizer(style);
    if (symbolizer == null || symbolizer.getColorMap() == null) {
        //no symbolizer

    } else {
        ColorMap cm = symbolizer.getColorMap();
        for (IColorMapTypePanel pnl : stylePanels) {
            if (pnl.canSupport(cm.getType())) {
                pnl.init(cm);
                cmbThemingStyle.setSelection(new StructuredSelection(pnl));
                cmbThemingStyle.getControl().notifyListeners(SWT.Selection, new Event());
            }
        }
        if (formatter.getRawDataType() == DataType.INTEGER) {
            //if some of the entries are doubles we want to format in double
            //regardless of the fact that the raster is an integer raster.
            try {
                for (ColorMapEntry e : cm.getColorMapEntries()) {
                    Double dvalue = (Double) e.getQuantity().evaluate(null, Double.class);
                    Integer ivalue = (Integer) e.getQuantity().evaluate(null, Integer.class);
                    if (ivalue.doubleValue() != dvalue) {
                        formatter.setDataType(DataType.DOUBLE);
                    }
                }
            } catch (Exception ex) {
                //eatme
            }
        }

    }

    //set inputs based on brewer and colorRules
    List<Object> inputs = new ArrayList<Object>();
    BrewerPalette[] palettes = getBrewer().getPalettes(ColorBrewer.ALL);
    Arrays.sort(palettes, 0, palettes.length, new Comparator<BrewerPalette>() {
        @Override
        public int compare(BrewerPalette arg0, BrewerPalette arg1) {
            return Collator.getInstance().compare(brewerLblProvider.getText(arg0),
                    brewerLblProvider.getText(arg1));
        }
    });
    for (BrewerPalette p : palettes) {
        inputs.add(p);
    }
    inputs.add(Messages.SingleBandEditorPage_predefinedStyleSeperator);
    for (PredefinedColorRule key : colorRules.getPredefinedSets()) {
        inputs.add(key);
    }
    cmbPalette.setInput(inputs);

    /* reselect based on blackboard setting */
    String paletteName = (String) l.getStyleBlackboard().get("org.locationtech.udig.style.raster.palette"); //$NON-NLS-1$
    if (paletteName != null) {
        ColorBrewer cb = getBrewer();
        BrewerPalette palette = cb.getPalette(paletteName);
        if (palette != null) {
            cmbPalette.setSelection(new StructuredSelection(cb.getPalette(paletteName)));
        } else {
            PredefinedColorRule cm = colorRules.getPredefinedRule(paletteName);
            if (cm != null) {
                cmbPalette.setSelection(new StructuredSelection(cm));
            }
        }
    }

}

From source file:org.locationtech.udig.style.sld.raster.editor.SingleBandEditorPage.java

private void init() {
    Layer l = getSelectedLayer();// w  ww .java 2  s.  c om

    for (IColorMapTypePanel pnl : stylePanels) {
        pnl.setFormatter(this.formatter);
    }
    try {
        GridCoverage coverage = l.getGeoResource().resolve(GridCoverage.class, null);

        if (coverage.getNumSampleDimensions() > 0) {
            formatter.setRawDataType(coverage.getSampleDimension(0).getSampleDimensionType());
            this.noDataValues = coverage.getSampleDimension(0).getNoDataValues();
        }
    } catch (Exception ex) {
        //eat me 
    }
    if (colorRules != null) {
        colorRules.dispose();
        colorRules = null;
    }
    colorRules = new PredefinedColorRules(getGridCoverageReader(), this.noDataValues);

    Style style = (Style) l.getStyleBlackboard().get(SLDContent.ID);

    //set inputs based on brewer and colorRules
    //do this first so we don't overwrite any custom color rules
    List<Object> inputs = new ArrayList<Object>();
    BrewerPalette[] palettes = getBrewer().getPalettes(ColorBrewer.ALL);
    Arrays.sort(palettes, 0, palettes.length, new Comparator<BrewerPalette>() {
        @Override
        public int compare(BrewerPalette arg0, BrewerPalette arg1) {
            return Collator.getInstance().compare(brewerLblProvider.getText(arg0),
                    brewerLblProvider.getText(arg1));
        }
    });
    for (BrewerPalette p : palettes) {
        inputs.add(p);
    }
    inputs.add(Messages.SingleBandEditorPage_predefinedStyleSeperator);
    for (PredefinedColorRule key : colorRules.getPredefinedSets()) {
        inputs.add(key);
    }
    cmbPalette.setInput(inputs);

    /* reselect based on blackboard setting */
    String paletteName = (String) l.getStyleBlackboard().get("org.locationtech.udig.style.raster.palette"); //$NON-NLS-1$
    if (paletteName != null) {
        ColorBrewer cb = getBrewer();
        BrewerPalette palette = cb.getPalette(paletteName);
        if (palette != null) {
            cmbPalette.setSelection(new StructuredSelection(cb.getPalette(paletteName)));
        } else {
            PredefinedColorRule cm = colorRules.getPredefinedRule(paletteName);
            if (cm != null) {
                cmbPalette.setSelection(new StructuredSelection(cm));
            }
        }
    }

    RasterSymbolizer symbolizer = SLD.rasterSymbolizer(style);
    if (symbolizer == null || symbolizer.getColorMap() == null) {
        //no symbolizer

    } else {
        ColorMap cm = symbolizer.getColorMap();
        for (IColorMapTypePanel pnl : stylePanels) {
            if (pnl.canSupport(cm.getType())) {
                pnl.init(cm);
                cmbThemingStyle.setSelection(new StructuredSelection(pnl));
                cmbThemingStyle.getControl().notifyListeners(SWT.Selection, new Event());
            }
        }
        if (formatter.getRawDataType() == DataType.INTEGER) {
            //if some of the entries are doubles we want to format in double
            //regardless of the fact that the raster is an integer raster.
            try {
                for (ColorMapEntry e : cm.getColorMapEntries()) {
                    Double dvalue = (Double) e.getQuantity().evaluate(null, Double.class);
                    Integer ivalue = (Integer) e.getQuantity().evaluate(null, Integer.class);
                    if (ivalue.doubleValue() != dvalue) {
                        formatter.setDataType(DataType.DOUBLE);
                    }
                }
            } catch (Exception ex) {
                //eatme
            }
        }

    }
}

From source file:Util.PacketGenerator.java

public void GenerateGraphGnuplot() {
    try {//from   ww w.  j a v  a  2  s .  c  o m
        for (int j = 6; j <= 6; j++) {
            File real = new File("D:\\Mestrado\\SketchMatrix\\trunk\\Simulations\\Analise\\Scenario1\\Topology"
                    + j + "\\Real.csv");
            for (int k = 1; k <= 4; k++) {
                File simu = new File(
                        "D:\\Mestrado\\SketchMatrix\\trunk\\Simulations\\Analise\\Scenario1\\Topology" + j
                                + "\\SimulacaoInstancia" + k + ".csv");
                File dat = new File(
                        "D:\\Mestrado\\SketchMatrix\\trunk\\Simulations\\Analise\\Scenario1\\Topology" + j
                                + "\\SimulacaoInstancia" + k + ".txt");

                FileInputStream simuFIS = new FileInputStream(simu);
                DataInputStream simuDIS = new DataInputStream(simuFIS);
                BufferedReader simuBR = new BufferedReader(new InputStreamReader(simuDIS));

                FileInputStream realFIS = new FileInputStream(real);
                DataInputStream realDIS = new DataInputStream(realFIS);
                BufferedReader realBR = new BufferedReader(new InputStreamReader(realDIS));

                PrintWriter datPW = new PrintWriter(dat);

                String lineSimu = simuBR.readLine();
                String lineReal = realBR.readLine();

                double maxX = 0.0;
                double maxY = 0.0;

                HashMap<Double, Double> map = new HashMap<>();

                while (lineSimu != null && lineReal != null) {

                    lineSimu = lineSimu.replaceAll(",", ".");
                    String[] simuMatriz = lineSimu.split(";");
                    String[] realMatriz = lineReal.split(";");

                    for (int i = 0; i < simuMatriz.length; i++) {
                        try {
                            Integer valorReal = Integer.parseInt(realMatriz[i]);
                            Double valorSimu = Double.parseDouble(simuMatriz[i]);
                            if (map.containsKey(valorReal) && map.containsValue(valorSimu)) {
                                continue;
                            }
                            map.put(valorReal.doubleValue(), valorSimu);
                            datPW.write(valorReal.doubleValue() + "\t");
                            datPW.write(valorReal.doubleValue() + "\t");
                            datPW.write(valorSimu.doubleValue() + "\t");
                            datPW.write(valorReal.doubleValue() * 1.2 + "\t");
                            datPW.write(valorReal.doubleValue() * 0.8 + "\n");
                            if (valorReal > maxX) {
                                maxX = valorReal;
                            }
                            if (valorSimu > maxY) {
                                maxY = valorSimu;
                            }
                        } catch (NumberFormatException ex) {

                        }
                    }
                    lineSimu = simuBR.readLine();
                    lineReal = realBR.readLine();
                }

                simuFIS.close();
                simuDIS.close();
                simuBR.close();

                realFIS.close();
                realDIS.close();
                realBR.close();

                datPW.close();

                Double max = Math.max(maxX, maxY);
                max *= 1.05;

                Process p = Runtime.getRuntime().exec("cmd");
                new Thread(new SyncPipe(p.getErrorStream(), System.err)).start();
                new Thread(new SyncPipe(p.getInputStream(), System.out)).start();
                PrintWriter stdin = new PrintWriter(p.getOutputStream());
                stdin.println("gnuplot");
                stdin.println("cd 'D:\\Mestrado\\SketchMatrix\\trunk\\Simulations\\Analise\\Scenario1\\Topology"
                        + j + "'");
                stdin.println("set terminal postscript eps enhanced \"Times\" 20");
                stdin.println("set output \"SimulacaoInstancia" + k + ".eps\"");
                stdin.println("unset title");
                stdin.println("unset style line");
                stdin.println("set style line 1 pt 7 lc 7 lw 1");
                stdin.println("set style line 2 lt 1 lc 7 lw 1");
                stdin.println("set style line 3 lt 4 lc 7 lw 1");
                stdin.println("set style line 4 lt 4 lc 7 lw 1");
                stdin.println("set style line 5 lt 5 lc 5 lw 3");
                stdin.println("set style line 6 lt 6 lc 6 lw 3");
                stdin.println("set style line 7 pt 7 lc 7 lw 3");
                if (k == 4) {
                    stdin.println("set ylabel \"CMO-MT\"");
                    stdin.println("set xlabel \"Real\"");
                } else {
                    stdin.println("set ylabel \"Zhao\"");
                    stdin.println("set xlabel \"CMO-MT\"");
                }
                stdin.println("set key top left");
                stdin.println("set xrange [0:" + max.intValue() + "]");
                stdin.println("set yrange [0:" + max.intValue() + "]");
                stdin.println("set grid ytics lc rgb \"#bbbbbb\" lw 1 lt 0");
                stdin.println("set grid xtics lc rgb \"#bbbbbb\" lw 1 lt 0");
                stdin.println("plot " + "x title \"Referencia\"      ls 2," + "\"SimulacaoInstancia" + k
                        + ".txt\" using 1:3 title \"Matriz\"          ls 7,"
                        + "1.2*x title \"Superior 20%\"    ls 4," + "0.8*x title \"Inferior 20%\"    ls 4");

                stdin.println("exit");
                stdin.println("exit");
                // write any other commands you want here
                stdin.close();
                int returnCode = p.waitFor();
                System.out.println("Return code = " + returnCode);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.clusterchart.ClusterCharts.java

/**                  
 * Inherited by IChart: calculates chart value.
 * // w  w  w.ja  v a2s  .  c  o  m
 * @return the dataset
 * 
 * @throws Exception the exception
 */

public DatasetMap calculateValue() throws Exception {
    logger.debug("IN");
    String res = DataSetAccessFunctions.getDataSetResultFromId(profile, getData(), parametersObject);

    DefaultXYZDataset dataset = new DefaultXYZDataset();

    SourceBean sbRows = SourceBean.fromXMLString(res);
    List listAtts = sbRows.getAttributeAsList("ROW");

    series = new Vector();
    serie_values = new LinkedHashMap();
    serie_selected = new LinkedHashMap();

    boolean firstX = true;
    boolean firstY = true;
    boolean firstZ = true;
    double xTempMax = 0.0;
    double xTempMin = 0.0;
    double yTempMax = 0.0;
    double yTempMin = 0.0;
    boolean first = true;

    // In list atts there are all the series, let's run each
    int i = 0;
    for (Iterator iterator = listAtts.iterator(); iterator.hasNext();) {
        SourceBean row = (SourceBean) iterator.next();
        List attsRow = row.getContainedAttributes();
        String serieName = "";

        /*if(first){
           if (name.indexOf("$F{") >= 0){
              setTitleParameter(atts);
           }
           first=false;
        }*/

        String name = "";
        String value = "";
        String tmpSerieName = "";
        //run all the attributes of the serie

        for (Iterator iterator2 = attsRow.iterator(); iterator2.hasNext();) { // run attributes, serieName, x, y, z
            SourceBeanAttribute object = (SourceBeanAttribute) iterator2.next();

            name = new String(object.getKey());
            value = new String((String) object.getValue());

            boolean newSerie = true;
            if (name.equalsIgnoreCase("serie_name")) {
                serieName = value;
                logger.debug("New Serie: " + serieName);
                tmpSerieName = serieName;
                if (!(serie_values.keySet().contains(serieName))) // new serie create the arrays
                {
                    i = 0;
                    newSerie = true;
                    SerieCluster serieCluster = new SerieCluster(serieName, new double[listAtts.size()],
                            new double[listAtts.size()], new double[listAtts.size()]);
                    serie_values.put(serieName, serieCluster);
                } else // serie already present
                {
                    newSerie = false;
                    i++;

                }
            } else if (name.equalsIgnoreCase("x") || name.equalsIgnoreCase("y") || name.equalsIgnoreCase("z")) {
                // after the name of serie here are values
                SerieCluster serieCluster = (SerieCluster) serie_values.get(serieName);
                if (serieCluster == null) {
                    logger.error("Order of dataset not correct");
                    return null;
                }

                double valueD = 0.0;
                try {
                    Integer intero = Integer.valueOf(value);
                    valueD = intero.doubleValue();
                } catch (NumberFormatException e) {
                    valueD = (Double.valueOf(value)).doubleValue();
                    if (name.equalsIgnoreCase("x")) {
                        decimalXValues = true;
                    } else if (name.equalsIgnoreCase("y")) {
                        decimalYValues = true;
                    }
                }

                if (name.equalsIgnoreCase("x")) {
                    double[] xArr = serieCluster.getX();
                    xArr[i] = valueD;

                    if (firstX) {
                        xTempMin = valueD;
                        xTempMax = valueD;
                        firstX = false;
                    }
                    if (valueD < xTempMin)
                        xTempMin = valueD;
                    if (valueD > xTempMax)
                        xTempMax = valueD;
                    serieCluster.setX(xArr);

                } else if (name.equalsIgnoreCase("y")) {
                    double[] yArr = serieCluster.getY();
                    yArr[i] = valueD;

                    if (firstY) {
                        yTempMin = valueD;
                        yTempMax = valueD;
                        firstY = false;
                    }
                    if (valueD < yTempMin)
                        yTempMin = valueD;
                    if (valueD > yTempMax)
                        yTempMax = valueD;
                    serieCluster.setY(yArr);

                } else if (name.equalsIgnoreCase("z")) {
                    double[] zArr = serieCluster.getZ();
                    zArr[i] = valueD;
                    if (firstZ) {
                        zMax = valueD;
                        firstZ = false;
                    }
                    if (zMax < valueD)
                        zMax = valueD;

                    serieCluster.setZ(zArr);
                }
            } else if (name.equalsIgnoreCase(colSel)) {
                //defines map with selection series informations
                String tmpName = tmpSerieName.replaceAll(" ", "");
                tmpName = tmpName.replace('.', ' ').trim();
                if (!(serie_selected.keySet().contains(tmpName)) && !tmpName.equals(""))
                    serie_selected.put(tmpName, value);
            }
        }

    }

    //xMin=xTempMin-zMax;
    //xMax=xTempMax+zMax;

    xMin = xTempMin - 1.0;
    xMax = xTempMax + 1.0;
    yMin = yTempMin;
    yMax = yTempMax;

    double xOrder = calculateOrder(xMax) * 10;

    // I have all the map full, create the Dataset

    for (Iterator iterator = serie_values.keySet().iterator(); iterator.hasNext();) {
        String serieName = (String) iterator.next();

        SerieCluster serieCluster = (SerieCluster) serie_values.get(serieName);
        double[] xArr = serieCluster.getX();
        double[] yArr = serieCluster.getY();

        double[] zArr = serieCluster.getZ();
        // normalizing all z
        for (int j = 0; j < zArr.length; j++) {

            zArr[j] = (zArr[j] / zMax);
            if (xOrder > 0)
                zArr[j] = zArr[j] * xOrder;

        }

        double[][] seriesT = new double[][] { yArr, xArr, zArr };

        //double[][] seriesT = new double[][] { xArr, yArr, zArr };

        dataset.addSeries(serieName, seriesT);
        series.add(serieName);

    }

    DatasetMap datasets = new DatasetMap();
    datasets.addDataset("1", dataset);
    logger.debug("OUT");
    return datasets;
}

From source file:com.intuit.tank.api.model.v1.datafile.DataFileDescriptorTest.java

/**
 * Run the Integer getId() method test./*from www  .j a  v  a 2 s.  c  o m*/
 *
 * @throws Exception
 *
 * @generatedBy CodePro at 12/15/14 3:00 PM
 */
@Test
public void testGetId_1() throws Exception {
    DataFileDescriptor fixture = new DataFileDescriptor();
    fixture.setComments("");
    fixture.setCreator("");
    fixture.setName("");
    fixture.setDataUrl("");
    fixture.setId(new Integer(1));
    fixture.setCreated(new Date());
    fixture.setModified(new Date());

    Integer result = fixture.getId();

    assertNotNull(result);
    assertEquals("1", result.toString());
    assertEquals((byte) 1, result.byteValue());
    assertEquals((short) 1, result.shortValue());
    assertEquals(1, result.intValue());
    assertEquals(1L, result.longValue());
    assertEquals(1.0f, result.floatValue(), 1.0f);
    assertEquals(1.0, result.doubleValue(), 1.0);
}

From source file:com.joliciel.jochre.stats.FScoreCalculator.java

void evaluate() {
    if (updatedSinceLastEval) {
        precisions = new TreeMap<E, Double>();
        recalls = new TreeMap<E, Double>();
        fScores = new TreeMap<E, Double>();

        for (E outcome : outcomeSet) {
            LOG.debug("Outcome: " + outcome);
            Integer truePositiveCountObj = truePositiveCounts.get(outcome);
            Integer falsePositiveCountObj = falsePositiveCounts.get(outcome);
            Integer falseNegativeCountObj = falseNegativeCounts.get(outcome);
            double truePositiveCount = truePositiveCountObj != null ? truePositiveCountObj.doubleValue() : 0.0;
            double falsePositiveCount = falsePositiveCountObj != null ? falsePositiveCountObj.doubleValue()
                    : 0.0;/*from   ww w  .  j av  a2  s .  c o  m*/
            double falseNegativeCount = falseNegativeCountObj != null ? falseNegativeCountObj.doubleValue()
                    : 0.0;
            LOG.debug("truePositiveCount: " + truePositiveCount);
            LOG.debug("falsePositiveCount: " + falsePositiveCount);
            if (LOG.isTraceEnabled()) {
                LOG.debug("False positives: ");
                Map<E, Integer> pairCounts = falsePositives.get(outcome);
                if (pairCounts != null) {
                    for (E guessed : pairCounts.keySet()) {
                        int pairCount = pairCounts.get(guessed);
                        LOG.trace(outcome.toString() + " , " + guessed.toString() + ": " + pairCount);
                    }
                }
            }

            LOG.debug("falseNegativeCount " + falseNegativeCount);
            if (LOG.isTraceEnabled()) {
                LOG.debug("False negatives: ");
                Map<E, Integer> pairCounts = falseNegatives.get(outcome);
                if (pairCounts != null) {
                    for (E expected : pairCounts.keySet()) {
                        int pairCount = pairCounts.get(expected);
                        LOG.trace(outcome.toString() + " , " + expected.toString() + ": " + pairCount);
                    }
                }
            }

            double precision = 0;
            double recall = 0;
            double fScore = 0;

            if (truePositiveCount + falsePositiveCount > 0)
                precision = truePositiveCount / (truePositiveCount + falsePositiveCount);
            if (truePositiveCount + falseNegativeCount > 0)
                recall = truePositiveCount / (truePositiveCount + falseNegativeCount);
            if (precision + recall > 0)
                fScore = (2 * precision * recall) / (precision + recall);
            LOG.debug("Precision: " + precision);
            LOG.debug("Recall: " + recall);
            LOG.debug("F-score " + fScore);

            precisions.put(outcome, precision);
            recalls.put(outcome, recall);
            fScores.put(outcome, fScore);
            totalTruePositiveCount += truePositiveCount;
            totalFalsePositiveCount += falsePositiveCount;
            totalFalseNegativeCount += falseNegativeCount;
        }
        totalPrecision = totalTruePositiveCount / (totalTruePositiveCount + totalFalsePositiveCount);
        totalRecall = totalTruePositiveCount / (totalTruePositiveCount + totalFalseNegativeCount);
        totalFScore = (2 * totalPrecision * totalRecall) / (totalPrecision + totalRecall);
        LOG.info("Total tests: " + testCount);
        LOG.info("Total true positives: " + totalTruePositiveCount);
        LOG.info("Total false positives: " + totalFalsePositiveCount);
        LOG.info("Total false negatives: " + totalFalseNegativeCount);
        LOG.info("Total precision: " + totalPrecision);
        LOG.info("Total recall: " + totalRecall);
        LOG.info("Total f-score: " + totalFScore);

        updatedSinceLastEval = false;
    }
}