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.wings.style.CSSStyleSheet.java

public static float getLength(String value) {
    int length = value.length();
    if (length >= 2) {
        String units = value.substring(length - 2, length);
        Float scale = (Float) lengthMapping.get(units);

        if (scale != null) {
            try {
                return Float.valueOf(value.substring(0, length - 2)).floatValue() * scale.floatValue();
            } catch (NumberFormatException nfe) {
            }/*from  ww w. j  av  a  2 s .  c om*/
        } else {
            // treat like points.
            try {
                return Float.valueOf(value).floatValue();
            } catch (NumberFormatException nfe) {
            }
        }
    } else if (length > 0) {
        // treat like points.
        try {
            return Float.valueOf(value).floatValue();
        } catch (NumberFormatException nfe) {
        }
    }
    return 12.0f;
}

From source file:org.squale.squalecommon.enterpriselayer.facade.rule.AuditComputing.java

/**
 * Calcul de la note d'une pratique//from   w  ww.ja  va 2 s .com
 * 
 * @param pPractice pratique
 * @param pPracticeResult rsultats de la pratique
 * @param pMarks les notes des composants impliqus
 * @throws WeightFunctionException si erreur
 */
private static void computePracticeMark(PracticeRuleBO pPractice, PracticeResultBO pPracticeResult,
        Collection pMarks) throws WeightFunctionException {
    /*
     * Formule : meanMark = weigh^-1(1/N sum(weight(note(component)))) Cela revient  faire la moyenne des notes
     * auxquelles on applique la fonction la fonction de pondration weight puis  appliquer la fonction inverse
     */
    // Moyenne des notes : 1/N * sum(weight(note(component))
    float num = 0;
    float denum = 0;
    float average = -1;
    // Interpreteur python
    WeightFunctionInterpreter interpreter = new WeightFunctionInterpreter();
    for (Iterator marksIt = pMarks.iterator(); marksIt.hasNext();) {
        // note(component)
        float mark = ((MarkBO) marksIt.next()).getValue();
        // Si la note sur le composant a t calcul
        if (mark != MarkBO.NOT_NOTED_VALUE) {
            // weigth(note(component))
            float weightMark = interpreter.exec(pPractice.getWeightFunction(), mark);
            num += weightMark;
            denum++;
        }

    }
    if (denum != 0) {
        // Moyenne
        average = num / denum;
        // weight^-1(average)
        Float meanMark = inverse(interpreter, pPractice.getWeightFunction(), average);
        pPracticeResult.setMeanMark(meanMark.floatValue());
    } else {
        LOG.debug(RuleMessages.getString("nocomputation", new Object[] { pPractice.getName() }));
    }
}

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

public Float evaluate(Float a) {
    if (a == null)
        return null;

    Float r = Float.valueOf(-a.floatValue());
    return r;/*w w  w.  java  2s .  co  m*/
}

From source file:com.nextep.designer.Application.java

public Object start(IApplicationContext context) {
    // Adding debug logs here since when we got a configuration problem we fail in these early
    // steps.//from   w w  w  .j a v  a  2  s .c o m
    log.debug("Creating display..."); //$NON-NLS-1$
    Display display = PlatformUI.createDisplay();
    log.debug("Display OK, checking java version..."); //$NON-NLS-1$
    String javaVersion = System.getProperty("java.version"); //$NON-NLS-1$
    Float d = Float.parseFloat(javaVersion.substring(0, 3));
    if (d.floatValue() < 1.6f) {
        MessageDialog.openError(null, DesignerMessages.getString("application.javaTooOldError.title"), //$NON-NLS-1$
                DesignerMessages.getString("application.javaTooOldError.message") + javaVersion + "."); //$NON-NLS-1$ //$NON-NLS-2$
        return IApplication.EXIT_OK;
    }
    try {
        log.debug("Creating workbench..."); //$NON-NLS-1$
        int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
        if (returnCode == PlatformUI.RETURN_RESTART) {
            return IApplication.EXIT_RESTART;
        }
        return IApplication.EXIT_OK;
    } finally {
        display.dispose();
    }
}

From source file:jp.co.acroquest.endosnipe.report.converter.util.calc.FloatCalculator.java

public Object add(Object obj1, Object obj2) {
    Float floatData1 = (Float) obj1;
    Float floatData2 = (Float) obj2;

    return (Object) (new Float((float) (floatData1.floatValue() + floatData2.floatValue())));
}

From source file:jp.co.acroquest.endosnipe.report.converter.util.calc.FloatCalculator.java

public Object div(Object obj1, Object obj2) {
    Float floatData1 = (Float) obj1;
    Float floatData2 = (Float) obj2;

    return (Object) (new Float((float) (floatData1.floatValue() / floatData2.floatValue())));
}

From source file:jp.co.acroquest.endosnipe.report.converter.util.calc.FloatCalculator.java

public Object mul(Object obj1, Object obj2) {
    Float floatData1 = (Float) obj1;
    Float floatData2 = (Float) obj2;

    return (Object) (new Float((float) (floatData1.floatValue() * floatData2.floatValue())));
}

From source file:jp.co.acroquest.endosnipe.report.converter.util.calc.FloatCalculator.java

public Object sub(Object obj1, Object obj2) {
    Float floatData1 = (Float) obj1;
    Float floatData2 = (Float) obj2;

    return (Object) (new Float((float) (floatData1.floatValue() - floatData2.floatValue())));
}

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

public Boolean evaluate(Float i) {
    if (i == null) {
        return null;
    } else {//  www  .  j a  v  a  2 s. c o m
        return Boolean.valueOf(i.floatValue() == 0);
    }
}

From source file:test.functional.TestTCPTransportSample.java

public void doTestStock() throws Exception {
    try {/*from  www  .j  a v  a  2s.  c  o  m*/
        log.info("Testing TCP stock service...");
        GetQuote tester = new GetQuote();
        tester.getQuote(new String[] { "-ltcp://localhost:8088", "XXX" });
        String symbol = "XXX"; // args[0] ;

        EngineConfiguration defaultConfig = (new DefaultEngineConfigurationFactory()).getClientEngineConfig();
        SimpleProvider config = new SimpleProvider(defaultConfig);
        SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender());
        config.deployTransport("tcp", c);

        Service service = new Service(config);

        Call call = (Call) service.createCall();

        call.setTargetEndpointAddress(new URL("tcp://localhost:8088"));
        call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
        call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_FLOAT);

        Object ret = call.invoke("urn:xmltoday-delayed-quotes", "getQuote", new Object[] { symbol });
        if (ret instanceof Float) {
            Float res = (Float) ret;
            assertEquals("TestTCPTransportSample: stock price should be 55.25 +/- 0.000001", res.floatValue(),
                    55.25, 0.000001);
        } else {
            throw new AssertionFailedError("Bad return value from TCP stock test: " + ret);
        }
    }

    //    }
    catch (Exception e) {
        e.printStackTrace();
        throw new AssertionFailedError("Fault returned from TCP stock test: " + e);
    }
}