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:io.spring.batch.SimilaritiesFieldSetMapper.java

@Override
public Object mapFieldSet(FieldSet fieldSet) throws BindException {
    int tagId = fieldSet.readInt(0);

    String[] values = fieldSet.getValues();
    Map<Integer, Double> similarites = new HashMap<Integer, Double>();

    for (int i = 1; i < values.length; i++) {
        String[] curValues = values[i].split(":");

        similarites.put(Integer.valueOf(curValues[0]), Double.valueOf(curValues[1]));
    }//from   w w w.  java 2s  .c om

    return new Similarities(tagId, similarites);
}

From source file:in.yuvi.http.fluent.CountingRequestEntity.java

public CountingRequestEntity(final HttpEntity entity, final ProgressListener listener) {
    super();/*from   w w  w .  ja  va  2 s .c o  m*/
    this.delegate = entity;
    this.listener = listener;
    // Percenetage of total size after which to trigger progress updates. Defaults to 0.5%
    this.PROGRESS_TRIGGER_PERCENTAGE = Double
            .valueOf(System.getProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "0.5")) / 100;
}

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

public Point(String p_strX, String p_strY) throws NumberFormatException {
    Double.valueOf(p_strX);
    Double.valueOf(p_strY);
    setX(p_strX);
    setY(p_strY);
}

From source file:com.qcadoo.model.api.BigDecimalUtils.java

/**
 * Converts value, if null returns one/*from  ww w  .j  av  a 2s  .  c o m*/
 * 
 * @param value
 *            value
 * 
 * @return value or one
 */
public static BigDecimal convertNullToOne(final Object value) {
    if (value == null) {
        return BigDecimal.ONE;
    }
    if (value instanceof BigDecimal) {
        return (BigDecimal) value;
    }
    return BigDecimal.valueOf(Double.valueOf(value.toString()));

}

From source file:com.ottogroup.bi.streaming.operator.json.aggregate.functions.DoubleContentAggregateFunction.java

/**
 * @see com.ottogroup.bi.streaming.operator.json.aggregate.functions.JsonContentAggregateFunction#sum(java.io.Serializable, java.io.Serializable)
 *///w  w w  .  ja  v  a2 s  . com
public Double sum(Double oldSum, Double value) throws Exception {
    if (oldSum == null && value == null)
        return null;
    if (oldSum != null && value == null)
        return oldSum;
    if (oldSum == null && value != null)
        return Double.valueOf(value.doubleValue());
    return Double.valueOf(oldSum.doubleValue() + value.doubleValue());
}

From source file:to.noc.devicefp.server.service.MaxMindServiceImpl.java

private static void addLocationField(MaxMindLocation location, GeoIpField field, String value) {
    try {//w  ww  .j  av  a 2  s .  c o m
        switch (field) {
        case countryCode:
            location.setCountryCode(value);
            break;
        case countryName:
            location.setCountryName(value);
            break;
        case regionCode:
            location.setRegionCode(value);
            break;
        case regionName:
            location.setRegionName(value);
            break;
        case city:
            location.setCity(value);
            break;
        case latitude:
            location.setLatitude(Double.valueOf(value));
            break;
        case longitude:
            location.setLongitude(Double.valueOf(value));
            break;
        case metroCode:
            location.setMetroCode(value);
            break;
        case areaCode:
            location.setAreaCode(value);
            break;
        case timeZone:
            location.setTimeZone(value);
            break;
        case continent:
            location.setContinent(value);
            break;
        case postalCode:
            location.setPostalCode(value);
            break;
        case isp:
            location.setIsp(value);
            break;
        case organization:
            location.setOrg(value);
            break;
        case domain:
            location.setDomain(value);
            break;
        case asnum:
            location.setAsnum(value);
            break;
        case netSpeed:
            location.setNetSpeed(value);
            break;
        case userType:
            location.setUserType(value);
            break;
        case accuracyRadiusKm:
            location.setAccuracyRadius(Integer.valueOf(value) * 1000);
            break;
        case countryConf:
            location.setCountryConf(value);
            break;
        case cityConf:
            location.setCityConf(value);
            break;
        case regionConf:
            location.setRegionConf(value);
            break;
        case postalConf:
            location.setPostalConf(value);
            break;
        case error:
            location.setError(value);
            log.error("Error received from MaxMind web service ip={} error={}", location.getIpAddress(), value);
            break;
        }
    } catch (NumberFormatException ex) {
        log.error("Bad value from Maxmind field={} value={}", field.toString(), value);
    }
}

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

public ReliabilityInterval(ScoreReliability reliability, double sampleSize, double numberOfVariables,
        boolean unbiased) {
    this.reliability = reliability;
    this.sampleSize = Double.valueOf(sampleSize).intValue();
    this.numberOfVariables = numberOfVariables;
    this.unbiased = unbiased;
}

From source file:demo.model.ServiceLocationTests.java

@Test
public void testServiceLocationDeserialization() throws JsonParseException, JsonMappingException, IOException {
    final InputStream is = ServiceLocationTests.class.getResourceAsStream("/service-location.json");
    final ObjectMapper objectMapper = new ObjectMapper();
    final ServiceLocation serviceLocation = objectMapper.readValue(is, ServiceLocation.class);
    Assert.assertNotNull(serviceLocation);
    Assert.assertEquals(Double.valueOf(38.907773), serviceLocation.getLocation().getLatitude());
    Assert.assertEquals(Double.valueOf(-77.023735), serviceLocation.getLocation().getLongitude());

    Assert.assertEquals("55e521c430044aedf761fa52", serviceLocation.getId());
    Assert.assertEquals("1317 9th St NW", serviceLocation.getAddress1());
    Assert.assertEquals("Washington", serviceLocation.getCity());
    Assert.assertEquals("DC", serviceLocation.getState());
    Assert.assertEquals("20001", serviceLocation.getZip());
    Assert.assertEquals("Service", serviceLocation.getType());
}

From source file:com.wabacus.system.datatype.DoubleType.java

public Object getColumnValue(ResultSet rs, String column, AbsDatabaseType dbtype) throws SQLException {
    return Double.valueOf(rs.getDouble(column));
}

From source file:org.kaloz.datafeed.yahoo.infrastructure.acl.YahooCSVConverter.java

@Converter
public InstrumentPriceCommandMessage toInstrumentPriceCommandMessage(YahooCSV data)
        throws ParseException, NumberFormatException {

    InstrumentPriceCommandMessage instrumentPriceCommandMessage = new InstrumentPriceCommandMessage();
    instrumentPriceCommandMessage.setShortName(data.getShortName());
    instrumentPriceCommandMessage.setLongName(data.getLongName());
    instrumentPriceCommandMessage.setPrice(Double.valueOf(data.getLastPrice()));
    instrumentPriceCommandMessage.setDate(new SimpleDateFormat("MM/dd/yyyy").parse(data.getDate()));
    instrumentPriceCommandMessage.setProvider(providerName);

    return instrumentPriceCommandMessage;
}