Example usage for java.lang Double MIN_VALUE

List of usage examples for java.lang Double MIN_VALUE

Introduction

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

Prototype

double MIN_VALUE

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

Click Source Link

Document

A constant holding the smallest positive nonzero value of type double , 2-1074.

Usage

From source file:org.chombo.util.Utility.java

/**
 * @param config//from   ww w  . ja v a 2s .c o  m
 * @param param
 * @param msg
 * @return
 */
public static double assertDoubleConfigParam(Configuration config, String param, String msg) {
    double value = Double.MIN_VALUE;
    String stParamValue = assertStringConfigParam(config, param, msg);
    value = Double.parseDouble(stParamValue);
    return value;
}

From source file:org.esa.nest.gpf.filtering.SpeckleFilterOp.java

/**
 * Get the Frost filtered pixel intensity for pixels in a given rectangular region.
 *
 * @param neighborValues Array holding the pixel values.
 * @param numSamples     The number of samples.
 * @param noDataValue    Place holder for no data value.
 * @param mask           Array holding Frost filter mask values.
 * @return val The Frost filtered value.
 * @throws org.esa.beam.framework.gpf.OperatorException If an error occurs in computation of the Frost filtered value.
 *///from   w ww  .  j  a v  a2 s .com
private double getFrostValue(final double[] neighborValues, final int numSamples, final double noDataValue,
        final double[] mask) {

    final double mean = getMeanValue(neighborValues, numSamples, noDataValue);
    if (mean <= Double.MIN_VALUE) {
        return mean;
    }

    final double var = getVarianceValue(neighborValues, numSamples, mean, noDataValue);
    if (var <= Double.MIN_VALUE) {
        return mean;
    }

    final double k = dampingFactor * var / (mean * mean);

    double sum = 0.0;
    double totalWeight = 0.0;
    for (int i = 0; i < neighborValues.length; i++) {
        if (neighborValues[i] != noDataValue) {
            final double weight = FastMath.exp(-k * mask[i]);
            sum += weight * neighborValues[i];
            totalWeight += weight;
        }
    }
    return sum / totalWeight;
}

From source file:com.apptentive.android.sdk.module.messagecenter.view.MessageCenterActivityContent.java

private boolean addExpectationStatusIfNeeded() {
    ApptentiveMessage apptentiveMessage = null;
    MessageCenterListItem message = messages.get(messages.size() - 1);

    if (message != null && message instanceof ApptentiveMessage) {
        apptentiveMessage = (ApptentiveMessage) message;
    }//from  w w w  . j  a  v  a 2 s  . c  om
    // Check if the last message in the view is a sent message
    if (apptentiveMessage != null && (apptentiveMessage.isOutgoingMessage())) {
        Double createdTime = apptentiveMessage.getCreatedAt();
        if (createdTime != null && createdTime > Double.MIN_VALUE) {
            MessageCenterStatus newItem = interaction.getRegularStatus();
            if (newItem != null && whoCardItem == null && composingItem == null) {
                // Add expectation status message if the last is a sent
                clearStatus();
                statusItem = newItem;
                messages.add(newItem);
                return true;
            }
        }
    }
    return false;
}

From source file:org.colombbus.tangara.Configuration.java

