Example usage for java.lang Float MIN_VALUE

List of usage examples for java.lang Float MIN_VALUE

Introduction

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

Prototype

float MIN_VALUE

To view the source code for java.lang Float MIN_VALUE.

Click Source Link

Document

A constant holding the smallest positive nonzero value of type float , 2-149.

Usage

From source file:controle.AgController.java

public Cromossomo getMelhorSolucaoEncontrada() {
    double melhorFit = Float.MIN_VALUE;
    Cromossomo temp = null;//from ww  w .  j  av a 2  s .  co  m
    for (Cromossomo i : ag.getMelhoresIndividuos()) {

        if (i.getFitness() > melhorFit) {
            melhorFit = i.getFitness();
            temp = i;
        }
    }
    return temp;
}

From source file:it.acubelab.batframework.systemPlugins.TagmeAnnotator.java

@Override
public HashSet<Annotation> solveD2W(String text, HashSet<Mention> mentions) {
    return ProblemReduction.Sa2WToD2W(solveSa2W(text), mentions, Float.MIN_VALUE);
}

From source file:com.firefly.sample.castcompanionlibrary.cast.player.VideoCastControllerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.cast_activity);
    loadAndSetupViews();//w w w.j  a v a  2s .  c  om
    mVolumeIncrement = Utils.getFloatFromPreference(this, VideoCastManager.PREFS_KEY_VOLUME_INCREMENT);
    if (mVolumeIncrement == Float.MIN_VALUE) {
        mVolumeIncrement = DEFAULT_VOLUME_INCREMENT;
    }
    try {
        mCastManager = VideoCastManager.getInstance(this);
    } catch (CastException e) {
        // logged already
    }

    setupActionBar();
    Bundle extras = getIntent().getExtras();
    if (null == extras) {
        finish();
        return;
    }

    FragmentManager fm = getSupportFragmentManager();
    mediaAuthFragment = (VideoCastControllerFragment) fm.findFragmentByTag("task");

    // if fragment is null, it means this is the first time, so create it
    if (mediaAuthFragment == null) {
        mediaAuthFragment = VideoCastControllerFragment.newInstance(extras);
        fm.beginTransaction().add(mediaAuthFragment, "task").commit();
        mListener = mediaAuthFragment;
        setOnVideoCastControllerChangedListener(mListener);
    } else {
        mListener = mediaAuthFragment;
        mListener.onConfigurationChanged();
    }
}

From source file:com.google.sample.castcompanionlibrary.cast.player.VideoCastControllerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.cast_activity);
    loadAndSetupViews();/* w  w w  .  j  a v  a 2 s .c o m*/
    mVolumeIncrement = Utils.getFloatFromPreference(this, VideoCastManager.PREFS_KEY_VOLUME_INCREMENT);
    if (mVolumeIncrement == Float.MIN_VALUE) {
        mVolumeIncrement = DEFAULT_VOLUME_INCREMENT;
    }
    try {
        mCastManager = VideoCastManager.getInstance();
    } catch (CastException e) {
        // logged already
        finish();
    }

    setupActionBar();
    Bundle extras = getIntent().getExtras();
    if (null == extras) {
        finish();
        return;
    }

    FragmentManager fm = getSupportFragmentManager();
    mVideoCastControllerFragment = (VideoCastControllerFragment) fm.findFragmentByTag("task");

    // if fragment is null, it means this is the first time, so create it
    if (mVideoCastControllerFragment == null) {
        mVideoCastControllerFragment = VideoCastControllerFragment.newInstance(extras);
        fm.beginTransaction().add(mVideoCastControllerFragment, "task").commit();
        mListener = mVideoCastControllerFragment;
        setOnVideoCastControllerChangedListener(mListener);
    } else {
        mListener = mVideoCastControllerFragment;
        mListener.onConfigurationChanged();
    }
}

From source file:fr.immotronic.ubikit.pems.enocean.impl.item.data.EEP070402DataImpl.java

