Example usage for java.lang Double valueOf

List of usage examples for java.lang Double valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Double valueOf(double d) 

Source Link

Document

Returns a Double instance representing the specified double value.

Usage

From source file:com.itemanalysis.psychometrics.cfa.UnweightedLeastSquares.java

public double gfi() {
    double fit = 0.0;
    double q = Double.valueOf(model.getNumberOfItems()).doubleValue();
    RealMatrix D = varcov.subtract(SIGMA);
    RealMatrix D2 = D.multiply(D);/*ww  w  .java  2  s  .  c  o  m*/
    RealMatrix V2 = varcov.multiply(varcov);
    fit = 1.0 - D2.getTrace() / V2.getTrace();
    return fit;
}

From source file:eu.optimis.tf.sp.service.SPOperation.java

public SPOperation() {
    production = Boolean.valueOf(PropertiesUtils.getProperty("TRUST", "production"));
    rate = Double.valueOf(PropertiesUtils.getProperty("TRUST", "maxRate"));
}

From source file:com.cloudera.science.pig.EBGM.java

public EBGM(String alpha1, String beta1, String alpha2, String beta2, String p) {
    this(Double.valueOf(alpha1), Double.valueOf(beta1), Double.valueOf(alpha2), Double.valueOf(beta2),
            Double.valueOf(p));//  ww w.j av a 2s. c  om
}

From source file:com.snapdeal.scm.fh.service.impl.ConvertorService.java

@SuppressWarnings("unchecked")
@Override//from   w w  w. j  a v a 2 s  . com
public <T> T convertToObject(Class<T> clazz, String value) throws ParseException {
    if (StringUtils.isEmpty(value) || StringUtils.NULL.equalsIgnoreCase(value)) {
        return null;
    }
    if (clazz.equals(Integer.class)) {
        return (T) Integer.valueOf(value);
    }
    if (clazz.equals(Date.class)) {
        try {
            return (T) new Date(Long.valueOf(value));
        } catch (NumberFormatException ne) {
            return (T) DateUtils.parseDate(value, ALLOWED_DATE_FORMATS);
        }
    }
    if (clazz.equals(String.class)) {
        return (T) value;
    }
    if (clazz.equals(Float.class)) {
        return (T) Float.valueOf(value);
    }
    if (clazz.equals(Double.class)) {
        return (T) Double.valueOf(value);
    }
    if (clazz.equals(Boolean.class)) {
        if (value.equals("1") || value.equalsIgnoreCase("true")) {
            return (T) Boolean.TRUE;
        } else if (value.equals("0") || value.equalsIgnoreCase("false")) {
            return (T) Boolean.FALSE;
        }
    }
    throw new ParseException("unable to parse string [" + value + "] to class " + clazz, 0);
}

From source file:com.esri.gpt.server.openls.provider.util.Point.java

public void setY(String p_strY) {
    m_strY = p_strY;
    m_Y = Double.valueOf(p_strY).doubleValue();
}

From source file:chiliad.parser.pdf.model.MToken.java

public static Color rgbaToColor(String rgba) {
    String[] comp = split(substringsBetween(rgba, "rgba(", ")")[0], ",");
    int r = Integer.valueOf(trimToEmpty(comp[0]));
    int g = Integer.valueOf(trimToEmpty(comp[1]));
    int b = Integer.valueOf(trimToEmpty(comp[2]));
    int a = (int) (Double.valueOf(trimToEmpty(comp[3])) * 255);
    return new Color(r, g, b, a);
}

From source file:fr.zcraft.zbanque.utils.LocationUtils.java

/**
 * Converts a string location (format "x;y;z" or "x;y;z;pitch" or "x;y;z;pitch;yaw") to a
 * location object./*ww w. ja  va2s . com*/
 *
 * @param world The world.
 * @param raw   The raw string.
 *
 * @return The location.
 * @throws IllegalArgumentException if the format is not valid.
 */
public static Location string2Location(World world, String raw) {
    String[] parts = raw.split(";");
    Validate.isTrue(parts.length >= 3, "The location must contains at least three coordinates");

    Location location = new Location(world, Double.valueOf(parts[0]), Double.valueOf(parts[1]),
            Double.valueOf(parts[2]));

    if (parts.length >= 4)
        location.setPitch(Float.valueOf(parts[3]));

    if (parts.length >= 5)
        location.setYaw(Float.valueOf(parts[4]));

    return location;
}

From source file:com.consol.citrus.admin.service.report.JUnitTestReportService.java

