Example usage for java.lang Double Double

List of usage examples for java.lang Double Double

Introduction

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

Prototype

@Deprecated(since = "9")
public Double(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Double object that represents the floating-point value of type double represented by the string.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.XYAreaChartDemo1.java

protected XYDataset createDataset(boolean isDemo) {
    if (isDemo) {
        XYSeries series1 = new XYSeries("Random 1");
        series1.add(new Integer(1), new Double(500.2));
        series1.add(new Integer(2), new Double(694.1));
        series1.add(new Integer(3), new Double(-734.4));
        series1.add(new Integer(4), new Double(453.2));
        series1.add(new Integer(5), new Double(500.2));
        series1.add(new Integer(6), new Double(300.7));
        series1.add(new Integer(7), new Double(734.4));
        series1.add(new Integer(8), new Double(453.2));

        XYSeries series2 = new XYSeries("Random 2");
        series2.add(new Integer(1), new Double(700.2));
        series2.add(new Integer(2), new Double(534.1));
        series2.add(new Integer(3), new Double(323.4));
        series2.add(new Integer(4), new Double(125.2));
        series2.add(new Integer(5), new Double(653.2));
        series2.add(new Integer(6), new Double(432.7));
        series2.add(new Integer(7), new Double(564.4));
        series2.add(new Integer(8), new Double(322.2));

        XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(series1);//from  w w  w  . j  a  va2 s  . c  om
        dataset.addSeries(series2);
        dataset.setIntervalWidth(0.0);
        return dataset;
    } else
        return super.createDataset(false);
}

From source file:br.ufba.eleicoestransparentes.view.chart.GraficoPizza.java

/**
 * Creates a sample dataset.//from   www.j  av  a  2 s . co m
 * 
 * @return A sample dataset.
 */
private static PieDataset createDataset(ArrayList<PontosGrafico> pontos) {
    DefaultPieDataset dataset = new DefaultPieDataset();

    for (PontosGrafico ponto : pontos)
        dataset.setValue(ponto.rotulo, new Double(ponto.valor));

    return dataset;
}

From source file:com.nfwork.dbfound.json.JSONDynaBean.java

public Object get(String name) {
    Object value = dynaValues.get(name);
    if (value != null) {
        return value;
    }//  w  ww. j a v  a2  s.  c om

    Class type = getDynaProperty(name).getType();
    if (type == null) {
        throw new NullPointerException("Unspecified property type for " + name);
    }
    if (!type.isPrimitive()) {
        return value;
    }

    if (type == Boolean.TYPE) {
        return Boolean.FALSE;
    } else if (type == Byte.TYPE) {
        return new Byte((byte) 0);
    } else if (type == Character.TYPE) {
        return new Character((char) 0);
    } else if (type == Short.TYPE) {
        return new Short((short) 0);
    } else if (type == Integer.TYPE) {
        return new Integer(0);
    } else if (type == Long.TYPE) {
        return new Long(0);
    } else if (type == Float.TYPE) {
        return new Float(0.0);
    } else if (type == Double.TYPE) {
        return new Double(0);
    }

    return null;
}

From source file:edu.ucla.stat.SOCR.chart.demo.PieChart3DDemo3.java

/**
* Creates a sample dataset for the demo.
* @param isDemo  true use demo data, false use data from JTable
* @return A sample dataset.//w w w .  j a  v  a 2  s. co m
*/
protected DefaultPieDataset createDataset(boolean isDemo) {
    if (isDemo) {
        DefaultPieDataset result = new DefaultPieDataset();
        result.setValue("Java", new Double(43.2));
        result.setValue("Visual Basic", new Double(10.0));
        result.setValue("C/C++", new Double(17.5));
        result.setValue("PHP", new Double(32.5));
        result.setValue("Perl", new Double(1.0));
        pulloutFlag = new String[5];
        for (int i = 0; i < 5; i++)
            pulloutFlag[i] = "0";
        pulloutFlag[2] = "1";

        return result;
    } else
        return super.createDataset(isDemo);

}

From source file:com.marvelution.jira.plugins.hudson.charts.renderers.BuildResultRenderer.java

/**
 * {@inheritDoc}/*  w  w w .ja  v  a 2s  .c o  m*/
 */
@Override
public Paint getItemOutlinePaint(int row, int column) {
    final int number = new Double(getPlot().getDataset().getXValue(0, column)).intValue();
    final Build build = builds.get(number);
    switch (build.getResult()) {
    case SUCCESSFUL:
        return HudsonChartGenerator.GREEN_PAINT;
    case FAILED:
        return HudsonChartGenerator.RED_PAINT;
    case UNSTABLE:
        return HudsonChartGenerator.YELLOW_PAINT;
    case ABORTED:
    case NOTBUILD:
    default:
        return HudsonChartGenerator.GRAY_PAINT;
    }
}

From source file:edu.harvard.iq.dataverse.util.SumStatCalculator.java

/**
 * Converts an array of primitive Number types to doubles
 *
 *///from   w  w w. ja  v a  2s . c  om
private static Double[] numberToDouble(Number[] x) {
    Double[] z = new Double[x.length];
    for (int i = 0; i < x.length; i++) {
        z[i] = x[i] != null ? new Double(x[i].doubleValue()) : null;
    }
    return z;
}

From source file:com.fileanalyzer.util.LineStatisticCalculator.java

public StringBuilder getSqlInsertFileStatistic() {
    Map<String, Object> params = new HashMap<>();
    StringBuilder sql = new StringBuilder("INSERT INTO " + FileStatistic.FileStatisticKey.TABLE + " ");
    params.put(FileStatisticKey.LENGTHLINE, new Long(line.length()));
    String strArr[] = line.split(regexp);
    TreeSet<Integer> maxWord = new TreeSet();
    TreeSet<Integer> minWord = new TreeSet();
    long sumWords = 0;
    for (int i = 0; i < strArr.length; ++i) {
        int strSize = strArr[i].length();
        sumWords += strSize;//from  w ww .  j av a2  s .c o  m
        if (i > 0 && i < strArr.length - 1)
            maxWord.add(strSize);
        minWord.add(strSize);
    }
    params.put(FileStatisticKey.LINE, HtmlUtils.htmlEscape(line));
    if (sumWords > 0) {
        params.put(FileStatisticKey.AVGWORD, new Double(sumWords / strArr.length));
        params.put(FileStatisticKey.MINWORD, new Long(minWord.first()));
    }
    if (maxWord.size() > 0)
        params.put(FileStatisticKey.MAXWORD, new Long(new Long(maxWord.last())));
    if (getIdFk() != null)
        params.put(FileStatisticKey.FILEID, getIdFk());
    genParamAndValues(sql, params);

    return sql;
}

From source file:com.itemanalysis.psychometrics.reliability.AbstractScoreReliability.java

public int hashCode() {
    Double v = new Double(value());
    return v.hashCode();
}

From source file:org.ff4j.web.api.resources.domain.FF4jStatusApiBean.java

/**
 * Parameterized Constructor./*from   w  w w . j a  v  a2 s .co m*/
 *
 * @param ff4j
 *      target ff4j.
 */
public FF4jStatusApiBean(FF4j ff4j) {
    System.out.println("1");
    // UpTime
    long up = System.currentTimeMillis() - ff4j.getStartTime();
    long daynumber = new Double(Math.floor(up / (1000 * 3600 * 24))).longValue();
    up = up - (daynumber * 1000 * 3600 * 24);
    long hourNumber = new Double(Math.floor(up / (1000 * 3600))).longValue();
    up = up - (hourNumber * 1000 * 3600);
    long minutenumber = new Double(Math.floor(up / (1000 * 60))).longValue();
    up = up - (minutenumber * 1000 * 60);
    long secondnumber = new Double(Math.floor(up / 1000)).longValue();
    uptime = daynumber + " day(s) ";
    uptime += hourNumber + " hours(s) ";
    uptime += minutenumber + " minute(s) ";
    uptime += secondnumber + " seconds\"";
    autocreate = ff4j.isAutocreate();
    version = ff4j.getVersion();
    if (null != ff4j.getFeatureStore()) {
        featuresStore = new FeatureStoreApiBean(ff4j.getFeatureStore());
    }
    if (null != ff4j.getEventRepository()) {
        eventRepository = new EventRepositoryApiBean(ff4j.getEventRepository(), null, null);
    }
    if (null != ff4j.getAuthorizationsManager()) {
        authorizationsManager = new AuthorizationsManagerApiBean(ff4j.getAuthorizationsManager());
    }
}

From source file:common.web.controller.StatisticController.java

public void createModel(HttpServletRequest request) {
    long[] result = new long[16];
    boolean ok = false;
    try {//from w ww . jav a2  s. c  o  m
        String methodName = "info";
        Class paramTypes[] = new Class[1];
        paramTypes[0] = result.getClass();
        Object paramValues[] = new Object[1];
        paramValues[0] = result;
        Method method = Class.forName("org.apache.tomcat.jni.OS").getMethod(methodName, paramTypes);
        method.invoke(null, paramValues);
        ok = true;
    } catch (Throwable t) {
        // Ignore
    }

    if (ok) {
        Long time_kernel = Long.valueOf(result[11] / 1000);
        Long time_user = Long.valueOf(result[12] / 1000);
        Long time_work = Long.valueOf(System.currentTimeMillis() - result[10] / 1000);
        Double percent_work = new Double((double) time_user * (double) 100 / (double) time_work);
        request.setAttribute("time_user", formatTime(time_user, ok));
        request.setAttribute("time_kernel", formatTime(time_kernel, ok));
        request.setAttribute("time_work", formatTime(time_work, ok));
        request.setAttribute("percent_work", percent_work);
    }
}