/**
 * Gets the value of a property in a long format
 *
 * @param property/*from w w  w .  j ava2  s  .  c o m*/
 *            name of the property
 * @return the value of the property, or {@link Double#MIN_VALUE} if the
 *         property is not found.
 */
public double getDouble(String property) {
    return getDouble(property, Double.MIN_VALUE);
}

From source file:net.sf.json.TestJSONObject.java

public void testFromObject_use_wrappers() {
    JSONObject json = JSONObject.fromObject(Boolean.TRUE);
    assertTrue(json.isEmpty());//w  ww  .  j a va2s.c  o  m
    json = JSONObject.fromObject(new Byte(Byte.MIN_VALUE));
    assertTrue(json.isEmpty());
    json = JSONObject.fromObject(new Short(Short.MIN_VALUE));
    assertTrue(json.isEmpty());
    json = JSONObject.fromObject(new Integer(Integer.MIN_VALUE));
    assertTrue(json.isEmpty());
    json = JSONObject.fromObject(new Long(Long.MIN_VALUE));
    assertTrue(json.isEmpty());
    json = JSONObject.fromObject(new Float(Float.MIN_VALUE));
    assertTrue(json.isEmpty());
    json = JSONObject.fromObject(new Double(Double.MIN_VALUE));
    assertTrue(json.isEmpty());
    json = JSONObject.fromObject(new Character('A'));
    assertTrue(json.isEmpty());
}

From source file:org.esa.nest.gpf.filtering.SpeckleFilterOp.java

/**
 * Get the Gamma filtered pixel intensity for pixels in a given rectangular region.
 *
 * @param neighborValues Array holding the pixel values.
 * @param numSamples     The number of samples.
 * @param noDataValue    Place holder for no data value.
 * @return val The Gamma filtered value.
 * @throws org.esa.beam.framework.gpf.OperatorException If an error occurs in computation of the Gamma filtered value.
 *//*from   w  w  w.  j  a  va  2 s  .  c  o  m*/
private double getGammaMapValue(final double[] neighborValues, final int numSamples, final double noDataValue,
        final double cu, final double cu2, final double enl) {

    final double mean = getMeanValue(neighborValues, numSamples, noDataValue);
    if (mean <= Double.MIN_VALUE) {
        return mean;
    }

    final double var = getVarianceValue(neighborValues, numSamples, mean, noDataValue);
    if (var <= Double.MIN_VALUE) {
        return mean;
    }

    final double ci = Math.sqrt(var) / mean;
    if (ci <= cu) {
        return mean;
    }

    final double cp = neighborValues[neighborValues.length / 2];

    if (cu < ci) {
        final double cmax = Math.sqrt(2) * cu;
        if (ci < cmax) {
            final double alpha = (1 + cu2) / (ci * ci - cu2);
            final double b = alpha - enl - 1;
            final double d = mean * mean * b * b + 4 * alpha * enl * mean * cp;
            return (b * mean + Math.sqrt(d)) / (2 * alpha);
        }
    }

    return cp;
}

From source file:net.tourbook.photo.ImageGallery.java

/**
 * column: image direction degree/*  w w w.  j  av a  2  s  .  com*/
 */
private void defineColumn_ImageDirectionDegree() {

    final ColumnDefinition colDef = TableColumnFactory.PHOTO_FILE_IMAGE_DIRECTION_DEGREE//
            .createColumn(_columnManager, _pc);

    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Photo photo = (Photo) cell.getElement();
            final double imageDirection = photo.getImageDirection();

            if (imageDirection == Double.MIN_VALUE) {
                cell.setText(UI.EMPTY_STRING);
            } else {
                cell.setText(Integer.toString((int) imageDirection));
            }
        }
    });
}

From source file:org.openmrs.module.appointmentscheduling.api.impl.AppointmentServiceImpl.java

private double[] confidenceInterval(Double[] data) {
    //Empty Dataset
    if (data.length == 0)
        return new double[] { 0.0, 0.0 };

    //Initialization
    double mean = 0;
    int count = data.length;
    int df = count - 1;
    //If Dataset consists of only one item
    if (df == 0)//from  w  w w .  j av  a  2 s  .c  o  m
        return new double[] { Double.MIN_VALUE, Double.MAX_VALUE };

    double alpha = 0.05;
    double tStat = StudentT.tTable(df, alpha);

    //Compute Mean
    for (double val : data)
        mean += val;
    mean = mean / count;

    //Compute Variance
    double variance = 0;
    for (double val : data)
        variance += Math.pow((val - mean), 2);
    variance = variance / df;
    //If deviation is small - Suspected as "Clean of Noise"
    if (Math.sqrt(variance) <= 1)
        return new double[] { Double.MIN_VALUE, Double.MAX_VALUE };

    //Compute Confidence Interval Bounds.
    double[] boundaries = new double[2];
    double factor = tStat * (Math.sqrt(variance) / Math.sqrt(count));
    boundaries[0] = mean - factor;
    boundaries[1] = mean + factor;

    return boundaries;
}

From source file:org.esa.nest.gpf.filtering.SpeckleFilterOp.java

/**
 * Get the Lee filtered pixel intensity for pixels in a given rectangular region.
 *
 * @param neighborValues Array holding the pixel values.
 * @param numSamples     The number of samples.
 * @param noDataValue    Place holder for no data value.
 * @return val The Lee filtered value.//from   www  .  j a  v  a  2s .c o m
 * @throws org.esa.beam.framework.gpf.OperatorException If an error occurs in computation of the Lee filtered value.
 */