@Override
public TestReport getLatest(Project activeProject) {
    TestReport report = new TestReport();

    if (hasTestResults(activeProject)) {
        try {//  w  w  w . j a  v  a 2  s  . com
            Document testResults = XMLUtils.parseMessagePayload(getTestResultsAsString(activeProject));
            report.setSuiteName(XPathUtils.evaluateAsString(testResults, "/testsuite/@name", null));
            report.setDuration(Math.round(
                    Double.valueOf(XPathUtils.evaluateAsString(testResults, "/testsuite/@time", null)) * 1000));

            report.setFailed(
                    Long.valueOf(XPathUtils.evaluateAsString(testResults, "/testsuite/@failures", null)));
            report.setSkipped(
                    Long.valueOf(XPathUtils.evaluateAsString(testResults, "/testsuite/@skipped", null)));
            report.setTotal(Long.valueOf(XPathUtils.evaluateAsString(testResults, "/testsuite/@tests", null)));
            report.setPassed(report.getTotal() - report.getSkipped() - report.getFailed());
        } catch (IOException e) {
            log.error("Failed to read test results file", e);
        }
    }

    return report;
}

From source file:org.deviceconnect.android.profile.restful.test.NormalProximityProfileTestCase.java

/**
 * ?????./*w w w  .ja  v  a2 s. com*/
 * <pre>
 * ?HTTP
 * Method: PUT
 * Path: /proximity/ondeviceproximity?deviceid=xxxx&session_key=xxxx
 * </pre>
 * <pre>
 * ??
 * result?0???????
 * </pre>
 */
public void testOnDeviceProximity01() {
    try {
        JSONObject event = registerEventCallback(ProximityProfileConstants.ATTRIBUTE_ON_DEVICE_PROXIMITY);
        JSONObject proximity = event.getJSONObject(ProximityProfileConstants.PARAM_PROXIMITY);
        Assert.assertEquals(Double.valueOf(TestProximityProfileConstants.VALUE),
                proximity.getDouble(ProximityProfileConstants.PARAM_VALUE));
        Assert.assertEquals(Double.valueOf(TestProximityProfileConstants.MIN),
                proximity.getDouble(ProximityProfileConstants.PARAM_MIN));
        Assert.assertEquals(Double.valueOf(TestProximityProfileConstants.MAX),
                proximity.getDouble(ProximityProfileConstants.PARAM_MAX));
        Assert.assertEquals(Double.valueOf(TestProximityProfileConstants.THRESHOLD),
                proximity.getDouble(ProximityProfileConstants.PARAM_THRESHOLD));
    } catch (JSONException e) {
        fail("Exception in JSONObject." + e.getMessage());
    }
}

From source file:PCATestApplet.java

public void init() {

    /*/*from   w  w w.  java2 s .  c o  m*/
    // Data definition
    int n = 10;
    //read params to create these
    double[][] datas1 = new double[n][3];
    double[][] datas2 = new double[n][3];
    for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) { // 3 == set the x,y,z...goto next of the 10
       datas1[i][j] = Math.random();
       datas2[i][j] = Math.random();
    }
    }
    */

    Plot3DPanel plotpanel = new Plot3DPanel();
    plotpanel.setAxeLabel(0, "PC1");
    plotpanel.setAxeLabel(1, "PC2");
    plotpanel.setAxeLabel(2, "PC3");
    plotpanel.addLegend("SOUTH");

    String totalPts = getParameter("totalPts");
    String totalGps = getParameter("totalGps");
    //groupLabel_x
    //groupCount_x
    //pt_x_x (group#_pt#)

    for (int i = 0; i < Integer.parseInt(totalGps); i++) {
        String thisGrpLabel = getParameter("groupLabel_" + i);
        String thisGrpCount = getParameter("groupCount_" + i);
        String thisGrpColor = getParameter("groupColor_" + i);
        double[][] lumpData = new double[Integer.parseInt(thisGrpCount)][3];

        for (int t = 0; t < Integer.parseInt(thisGrpCount); t++) {
            String v = getParameter("pt_" + i + "_" + t);
            String[] xyz = StringUtils.split(v, ",");
            for (int j = 0; j < 3; j++) {
                lumpData[t][j] = Double.valueOf(xyz[j]).doubleValue();
            }
        }

        //plotpanel.addScatterPlot(thisGrpLabel, lumpData);
        plotpanel.addScatterPlot(thisGrpLabel, new Color(Integer.parseInt(thisGrpColor)), lumpData);
        lumpData = null;
    }

    /*
    //lump data example
    double[][] lumpData = new double[Integer.parseInt(totalPts)][3];
    for(int i=0; i<Integer.parseInt(totalPts); i++){
    String v = getParameter("pt_"+i);
    String[] xyz = StringUtils.split(v, ",");
    for(int j=0; j<3; j++){
       lumpData[i][j] = Double.valueOf(xyz[j]);
    }
    }
    */

    // PlotPanel construction
    //Plot3DPanel plotpanel = new Plot3DPanel();
    //plotpanel.setAxeLabel(0, "PC1");
    //plotpanel.setAxeLabel(1, "PC2");
    //plotpanel.setAxeLabel(2, "PC3");
    //plotpanel.addLegend("SOUTH");

    // Data plots addition
    //plotpanel.addScatterPlot("lump data", lumpData);

    //plotpanel.addScatterPlot(totalPts + " datas1", datas1);
    //plotpanel.addScatterPlot("datas2", datas2);
    //plotpanel.addBarPlot("datas2", datas2);

    // include plot in applet
    add(plotpanel);
}