Example usage for java.lang Float toString

List of usage examples for java.lang Float toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of this Float object.

Usage

From source file:org.kuali.rice.kew.docsearch.SearchableAttributeFloatValue.java

/**
 * @deprecated USE method setSearchableAttributeValue(BigDecimal) instead
 *//*from   w  ww.ja va  2 s  .c  om*/
@Deprecated
public void setSearchableAttributeValue(Float floatValueToTranslate) {
    this.searchableAttributeValue = null;
    if (floatValueToTranslate != null) {
        this.searchableAttributeValue = new BigDecimal(floatValueToTranslate.toString());
    }
}

From source file:org.nuxeo.ecm.platform.reporting.report.ReportParameter.java

public void setValue(Float value) {
    if (type == IParameterDefn.TYPE_FLOAT) {
        stringValue = value.toString();
    }
}

From source file:com.yoncabt.abys.core.util.EBRConf.java

public Float getValue(String key, Float defaultValue) {
    String ret = getValueFromAll(key, defaultValue == null ? null : defaultValue.toString());
    return ret == null ? null : Float.valueOf(ret);
}

From source file:gov.nih.nci.ncicb.cadsr.common.lov.ClassificationsLOVBean.java

private void getClassificationBean(HttpServletRequest request, DBUtil dbUtil, String additionalWhere) {

    try {//w  ww  .  j  av a2s . co m
        // searchStr = request.getParameter("SEARCH");
        searchStr = request.getParameterValues("SEARCH");
        String csWhere = "";
        String csvWhere = "";
        String csiWhere = "";
        if (searchStr != null) {
            for (int i = 0; i < searchStr.length; i++) {
                if (searchStr[i] == null)
                    searchStr[i] = "";
            }
            if (!searchStr[0].equals("")) {
                String newSearchStr0 = StringReplace.strReplace(searchStr[0], "*", "%");
                // Release 3.0, TT#1178
                newSearchStr0 = StringReplace.strReplace(newSearchStr0, "'", "''");
                csWhere = " and   (upper (cs.long_name) like upper ( '" + newSearchStr0 + "') "
                        + " OR upper (cs.preferred_name) like upper ( '" + newSearchStr0 + "')) ";
            }
            // Release 3.2 GF#1247
            if (!searchStr[1].equals("")) {
                Float newSearchFlt1 = new Float(searchStr[1]);
                csvWhere = " and cs.version = " + newSearchFlt1.toString() + "  ";
            }
            if (!searchStr[2].equals("")) {
                String newSearchStr1 = StringReplace.strReplace(searchStr[2], "*", "%");
                // Release 3.0, TT#1178
                newSearchStr1 = StringReplace.strReplace(newSearchStr1, "'", "''");
                csiWhere = " and upper (csi.long_name) like upper ( '" + newSearchStr1 + "') ";
            }
            if (request.getParameter("chkContext") == null) {
                whereClause = csWhere + csvWhere + csiWhere;
            } else {
                whereClause = csWhere + csvWhere + csiWhere + additionalWhere;
                isContextSpecific = true;
            }

        }
        // pass the following parameters to CommonListCntrlBean
        String[] searchParm = { "cs.long_name", "Classification Scheme", "cs.version", "CS Version", // Release 3.2 GF#1247
                "csi.long_name csi_name", "Class Scheme Item" };
        String[] jspLinkParm = { "csc.cs_csi_idseq", "P_ID" };
        String[] displayParm = { "csi.long_name csi_name", "Class Scheme Item Name",
                "csi.csi_id||'v'||"
                        + "case when csi.version = trunc(csi.version) " + "then to_char(csi.version,'99.9') "
                        + "else to_char(csi.version,'99.99') " + "end csi_version",
                "CSI Public ID Version", "cs.long_name", "CS Long Name",
                "cs.cs_id||'v'||" + "case when cs.version = trunc(cs.version) "
                        + "then  to_char(cs.version,'99.9') " + "else   to_char(cs.version,'99.99') "
                        + "end csversion",
                "CS Public ID Version", // Release 3.2 GF#1247
                "cs_conte.name", "CS Context", "cs.asl_name", "CS Workflow Status", "cs.preferred_definition",
                "CS Definition" };
        String[] sqlStmtParm = new String[2];
        sqlStmtParm[0] = " from sbr.classification_schemes_view cs, sbr.contexts_view cs_conte, "
                + "      sbr.cs_items_view csi, sbr.cs_csi_view csc "
                + " where cs.conte_idseq = cs_conte.conte_idseq "
                //+
                // Release 3.2 GF#1247 " and cs.latest_version_ind = 'Yes' "
                // +
                //" and cs.deleted_ind = 'No' "  //when using view no need for this
                + " and cs.cs_idseq = csc.cs_idseq " + " and csi.csi_idseq = csc.csi_idseq "
                + " and cs.asl_name not in ('RETIRED PHASED OUT','RETIRED DELETED') " + whereClause;
        sqlStmtParm[1] = " order by cs.long_name, csi.long_name ";
        int[] lovPassbackCols = { 0, 4 };

        clb = new CommonLOVBean(request,
                // dBBroker,
                dbUtil, searchParm, jspLinkParm, displayParm, sqlStmtParm, false, lovPassbackCols);

        clb.setCompressFlag(false); // set compress flag
        clb.setLinkCol(0); // set detail page link column, 0-> first;
        // 1->second
        clb.setDetailReq_Type("value_domains"); // set req_type for detail
        // page
        clb.setShowRowNum(40);
        // clb.setPerformQueryToFalse();

        //clb.setJsId(StringEscapeUtils.escapeHtml(request.getParameter("idVar")));
        clb.setJsId("jspClassification");
        //clb.setJsName(StringEscapeUtils.escapeHtml(request.getParameter("nameVar")));
        clb.setJsName("txtClassSchemeItem");
        if (isContextSpecific)
            clb.setExtraURLInfo("&performQuery=false&ckhContext=yes");
        else
            clb.setExtraURLInfo("&performQuery=false");

    } catch (SQLException e) {
        //this.dBBroker = dBBroker;
        log.error("Exception: ", e);
    }
}