private double getLeeValue(final double[] neighborValues, final int numSamples, final double noDataValue,
        final double cu, final double cu2) {

    final double mean = getMeanValue(neighborValues, numSamples, noDataValue);
    if (Double.compare(mean, Double.MIN_VALUE) <= 0) {
        return mean;
    }

    final double var = getVarianceValue(neighborValues, numSamples, mean, noDataValue);
    if (Double.compare(var, Double.MIN_VALUE) <= 0) {
        return mean;
    }

    final double ci = Math.sqrt(var) / mean;
    if (ci < cu) {
        return mean;
    }

    final double cp = neighborValues[neighborValues.length / 2];
    final double w = 1 - cu2 / (ci * ci);

    return cp * w + mean * (1 - w);
}

From source file:main.ScorePipeline.java

/**
 * This method calculates similarities bin-based between yeast_human spectra
 * on the first data set against all yeast spectra on the second data set
 *
 * @param min_mz//  ww w  . ja v  a  2s .  c  om
 * @param max_mz
 * @param topN
 * @param percentage
 * @param yeast_and_human_file
 * @param is_precursor_peak_removal
 * @param fragment_tolerance
 * @param noiseFiltering
 * @param transformation
 * @param intensities_sum_or_mean_or_median
 * @param yeast_spectra
 * @param bw
 * @param charge
 * @param charge_situation
 * @throws IllegalArgumentException
 * @throws ClassNotFoundException
 * @throws IOException
 * @throws MzMLUnmarshallerException
 * @throws NumberFormatException
 * @throws ExecutionException
 * @throws InterruptedException
 */
private static void calculate_BinBasedScoresObsolete_AllTogether(ArrayList<BinMSnSpectrum> yeast_spectra,
        ArrayList<BinMSnSpectrum> yeast_human_spectra, BufferedWriter bw, int charge, double precursorTol,
        double fragTol) throws IllegalArgumentException, ClassNotFoundException, IOException,
        MzMLUnmarshallerException, NumberFormatException, InterruptedException {
    ExecutorService excService = Executors
            .newFixedThreadPool(ConfigHolder.getInstance().getInt("thread.numbers"));
    List<Future<SimilarityResult>> futureList = new ArrayList<>();
    for (BinMSnSpectrum binYeastHumanSp : yeast_human_spectra) {
        int tmpMSCharge = binYeastHumanSp.getSpectrum().getPrecursor().getPossibleCharges().get(0).value;
        if (charge == 0 || tmpMSCharge == charge) {
            if (!binYeastHumanSp.getSpectrum().getPeakList().isEmpty() && !yeast_spectra.isEmpty()) {
                Calculate_Similarity similarity = new Calculate_Similarity(binYeastHumanSp, yeast_spectra,
                        fragTol, precursorTol);
                Future future = excService.submit(similarity);
                futureList.add(future);
            }
        }
    }
    for (Future<SimilarityResult> future : futureList) {
        try {
            SimilarityResult get = future.get();
            String tmp_charge = get.getSpectrumChargeAsString(), spectrum = get.getSpectrumName();
            double tmpPrecMZ = get.getSpectrumPrecursorMZ();
            double dot_product = get.getScores().get(SimilarityMethods.NORMALIZED_DOT_PRODUCT_STANDARD),
                    dot_product_skolow = get.getScores().get(SimilarityMethods.NORMALIZED_DOT_PRODUCT_SOKOLOW),
                    pearson = get.getScores().get(SimilarityMethods.PEARSONS_CORRELATION),
                    spearman = get.getScores().get(SimilarityMethods.SPEARMANS_CORRELATION);
            if (dot_product == Double.MIN_VALUE) {
                LOGGER.info("The similarity for the spectrum " + spectrum
                        + " is too small to keep the record, therefore score is not computed.");
                // Means that score has not been calculated!
                //                    bw.write(tmp_Name + "\t" + tmp_charge + "\t" + tmpPrecMZ + "\t");
                //                    bw.write("NA" + "\t" + "NA" + "\t" + "NA" + "\t" + "NA");
            } else {
                bw.write(spectrum + "\t" + tmp_charge + "\t" + tmpPrecMZ + "\t" + get.getSpectrumToCompare()
                        + "\t");
                bw.write(dot_product + "\t" + dot_product_skolow + "\t" + pearson + "\t" + spearman + "\n");
            }
        } catch (InterruptedException | ExecutionException e) {
            LOGGER.error(e);
        }
    }
}