@Override
public JSONObject toJSON() {
    JSONObject res = new JSONObject();
    JSONObject o = null;// www .  jav a 2  s  .co m

    try {
        if (date == null) {
            res.put("noDataAvailable", true);
            return res;
        }

        long timestamp = date.getTime();

        if (supplyVoltage != Float.MIN_VALUE) {
            o = new JSONObject();
            o.put(JSONValueField.value.name(), supplyVoltage);
            o.put(JSONValueField.uiValue.name(), df.format(supplyVoltage));
            o.put(JSONValueField.unit.name(), " V");
            o.put(JSONValueField.timestamp.name(), timestamp);
            res.put("supplyVoltage", o);
        }

        if (temperature != Float.MIN_VALUE) {
            o = new JSONObject();
            o.put(JSONValueField.value.name(), temperature);
            o.put(JSONValueField.uiValue.name(), df.format(temperature));
            o.put(JSONValueField.unit.name(), " &deg;C");
            o.put(JSONValueField.timestamp.name(), timestamp);
            res.put("temperature", o);
        }

        o = new JSONObject();
        o.put(JSONValueField.value.name(), relativeHumidity);
        o.put(JSONValueField.uiValue.name(), df.format(relativeHumidity));
        o.put(JSONValueField.unit.name(), "%");
        o.put(JSONValueField.timestamp.name(), timestamp);
        res.put("relativeHumidity", o);
    } catch (JSONException e) {
        Logger.error(LC.gi(), this,
                "toJSON(): An exception while building a JSON view of a EnoceanData SHOULD never happen. Check the code !",
                e);
        return null;
    }

    return res;
}

From source file:edu.stanford.slac.archiverappliance.PB.data.StatusSeverityTest.java

private DBR getJCASampleValue(ArchDBRTypes type, int value, int severity, int status) {
    switch (type) {
    case DBR_SCALAR_STRING:
        DBR_TIME_String retvalss = new DBR_TIME_String(new String[] { Integer.toString(value) });
        retvalss.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalss.setSeverity(severity);/* www  .  j ava  2  s .  c  om*/
        retvalss.setStatus(status);
        return retvalss;
    case DBR_SCALAR_SHORT:
        DBR_TIME_Short retvalsh;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvalsh = new DBR_TIME_Short(new short[] { (short) (Short.MIN_VALUE + value) });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvalsh = new DBR_TIME_Short(new short[] { (short) (Short.MAX_VALUE - (value - 1000)) });
        } else {
            // Check for some numbers around 0
            retvalsh = new DBR_TIME_Short(new short[] { (short) (value - 2000) });
        }
        retvalsh.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalsh.setSeverity(severity);
        retvalsh.setStatus(status);
        return retvalsh;
    case DBR_SCALAR_FLOAT:
        DBR_TIME_Float retvalfl;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvalfl = new DBR_TIME_Float(new float[] { Float.MIN_VALUE + value });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvalfl = new DBR_TIME_Float(new float[] { Float.MAX_VALUE - (value - 1000) });
        } else {
            // Check for some numbers around 0. Divide by a large number to make sure we cater to the number of precision digits
            retvalfl = new DBR_TIME_Float(new float[] { (value - 2000.0f) / value });
        }
        retvalfl.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalfl.setSeverity(severity);
        retvalfl.setStatus(status);
        return retvalfl;
    case DBR_SCALAR_ENUM:
        DBR_TIME_Enum retvalen;
        retvalen = new DBR_TIME_Enum(new short[] { (short) (value) });
        retvalen.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalen.setSeverity(severity);
        retvalen.setStatus(status);
        return retvalen;
    case DBR_SCALAR_BYTE:
        DBR_TIME_Byte retvalby;
        retvalby = new DBR_TIME_Byte(new byte[] { ((byte) (value % 255)) });
        retvalby.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalby.setSeverity(severity);
        retvalby.setStatus(status);
        return retvalby;
    case DBR_SCALAR_INT:
        DBR_TIME_Int retvalint;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvalint = new DBR_TIME_Int(new int[] { Integer.MIN_VALUE + value });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvalint = new DBR_TIME_Int(new int[] { Integer.MAX_VALUE - (value - 1000) });
        } else {
            // Check for some numbers around 0
            retvalint = new DBR_TIME_Int(new int[] { (value - 2000) });
        }
        retvalint.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalint.setSeverity(severity);
        retvalint.setStatus(status);
        return retvalint;
    case DBR_SCALAR_DOUBLE:
        DBR_TIME_Double retvaldb;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvaldb = new DBR_TIME_Double(new double[] { (Double.MIN_VALUE + value) });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvaldb = new DBR_TIME_Double(new double[] { (Double.MAX_VALUE - (value - 1000)) });
        } else {
            // Check for some numbers around 0. Divide by a large number to make sure we cater to the number of precision digits
            retvaldb = new DBR_TIME_Double(new double[] { ((value - 2000.0) / (value * 1000000)) });
        }
        retvaldb.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvaldb.setSeverity(severity);
        retvaldb.setStatus(status);
        return retvaldb;
    case DBR_WAVEFORM_STRING:
        DBR_TIME_String retvst;
        // Varying number of copies of a typical value
        retvst = new DBR_TIME_String(
                Collections.nCopies(value, Integer.toString(value)).toArray(new String[0]));
        retvst.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvst.setSeverity(severity);
        retvst.setStatus(status);
        return retvst;
    case DBR_WAVEFORM_SHORT:
        DBR_TIME_Short retvsh;
        retvsh = new DBR_TIME_Short(
                ArrayUtils.toPrimitive(Collections.nCopies(1, (short) value).toArray(new Short[0])));
        retvsh.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvsh.setSeverity(severity);
        retvsh.setStatus(status);
        return retvsh;
    case DBR_WAVEFORM_FLOAT:
        DBR_TIME_Float retvf;
        // Varying number of copies of a typical value
        retvf = new DBR_TIME_Float(ArrayUtils.toPrimitive(
                Collections.nCopies(value, (float) Math.cos(value * Math.PI / 3600)).toArray(new Float[0])));
        retvf.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvf.setSeverity(severity);
        retvf.setStatus(status);
        return retvf;
    case DBR_WAVEFORM_ENUM:
        DBR_TIME_Enum retven;
        retven = new DBR_TIME_Enum(
                ArrayUtils.toPrimitive(Collections.nCopies(1024, (short) value).toArray(new Short[0])));
        retven.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retven.setSeverity(severity);
        retven.setStatus(status);
        return retven;
    case DBR_WAVEFORM_BYTE:
        DBR_TIME_Byte retvb;
        // Large number of elements in the array
        retvb = new DBR_TIME_Byte(ArrayUtils
                .toPrimitive(Collections.nCopies(65536 * value, ((byte) (value % 255))).toArray(new Byte[0])));
        retvb.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvb.setSeverity(severity);
        retvb.setStatus(status);
        return retvb;
    case DBR_WAVEFORM_INT:
        DBR_TIME_Int retvint;
        // Varying number of copies of a typical value
        retvint = new DBR_TIME_Int(
                ArrayUtils.toPrimitive(Collections.nCopies(value, value * value).toArray(new Integer[0])));
        retvint.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvint.setSeverity(severity);
        retvint.setStatus(status);
        return retvint;
    case DBR_WAVEFORM_DOUBLE:
        DBR_TIME_Double retvd;
        // Varying number of copies of a typical value
        retvd = new DBR_TIME_Double(ArrayUtils.toPrimitive(
                Collections.nCopies(value, Math.sin(value * Math.PI / 3600)).toArray(new Double[0])));
        retvd.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvd.setSeverity(severity);
        retvd.setStatus(status);
        return retvd;
    case DBR_V4_GENERIC_BYTES:
        throw new RuntimeException("Currently don't support " + type + " when generating sample data");
    default:
        throw new RuntimeException("We seemed to have missed a DBR type when generating sample data");
    }
}