From source file:edu.kit.dama.mdm.admin.UserPropertyCollection.java

/**
 * Set the value of property with key pKey to pValue. If there is no property
 * with the provided key, a new property is added. If the provided value is
 * null, the property with the provided key will be removed.
 *
 * @param pKey The property key. This value must not be null.
 * @param pValue The property value. If pValue is null, the property will be
 * removed./*from   w w w. ja  v a2s  .c om*/
 *
 * @return TRUE if a property has been modified/added/removed, FALSE if the
 * removal failed.
 */
public boolean setFloatProperty(final String pKey, Float pValue) {
    if (pValue == null) {
        return setStringProperty(pKey, null);
    }
    return setStringProperty(pKey, pValue.toString());
}

From source file:edu.kit.dama.mdm.admin.UserPropertyCollection.java

/**
 * Returns the value of the property with the provided key as string. If the
 * property is not found, the provided default value is returned.
 *
 * @param pKey The property key./*w ww.j a va 2 s  .  c om*/
 * @param pDefaultValue The default value.
 *
 * @return The value of the property or the provided default value.
 */
public Float getFloatProperty(final String pKey, Float pDefaultValue) {
    if (pDefaultValue == null) {
        return Float.parseFloat(getStringProperty(pKey, null));
    }
    return Float.parseFloat(getStringProperty(pKey, pDefaultValue.toString()));
}

From source file:org.opencastproject.sox.remote.SoxServiceRemoteImpl.java

/**
 * {@inheritDoc}/*from   w  ww .j  ava  2 s  .  c  o  m*/
 *
 * @see org.opencastproject.sox.api.SoxService#normalize(Track, Float)
 */
@Override
public Job normalize(Track sourceAudioTrack, Float targetRmsLevDb) throws MediaPackageException, SoxException {
    HttpPost post = new HttpPost("/normalize");
    try {
        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        params.add(new BasicNameValuePair("sourceAudioTrack",
                MediaPackageElementParser.getAsXml(sourceAudioTrack)));
        params.add(new BasicNameValuePair("targetRmsLevDb", targetRmsLevDb.toString()));
        post.setEntity(new UrlEncodedFormEntity(params));
    } catch (Exception e) {
        throw new SoxException(e);
    }
    HttpResponse response = null;
    try {
        response = getResponse(post);
        if (response != null) {
            try {
                Job receipt = JobParser.parseJob(response.getEntity().getContent());
                logger.info("Normalizing audio {} on a remote audio processing server", sourceAudioTrack);
                return receipt;
            } catch (Exception e) {
                throw new SoxException("Unable to normalize audio of element '" + sourceAudioTrack
                        + "' using a remote audio processing service", e);
            }
        }
    } finally {
        closeConnection(response);
    }
    throw new SoxException("Unable to normalize audio of element '" + sourceAudioTrack
            + "' using a remote audio processing service");
}

