Example usage for java.lang Double doubleValue

List of usage examples for java.lang Double doubleValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public double doubleValue() 

Source Link

Document

Returns the double value of this Double object.

Usage

From source file:org.jbpm.formModeler.core.processing.fieldHandlers.RangeInputTextFieldHandlerFormatter.java

protected Object applyPattern(Field field, Object value) {
    if (value != null) {
        if (value instanceof Double) {
            String pattern = field.getPattern();
            if (pattern == null || "".equals(pattern))
                pattern = field.getFieldType().getPattern();
            if (pattern != null && !"".equals(value)) {
                DecimalFormat nf = (DecimalFormat) DecimalFormat.getInstance(getLocale());
                nf.applyPattern(pattern);
                value = nf.format(((Double) value).doubleValue());
            }//from ww  w .  ja  v a2s  .  c o  m
        }
        if (value instanceof Object[]) {
            String pattern = field.getPattern();
            if (pattern == null || "".equals(pattern))
                pattern = field.getFieldType().getPattern();
            if (pattern != null) {
                DecimalFormat nf = (DecimalFormat) DecimalFormat.getInstance(getLocale());
                nf.applyPattern(pattern);
                Object[] values = (Object[]) value;
                for (int i = 0; i < values.length; i++) {
                    Object object = values[i];
                    if (object != null && object instanceof Double) {
                        Double aDouble = (Double) object;
                        values[i] = nf.format(aDouble.doubleValue());
                    }
                }
                value = values;
            }
        }
    }
    return value;
}

From source file:org.apache.pig.test.TestPi.java

@Before
public void setUp() throws Exception {

    log.info("Generating test data...");
    log.info("Default block size = " + defaultBlockSize);
    log.info("Total no. of iterations to run for test data = " + total);

    Random rand = new Random();

    pig = new PigServer(ExecType.LOCAL);
    Data data = resetData(pig);//w w  w . j  a v  a  2 s.  co  m
    List<Tuple> theInput = Lists.newArrayList();

    for (int i = 0; i < total; i++) {
        Double x = new Double(rand.nextDouble());
        Double y = new Double(rand.nextDouble());
        double x1 = x.doubleValue() - 0.5;
        double y1 = y.doubleValue() - 0.5;
        double sq_dist = (x1 * x1) + (y1 * y1);
        if (sq_dist <= 0.25) {
            inCircle++;

        }

        theInput.add(tuple(x, y));

        totalLength += String.valueOf(sq_dist).length();
    }
    data.set("foo", theInput);
}

From source file:com.zekke.webapp.data.dao.PathDaoTest.java

@Test
@Transactional(readOnly = true)//  www  .  j  a v a 2 s .  c o  m
public void testReadDistance() throws Exception {
    LOG.trace("testReadDistance");

    double expected = 35.8514802281527;
    Double actual = pathDao.readDistance(2L, 1L);

    assertNotNull(actual);
    assertEquals(expected, actual.doubleValue(), 0d);
}

From source file:com.crs4.roodin.bayesian.SessionsLogger.java

/**
 * @param input JSONArray// w  w  w .j  a  v a2  s  . com
 * @return double[] array from JSONArray
 */
private double[] convertToArray(JSONArray input) {
    double[] output = new double[input.length()];

    try {
        for (int i = 0; i < input.length(); i++) {
            Double e = (Double) input.get(i);
            output[i] = e.doubleValue();
        }

    } catch (JSONException e1) {
        Log.e("ERRORE", "in convertJSONArray " + e1.getMessage());
    }

    return output;
}

From source file:com.kulik.android.jaxb.library.composer.providers.jsonProvider.JSONObjectProvider.java

@Override
public void putValueDouble(String valueName, Double value) {
    try {/*from   w w w . j a  v  a2s.  c  o  m*/
        mJSONObject.put(valueName, value.doubleValue());
    } catch (JSONException e) {
        Log.e(TAG, e.toString());
    }
}

From source file:org.apache.hadoop.hive.ql.udf.UDFOPEqualOrGreaterThan.java

public Boolean evaluate(Double a, Double b) {
    Boolean r = null;//w w  w . j  av a  2 s. c o  m
    if ((a == null) || (b == null)) {
        r = null;
    } else {
        r = Boolean.valueOf(a.doubleValue() >= b.doubleValue());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
}

From source file:org.apache.hadoop.hive.ql.udf.UDFOPEqualOrLessThan.java

public Boolean evaluate(Double a, Double b) {
    Boolean r = null;/* w  w  w .ja v a2 s.c o m*/
    if ((a == null) || (b == null)) {
        r = null;
    } else {
        r = Boolean.valueOf(a.doubleValue() <= b.doubleValue());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
}

From source file:org.apache.hadoop.hive.ql.udf.UDFOPGreaterThan.java

public Boolean evaluate(Double a, Double b) {
    Boolean r = null;//from  ww  w .  ja v a  2  s . co  m
    if ((a == null) || (b == null)) {
        r = null;
    } else {
        r = Boolean.valueOf(a.doubleValue() > b.doubleValue());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
}

From source file:org.apache.hadoop.hive.ql.udf.UDFOPNotEqual.java

public Boolean evaluate(Double a, Double b) {
    Boolean r = null;//w  w  w . j a v a  2  s  .  c om
    if ((a == null) || (b == null)) {
        r = null;
    } else {
        r = Boolean.valueOf(a.doubleValue() != b.doubleValue());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
}

From source file:org.apache.hadoop.hive.ql.udf.UDFOPLessThan.java

public Boolean evaluate(Double a, Double b) {
    Boolean r = null;/*w  w  w  .j  a  va 2 s  .  c  om*/
    if ((a == null) || (b == null)) {
        r = null;
    } else {
        r = Boolean.valueOf(a.doubleValue() < b.doubleValue());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
}