From source file:MSUmpire.SpectrumParser.mzXMLReadUnit.java

public ScanData Parse() throws ParserConfigurationException, SAXException, IOException, DataFormatException {
    if (XMLtext.replaceFirst("</scan>", "").contains("</scan>")) {
        XMLtext = XMLtext.replaceFirst("</scan>", "");
    }/*  ww  w .  j  a  va2s .co  m*/
    if (!XMLtext.contains("</scan>")) {
        XMLtext += "</scan>";
    }
    ScanData scan = new ScanData();
    final DocumentBuilder docBuilder = tls.get();
    docBuilder.reset();
    InputSource input = new InputSource(new StringReader(XMLtext));
    Document doc = null;
    try {
        doc = docBuilder.parse(input);
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        Logger.getRootLogger().error(XMLtext);
    }
    Node root = doc.getFirstChild();
    for (int i = 0; i < root.getAttributes().getLength(); i++) {
        switch (root.getAttributes().item(i).getNodeName()) {
        case ("num"):
            scan.ScanNum = Integer.parseInt(root.getAttributes().item(i).getNodeValue());
            break;
        case ("centroided"): {
            if ("1".equals(root.getAttributes().item(i).getNodeValue())) {
                scan.centroided = true;
            } else {
                scan.centroided = false;
            }
            break;
        }
        case ("msLevel"):
            scan.MsLevel = Integer.parseInt(root.getAttributes().item(i).getNodeValue());
            break;
        case ("scanType"):
            scan.scanType = root.getAttributes().item(i).getNodeValue();
            break;
        case ("peaksCount"):
            scan.PeaksCountString = Integer.parseInt(root.getAttributes().item(i).getNodeValue());
            break;
        case ("retentionTime"):
            scan.RetentionTime = Float.parseFloat(root.getAttributes().item(i).getNodeValue().substring(2,
                    root.getAttributes().item(i).getNodeValue().indexOf("S"))) / 60f;
            break;
        case ("lowMz"): {
            String value = root.getAttributes().item(i).getNodeValue();
            if ("inf".equals(value)) {
                value = String.valueOf(Float.MIN_VALUE);
            }
            scan.StartMz = Float.parseFloat(value);
            break;
        }
        case ("highMz"): {
            String value = root.getAttributes().item(i).getNodeValue();
            if ("inf".equals(value)) {
                value = String.valueOf(Float.MAX_VALUE);
            }
            scan.EndMz = Float.parseFloat(value);
            break;
        }
        case ("startMz"):
            scan.StartMz = Float.parseFloat(root.getAttributes().item(i).getNodeValue());
            break;
        case ("endMz"): {
            String value = root.getAttributes().item(i).getNodeValue();
            if ("inf".equals(value)) {
                value = String.valueOf(Float.MAX_VALUE);
            }
            scan.EndMz = Float.parseFloat(value);
            break;
        }
        case ("basePeakMz"): {
            String value = root.getAttributes().item(i).getNodeValue();
            if ("inf".equals(value)) {
                value = String.valueOf(Float.MAX_VALUE);
            }
            scan.BasePeakMz = Float.parseFloat(value);
            break;
        }
        case ("basePeakIntensity"):
            scan.BasePeakIntensity = Float.parseFloat(root.getAttributes().item(i).getNodeValue());
            break;
        case ("totIonCurrent"):
            scan.SetTotIonCurrent(Float.parseFloat(root.getAttributes().item(i).getNodeValue()));
            break;
        }
    }
    for (int i = 0; i < root.getChildNodes().getLength(); i++) {
        Node childNode = root.getChildNodes().item(i);
        switch (childNode.getNodeName()) {
        case ("precursorMz"): {
            scan.PrecursorMz = Float.parseFloat(childNode.getTextContent());
            for (int j = 0; j < childNode.getAttributes().getLength(); j++) {
                switch (childNode.getAttributes().item(j).getNodeName()) {
                case ("precursorScanNum"):
                    scan.precursorScanNum = Integer.parseInt(childNode.getAttributes().item(j).getNodeValue());
                    break;
                case ("precursorIntensity"):
                    scan.PrecursorIntensity = Float
                            .parseFloat(childNode.getAttributes().item(j).getNodeValue());
                    break;
                case ("precursorCharge"):
                    scan.PrecursorCharge = Integer.parseInt(childNode.getAttributes().item(j).getNodeValue());
                    break;
                case ("activationMethod"):
                    scan.ActivationMethod = childNode.getAttributes().item(j).getNodeValue();
                    break;
                case ("windowWideness"):
                    scan.windowWideness = Float.parseFloat(childNode.getAttributes().item(j).getNodeValue());
                    break;
                }
            }
            break;
        }
        case ("peaks"): {
            for (int j = 0; j < childNode.getAttributes().getLength(); j++) {
                switch (childNode.getAttributes().item(j).getNodeName()) {
                case ("compressionType"):
                    scan.compressionType = childNode.getAttributes().item(j).getNodeValue();
                    break;
                case ("precision"):
                    scan.precision = Integer.parseInt(childNode.getAttributes().item(j).getNodeValue());
                    break;
                }
            }
            ParsePeakString(scan, childNode.getTextContent());
            break;
        }
        }
        childNode = null;
    }
    if ("calibration".equals(scan.scanType)) {
        scan.MsLevel = -1;
    }
    XMLtext = null;
    scan.Data.Finalize();
    return scan;
}

