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:net.ceos.project.poi.annotated.bean.cascade.CascadeL2Builder.java

/**
 * Create a CascadeL2 for tests./* ww w.j  ava 2 s  .c o  m*/
 * 
 * @return the {@link CascadeL2}
 */
public static CascadeL2 buildCascadeL2(int multiplier) {
    CascadeL2 toValidate = new CascadeL2();

    toValidate.setDateAttribute(new Date());
    toValidate.setStringAttribute("Cascade L2");
    toValidate.setIntegerAttribute(46 * multiplier);
    toValidate.setDoubleAttribute(Double.valueOf("25.3") * multiplier);
    toValidate.setLongAttribute(Long.valueOf("1234567890") * multiplier);
    toValidate.setBooleanAttribute(Boolean.FALSE);
    /* create sub object Job */
    Job job = new Job();
    job.setJobCode(0005);
    job.setJobFamily("Family Job Name L2");
    job.setJobName("Job Name L2");
    toValidate.setJob(job);

    CascadeL3 l3 = CascadeL3Builder.buildCascadeL3();
    ArrayList<CascadeL3> l3List = new ArrayList<>();
    l3List.add(l3);
    l3List.add(l3);
    l3List.add(l3);
    l3List.add(l3);
    l3List.add(l3);

    toValidate.setObjectsList(l3List);
    // TODO add new fields below

    return toValidate;
}

From source file:net.ceos.project.poi.annotated.bean.cascade.CascadeL1Builder.java

/**
 * Create a CascadeL1 for tests./*from www. ja  va  2  s  . co  m*/
 * 
 * @return the {@link CascadeL1}
 */
public static CascadeL1 buildCascadeL1(int multiplier) {
    CascadeL1 toValidate = new CascadeL1();

    toValidate.setDateAttribute(new Date());
    toValidate.setStringAttribute("cascade L1");
    toValidate.setIntegerAttribute(46 * multiplier);
    toValidate.setDoubleAttribute(Double.valueOf("25.3") * multiplier);
    toValidate.setLongAttribute(Long.valueOf("1234567890") * multiplier);
    toValidate.setBooleanAttribute(Boolean.FALSE);
    /* create sub object Job */
    Job job = new Job();
    job.setJobCode(0005);
    job.setJobFamily("Family Job Name L1");
    job.setJobName("Job Name L1");
    toValidate.setJob(job);

    CascadeL2 l2 = CascadeL2Builder.buildCascadeL2();
    ArrayList<CascadeL2> l2List = new ArrayList<>();
    l2List.add(l2);
    l2List.add(l2);
    l2List.add(l2);
    l2List.add(l2);
    l2List.add(l2);

    toValidate.setObjectsList(l2List);

    // TODO add new fields below

    return toValidate;
}

From source file:net.ceos.project.poi.annotated.bean.FreeElementAdvancedObjectBuilder.java

/**
 * Create a FreeElementAdvancedObject for tests.
 * //www.j  a v  a 2s  . c  om
 * @return the {@link FreeElementAdvancedObject}
 */
public static FreeElementAdvancedObject buildFreeElementAdvancedObject(int multiplier) {
    FreeElementAdvancedObject toValidate = new FreeElementAdvancedObject();

    toValidate.setFreeString("The string attribute");
    toValidate.setFreeDouble(Double.valueOf("1169.21") * multiplier);
    toValidate.setFreePrimitiveInt(333 * multiplier);
    toValidate.setFreeDate(new Date());
    toValidate.setFreeLong(Long.valueOf("1511243017") * multiplier);
    toValidate.setFreePrimitiveBoolean(Boolean.FALSE);
    // TODO add new fields below

    return toValidate;
}

From source file:com.bstek.dorado.data.type.DoubleDataType.java

public Object fromText(String text) {
    if (StringUtils.isEmpty(text)) {
        return null;
    } else {//  ww w. ja v  a2 s  . c  o  m
        return Double.valueOf(text);
    }
}

From source file:es.alrocar.utils.Utils.java

public static double formatNumber(String number, String decimalSeparator, String numberSeparator) {
    if (number == null || number.trim().isEmpty()) {
        return 0;
    }/*w ww.j av a 2s  .c  o  m*/

    number = StringUtils.replaceEach(number, removeChars, replaceChars);

    String temp = number.trim();
    if (numberSeparator != null) {
        temp = number.replaceAll(numberSeparator, "");
    }

    if (decimalSeparator != null) {
        temp = temp.replaceAll(decimalSeparator, ".");
    }

    return Double.valueOf(temp);
}

From source file:de.rallye.model.structures.LatLng.java

public static LatLng fromString(String location) {
    String[] res = location.replaceAll("^\\(([0-9\\.]+),([0-9\\.]+)\\)$", "$1;$2").split(";");
    return new LatLng(Double.valueOf(res[0]), Double.valueOf(res[1]));

}

From source file:com.frank.search.solr.core.geo.Point.java

public Point(double x, double y, double z) {
    super(x, y);
    this.z = Double.valueOf(z);
}

From source file:data.dao.CarDao.java

public List<Car> getCarLesserPrice(BigDecimal price) {

    Criteria cr = currentSession().createCriteria(getSupportedClass());
    cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    cr.add(Restrictions.le("cmPrice", price.doubleValue()));
    cr.add(Restrictions.gt("cmPrice", Double.valueOf("0.0")));
    return cr.list();
}

From source file:be.fgov.kszbcss.rhq.websphere.support.measurement.JMXMeasurementDataUtils.java

public static void addData(MeasurementReport report, MeasurementScheduleRequest request, Object value) {
    switch (request.getDataType()) {
    case MEASUREMENT:
        Double doubleValue;/*from   www.  j ava2  s .c om*/
        if (value instanceof Double) {
            doubleValue = (Double) value;
        } else if (value instanceof Number) {
            doubleValue = Double.valueOf(((Number) value).doubleValue());
        } else {
            log.error("Type " + value.getClass() + " not support for numeric measurements");
            break;
        }
        if (log.isDebugEnabled()) {
            log.debug("Adding (numeric) measurement for " + request.getName() + "; value=" + value);
        }
        report.addData(new MeasurementDataNumeric(request, doubleValue));
        break;
    case TRAIT:
        if (log.isDebugEnabled()) {
            log.debug("Adding measurement (trait) for " + request.getName() + "; value=" + value);
        }
        report.addData(new MeasurementDataTrait(request, value == null ? null : value.toString()));
        break;
    default:
        log.error("Data type " + request.getDataType() + " not supported");
    }
}

From source file:fr.matthiasbosc.translucentmap.PlaceDetailsJSONParser.java

/** Receives a JSONObject and returns a list */
public List<HashMap<String, String>> parse(JSONObject jObject) {

    Double lat = Double.valueOf(0);
    Double lng = Double.valueOf(0);
    String formattedAddress = "";

    HashMap<String, String> hm = new HashMap<String, String>();
    List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();

    try {/*from ww w .j a  v a2s .  c  o m*/
        lat = (Double) jObject.getJSONObject("result").getJSONObject("geometry").getJSONObject("location")
                .get("lat");
        lng = (Double) jObject.getJSONObject("result").getJSONObject("geometry").getJSONObject("location")
                .get("lng");
        formattedAddress = (String) jObject.getJSONObject("result").get("formatted_address");

    } catch (JSONException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }

    hm.put("lat", Double.toString(lat));
    hm.put("lng", Double.toString(lng));
    hm.put("formatted_address", formattedAddress);

    list.add(hm);

    return list;
}