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:com.spoledge.audao.parser.gql.impl.ParserUtils.java

public static Double argDouble(Object o) {
    if (o == null)
        return null;
    if (o instanceof Double)
        return (Double) o;
    if (o instanceof Number)
        return new Double(((Number) o).floatValue());

    return new Double(o.toString());
}

From source file:org.esupportail.papercut.domain.PayBoxForm.java

public String getMontant() {
    return new Double(new Double(total) / 100.0).toString();
}

From source file:org.jfree.data.xy.OHLCDataItem.java

/**
 * Creates a new item.// ww  w  .  ja  v a2 s. co  m
 *
 * @param date  the date (<code>null</code> not permitted).
 * @param open  the open value.
 * @param high  the high value.
 * @param low  the low value.
 * @param close  the close value.
 * @param volume  the volume.
 */
public OHLCDataItem(Date date, double open, double high, double low, double close, double volume) {
    ParamChecks.nullNotPermitted(date, "date");
    this.date = date;
    this.open = new Double(open);
    this.high = new Double(high);
    this.low = new Double(low);
    this.close = new Double(close);
    this.volume = new Double(volume);
}

From source file:org.openmrs.module.kenyarx.mapping.ObjectObsMarshallerTest.java

@Test
public void marshal_shouldConvertToObs() throws Exception {
    Patient patient = Context.getPatientService().getPatient(7);
    Concept aspirin = Context.getConceptService().getConcept(71617);
    Date date = new Date();

    Dispensing dispensing = new Dispensing();
    dispensing.setDispensedConcept(aspirin);
    dispensing.setDispensedQuantity(123.0);
    dispensing.setDispensedUnits("ml");

    Obs obs = objectObsMarshaller.marshal(dispensing, null, date, patient);
    Assert.assertNotNull(obs);// www. ja  v  a 2 s.  c o m
    Assert.assertEquals(patient, obs.getPerson());
    Assert.assertEquals(date, obs.getObsDatetime());

    Obs drugObs = objectObsMarshaller.findMember(obs, Context.getConceptService().getConcept(1282));
    Assert.assertNotNull(drugObs);
    Assert.assertEquals(patient, drugObs.getPerson());
    Assert.assertEquals(date, drugObs.getObsDatetime());
    Assert.assertEquals(aspirin, drugObs.getValueCoded());

    Obs quantityObs = objectObsMarshaller.findMember(obs, Context.getConceptService().getConcept(1443));
    Assert.assertNotNull(quantityObs);
    Assert.assertEquals(patient, quantityObs.getPerson());
    Assert.assertEquals(date, quantityObs.getObsDatetime());
    Assert.assertEquals(new Double(123.0), quantityObs.getValueNumeric());

    Obs unitsObs = objectObsMarshaller.findMember(obs, Context.getConceptService().getConcept(1444));
    Assert.assertNotNull(unitsObs);
    Assert.assertEquals(patient, unitsObs.getPerson());
    Assert.assertEquals(date, unitsObs.getObsDatetime());
    Assert.assertEquals("ml", unitsObs.getValueText());
}

From source file:de.hybris.platform.b2b.services.impl.DefaultB2BOrderServiceTest.java

@Test
@Ignore// w  w w . j av  a2s . c  o m
public void shouldCalculateOrderForUserAssignedToMulitpleUnits() throws Exception {
    final String userId = "GC Sales Boss";
    commonI18NService.setCurrentCurrency(commonI18NService.getCurrency("USD"));

    final B2BCustomerModel user = userService.getUserForUID(userId, B2BCustomerModel.class);
    Assert.assertNotNull(user.getGroups());
    final OrderStatus status = OrderStatus.CREATED;
    final OrderModel order = createOrderWithStatus(userId, status);
    order.setCurrency(commonI18NService.getCurrency("USD"));
    modelService.save(order);
    this.calculationService.recalculate(order);
    Assert.assertEquals(new Double(10d), order.getTotalPrice());

}

From source file:de.unibayreuth.bayeos.goat.table.MassenTableModel.java

public Object getValueAt(int aRow, int aColumn) {
    switch (aColumn) {
    case 0:/*w ww  .  j a  v a  2s  . c  o  m*/
        return new java.util.Date(vonList.get(aRow) * 1000L);
    case 1:
        return new Double(wertList.get(aRow));
    case 2:
        return new Byte(statusList.get(aRow));
    default:
        return null;
    }
}

From source file:org.jfree.data.time.TimePeriodValue.java

/**
 * Constructs a new data item.//from ww  w.j a  v  a 2s. co m
 *
 * @param period  the time period (<code>null</code> not permitted).
 * @param value  the value associated with the time period.
 *
 * @throws IllegalArgumentException if <code>period</code> is
 *     <code>null</code>.
 */
public TimePeriodValue(TimePeriod period, double value) {
    this(period, new Double(value));
}

From source file:com.redhat.lightblue.crud.validator.MinMaxCheckerTest.java

protected JsonNode mockFieldValue(JsonNode mock, int value) {
    if ((number instanceof Integer) || (number instanceof Byte) || (number instanceof Short)
            || (number instanceof Long)) {
        when(mock.asLong()).thenReturn(new Long(value));
    } else if ((number instanceof Float) || (number instanceof Double)) {
        when(mock.asDouble()).thenReturn(new Double(value));
    } else if (number instanceof BigInteger) {
        when(mock.bigIntegerValue()).thenReturn(new BigInteger(String.valueOf(value)));
    } else if (number instanceof BigDecimal) {
        when(mock.decimalValue()).thenReturn(new BigDecimal(value));
    } else {/* w ww .  jav  a  2 s .  c om*/
        throw new IllegalArgumentException("Not a supported Number type: " + number.getClass());
    }

    return mock;
}

From source file:nz.co.senanque.pizzaorder.PizzaOrderTest.java

@Test
public void test3() throws Exception {
    ValidationSession validationSession = m_validationEngine.createSession();
    Order order = new Order();
    validationSession.bind(order);//from w ww .j a  v  a  2s . c o m
    assertEquals(new Double(0), new Double(order.getAmount()));
    Pizza pizza = new Pizza();
    order.getOrderItems().add(pizza);
    assertEquals(new Double(0), new Double(order.getAmount()));
    log.debug("setting size to Medium");
    pizza.setSize("Medium");
    assertEquals("Medium", pizza.getSize());
    log.debug("verified setting size to Medium");
    assertEquals(new Double(15), new Double(order.getAmount()));
    pizza.setSize("Small");
    assertEquals("Small", pizza.getSize());
    assertEquals(new Double(10), new Double(order.getAmount()));
    validationSession.close();
}

From source file:org.jfree.chart.demo.PieChart3DDemo1.java

/**
 * Creates a sample dataset for the demo.
 * //from  w  w w  . jav a2 s.c om
 * @return A sample dataset.
 */
private PieDataset createSampleDataset() {

    final 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));
    return result;

}