From source file:org.openmicroscopy.shoola.util.ui.NumericalTextField.java

/**
 * Checks if the value is correct.// w  w  w .j  av  a2s.c o m
 *
 * @return See above.
 */
private String checkValue() {
    String str = getText();
    try {
        if (Integer.class.equals(numberType)) {
            int m = (int) getMinimum();
            if (StringUtils.isBlank(str)) {
                return "" + m;
            }
            int val = Integer.parseInt(str);
            if (val < m)
                return "" + m;
        } else if (Double.class.equals(numberType)) {
            Double min = getMinimum();
            if (StringUtils.isBlank(str)) {
                return "" + min;
            }
            double val = Double.parseDouble(str);
            if (val < min && !min.equals(Double.MIN_VALUE)) {
                return "" + min;
            }
        } else if (Long.class.equals(numberType)) {
            Long min = new Long((long) getMinimum());
            if (StringUtils.isBlank(str)) {
                return "" + min;
            }
            long val = Long.parseLong(str);
            if (val < min && !min.equals(Long.MIN_VALUE)) {
                return "" + min;
            }
        } else if (Float.class.equals(numberType)) {
            Float min = new Float(getMinimum());
            if (StringUtils.isBlank(str)) {
                return "" + min;
            }
            float val = Float.parseFloat(str);
            if (val < min && !min.equals(Float.MIN_VALUE)) {
                return "" + min;
            }
        }
    } catch (NumberFormatException nfe) {
    }
    return str;
}

