Example usage for java.lang Float floatValue

List of usage examples for java.lang Float floatValue

Introduction

In this page you can find the example usage for java.lang Float floatValue.

Prototype

@HotSpotIntrinsicCandidate
public float floatValue() 

Source Link

Document

Returns the float value of this Float object.

Usage

From source file:org.jbpm.bpel.tutorial.invoice.ComputePricePT_Impl.java

protected void sendInvoiceMessage(float shippingPrice) throws JMSException {
    ServletContext servletContext = endpointContext.getServletContext();
    Integer orderId = (Integer) servletContext.getAttribute(ORDER_ID_ATTR);
    Float linePrice = (Float) servletContext.getAttribute(LINE_PRICE_ATTR);
    float amount = linePrice.floatValue() + shippingPrice;

    // create a session
    Session jmsSession = jmsConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
    try {/* w  w  w . j a v a 2  s  . c o  m*/
        // create the message
        MapMessage invoiceMessage = jmsSession.createMapMessage();
        invoiceMessage.setInt("orderId", orderId.intValue());
        invoiceMessage.setFloat("amount", amount);

        // send it!
        MessageProducer producer = jmsSession.createProducer(invoiceDestination);
        producer.send(invoiceMessage);

        log.debug("Sent invoice message: orderId=" + orderId + ", amount=" + amount);
    } finally {
        jmsSession.close();
    }
}

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

@Override
public void putValueFloat(String valueName, Float value) {
    try {//from  w  w  w .j ava 2 s.c  o  m
        mJSONObject.put(valueName, value.floatValue());
    } catch (JSONException e) {
        Log.e(TAG, e.toString());
    }
}

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

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

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

public Boolean evaluate(Float a, Float b) {
    Boolean r = null;/*from ww  w .jav a2  s.  c o  m*/
    if ((a == null) || (b == null)) {
        r = null;
    } else {
        r = Boolean.valueOf(a.floatValue() <= b.floatValue());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
}

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

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

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

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

From source file:org.squale.squalecommon.enterpriselayer.facade.quality.MeasureFacade.java

/**
 * Creation d'une mesure de type Kiviat pour un projet
 * /* w ww. java2  s  . com*/
 * @param pProjectId Id du projet
 * @param pAuditId Id de l'audit
 * @param pAllFactors tous les facteurs (= "true") ou seulement ceux ayant une note ?
 * @throws JrafEnterpriseException en cas de pb Hibernate
 * @return tableau d'objets : la map des donnes + le boolen pour affichage de la case  cocher tous les facteurs
 */
public static Object[] getProjectKiviat(Long pProjectId, Long pAuditId, String pAllFactors)
        throws JrafEnterpriseException {
    Map result = new HashMap();
    JFreeChart projectKiviat = null;
    MeasureDAOImpl measureDAO = MeasureDAOImpl.getInstance();
    // Session Hibernate
    ISession session = null;
    // Boolen conditonnanant l'affichage de la case  cocher "tous les facteurs" dans la page Jsp
    boolean displayCheckBoxFactors = true;
    try {
        // rcupration d'une session
        session = PERSISTENTPROVIDER.getSession();
        // On ajoute les notes de chaque projets sur le kiviat
        ProjectBO project = (ProjectBO) ProjectDAOImpl.getInstance().load(session, pProjectId);
        SortedMap values = new TreeMap();
        // recupere les facteurs du projet
        Collection factorResults = QualityResultDAOImpl.getInstance().findWhere(session, pProjectId, pAuditId);
        // et cree le map nom => note correspondant
        Iterator it = factorResults.iterator();
        ArrayList nullValuesList = new ArrayList();
        while (it.hasNext()) {
            FactorResultBO factor = (FactorResultBO) it.next();
            // le -1 est trait directement par le kiviatMaker
            Float value = new Float(factor.getMeanMark());
            // ajoute la note dans le titre
            // TODO prendre le vritable nom du facteur
            String name = factor.getRule().getName();
            if (value.floatValue() >= 0) {
                // avec 1 seul chiffre aprs la virgule
                NumberFormat nf = NumberFormat.getInstance();
                nf.setMinimumFractionDigits(1);
                nf.setMaximumFractionDigits(1);
                name = name + " (" + nf.format(value) + ")";
            } else {
                // Mmorisation temporaire des facteurs pour lesquels les notes sont nulles : sera utile si l'option
                // "Tous les facteurs" est coche pour afficher uniquement les facteurs ayant une note.
                nullValuesList.add(name);
            }
            values.put(name, value);
        }
        final int FACTORS_MIN = 3;
        if (nullValuesList.size() <= 0 || values.size() <= FACTORS_MIN) {
            displayCheckBoxFactors = false;
        }
        // Seulement les facteurs ayant une note ? ==> suppression des facteurs ayant une note nulle.
        // Mais trois facteurs doivent au moins s'afficher (nuls ou pas !)
        values = deleteFactors(values, nullValuesList, pAllFactors, FACTORS_MIN);

        // recupre le nom de l'audit
        String name = null;
        AuditBO audit = (AuditBO) AuditDAOImpl.getInstance().load(session, pAuditId);
        if (audit.getType().compareTo(AuditBO.MILESTONE) == 0) {
            name = audit.getName();
        }
        if (null == name) {
            DateFormat df = DateFormat.getDateInstance(DateFormat.LONG);
            name = df.format(audit.getDate());
        }
        result.put(name, values);

    } catch (Exception e) {
        FacadeHelper.convertException(e, MeasureFacade.class.getName() + ".getMeasures");
    } finally {
        FacadeHelper.closeSession(session, MeasureFacade.class.getName() + ".getMeasures");
    }
    Object[] kiviatObject = { result, new Boolean(displayCheckBoxFactors) };
    return kiviatObject;
}

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

public Boolean evaluate(Float a, Float b) {
    Boolean r = null;//from   www  . j a  v a 2  s .  c o  m
    if ((a == null) || (b == null)) {
        r = null;
    } else {
        r = Boolean.valueOf(a.floatValue() < b.floatValue());
    }
    // LOG.info("evaluate(" + a + "," + b + ")=" + r);
    return r;
}

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

@Override
public void putAttributeFloat(String annotationName, Float value) {
    try {/*  ww  w.j a v a2 s .c  o  m*/
        mJSONObject.put(annotationName, value.floatValue());
    } catch (JSONException e) {
        Log.e(TAG, e.toString());
    }
}

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

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