From source file:com.sam_chordas.android.stockhawk.ui.ChartFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {

    listBidPrice = new ArrayList<>();
    listDate = new ArrayList<>();
    // Set the cursor in our CursorAdapter once the Cursor is loaded

    if (cursor != null && cursor.moveToFirst()) {

        Log.e("CURSOR SIZE=========>", String.valueOf(cursor.getCount()));

        int columnHistoryId = cursor.getColumnIndex(HistoryColumns._ID);
        int columnBidPriceIndex = cursor.getColumnIndex(HistoryColumns.BID_PRICE);
        int columnDateIndex = cursor.getColumnIndex(HistoryColumns.BID_DATE);

        String id = cursor.getString(columnHistoryId);

        String price = cursor.getString(columnBidPriceIndex);
        //put price to bid list
        listBidPrice.add(price);//  w ww .j a va2s .c o  m

        String bidDate = cursor.getString(columnDateIndex);
        //put price to bid list
        listDate.add(bidDate);

        while (cursor.moveToNext()) {
            id = cursor.getString(columnHistoryId);

            price = cursor.getString(columnBidPriceIndex);
            //put price to bid list
            listBidPrice.add(price);

            bidDate = cursor.getString(columnDateIndex);
            //put price to bid list
            listDate.add(bidDate);
        }

        //set data to chart
        LineData data = new LineData(getXAxisValues(), getDataSet());
        chart.setData(data);

        // let the chart know it's data has changed
        data.notifyDataChanged();
        chart.notifyDataSetChanged();

        //scale Y-axis
        YAxis leftAxis = chart.getAxisLeft();
        YAxis rightAxis = chart.getAxisRight();

        //don't start at 0
        leftAxis.setStartAtZero(false);
        rightAxis.setStartAtZero(false);

        //get min and max values from arraylist
        String minVal = Collections.min(listBidPrice);
        String maxVal = Collections.max(listBidPrice);

        Log.i("MINIMUM VALUE_------>", minVal);
        Log.i("MAXIMUM VALUE_------>", maxVal);

        Float minFloat = Float.valueOf(minVal);
        Float maxFloat = Float.valueOf(maxVal);

        Log.e("MINIMUM FLOAT------>", minFloat.toString());
        Log.e("MAXIMUM FLOAT------>", maxFloat.toString());

        //set min and max values for better scaling
        leftAxis.setAxisMaxValue(maxFloat);
        leftAxis.setAxisMinValue(minFloat);
        rightAxis.setAxisMaxValue(maxFloat);
        rightAxis.setAxisMinValue(minFloat);

        // format values into two decimal points only
        data.setValueFormatter(new MyValueFormatter());

        //refresh chart
        chart.invalidate();
    }

    for (String price : listBidPrice) {
        System.out.println("PRICE ===========>" + price);
    }
    for (String bidDate : listDate) {
        System.out.println("BID DATE ===========>" + bidDate);
    }

}

From source file:com.tecapro.inventory.common.util.StringUtil.java

/**
 * Converter Float to String/*from   w ww . j  ava 2  s. com*/
 * 
 * @param value
 *            int
 * @param defaultValue
 *            String
 * @return String
 */
public String toString(Float value) {
    if (value == null) {
        return "";
    }
    return value.toString();
}

From source file:org.hdiv.web.servlet.tags.form.RadioButtonTagTests.java

public void testWithUncheckedObjectValue() throws Exception {
    Float value = new Float("99.45");
    this.tag.setPath("myFloat");
    this.tag.setValue(value);
    int result = this.tag.doStartTag();
    assertEquals(Tag.SKIP_BODY, result);

    String output = getWriter().toString();
    assertTagOpened(output);//from  w w w  . j a v a  2s.  c  o m
    assertTagClosed(output);
    assertContainsAttribute(output, "name", "myFloat");
    assertContainsAttribute(output, "type", "radio");

    String hdivValue = this.confidentiality ? "0" : value.toString();
    assertContainsAttribute(output, "value", hdivValue);
    assertAttributeNotPresent(output, "checked");
}