From source file:org.mariotaku.twidere.view.ExtendedRecyclerView.java

/**
 * Ported from View.getVerticalScrollFactor.
 *///from ww w .j  av a2 s.  c o  m
private float getScrollFactorBackport() {
    if (mScrollFactor == Float.MIN_VALUE) {
        TypedValue outValue = new TypedValue();
        if (getContext().getTheme().resolveAttribute(android.R.attr.listPreferredItemHeight, outValue, true)) {
            mScrollFactor = outValue.getDimension(getContext().getResources().getDisplayMetrics());
        } else {
            return 0; //listPreferredItemHeight is not defined, no generic scrolling
        }

    }
    return mScrollFactor;
}

From source file:org.esa.s1tbx.ocean.toolviews.polarview.SpectraDataSentinel1.java

public PolarData getPolarData(final int currentRec, final SpectraUnit spectraUnit) throws Exception {
    final boolean realBand = spectraUnit != SpectraUnit.IMAGINARY;
    spectrum = getSpectrum(currentRec, realBand);

    if (waveProductType == WaveProductType.WAVE_SPECTRA) {
        minValue = Float.MAX_VALUE;
        maxValue = Float.MIN_VALUE;
        for (int i = 0; i < spectrum.length; i++) {
            for (int j = 0; j < spectrum[0].length; j++) {
                float val = spectrum[i][j];
                if (spectraUnit == SpectraUnit.INTENSITY) {
                    val *= val;
                }/*from   ww w  .  j a  va 2 s.  c  om*/
                spectrum[i][j] = val;
                minValue = Math.min(minValue, val);
                maxValue = Math.max(maxValue, val);
            }
        }
    } else if (waveProductType == WaveProductType.CROSS_SPECTRA) {
        if (spectraUnit == SpectraUnit.AMPLITUDE || spectraUnit == SpectraUnit.INTENSITY) {
            // complex data
            final float imagSpectrum[][] = getSpectrum(currentRec, false);
            minValue = Float.MAX_VALUE;
            maxValue = Float.MIN_VALUE;
            for (int i = 0; i < spectrum.length; i++) {
                for (int j = 0; j < spectrum[0].length; j++) {
                    final float realVal = spectrum[i][j];
                    final float imagVal = imagSpectrum[i][j];
                    float val;
                    if (sign(realVal) == sign(imagVal)) {
                        val = realVal * realVal + imagVal * imagVal;
                    } else {
                        val = 0.0F;
                    }
                    if (spectraUnit == SpectraUnit.AMPLITUDE) {
                        val = (float) Math.sqrt(val);
                    }
                    spectrum[i][j] = val;
                    minValue = Math.min(minValue, val);
                    maxValue = Math.max(maxValue, val);
                }
            }
        }
    }

    final float rStep = (float) (Math.log(lastWLBin) - Math.log(firstWLBin)) / (float) (numWLBins - 1);
    double logr = Math.log(firstWLBin) - (rStep / 2.0);

    final float thFirst = firstDirBins + 5f;
    final float thStep = -dirBinStep;

    final float radii[] = new float[spectrum[0].length + 1];
    for (int j = 0; j <= spectrum[0].length; j++) {
        radii[j] = (float) (10000.0 / FastMath.exp(logr));
        logr += rStep;
    }

    return new PolarData(spectrum, 90f + thFirst, thStep, radii, minValue, maxValue);
}