Example usage for java.lang Double isInfinite

List of usage examples for java.lang Double isInfinite

Introduction

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

Prototype

public boolean isInfinite() 

Source Link

Document

Returns true if this Double value is infinitely large in magnitude, false otherwise.

Usage

From source file:org.gofleet.openLS.ddbb.dao.postgis.PostGisHBRoutingDAO.java

private RouteSummaryType getRouteSummary(Double cost) {
    RouteSummaryType res = new RouteSummaryType();
    DistanceType coste = new DistanceType();
    if (cost.isInfinite() || cost.isNaN())
        coste.setValue(BigDecimal.valueOf(0d));
    else/* w w w  .  j  a  va  2 s .  c o  m*/
        coste.setValue(BigDecimal.valueOf(cost));
    res.setTotalDistance(coste);
    return res;
}

From source file:org.tsho.dmc2.core.chart.BasinRenderer.java

public boolean isPointInfinite(double[] p) {
    Double a0 = new Double(p[0]);
    Double a1 = new Double(p[1]);
    if (a0.isInfinite() || a1.isInfinite() || a0.isNaN() || a1.isNaN() || Math.abs(p[0]) > infinity
            || Math.abs(p[1]) > infinity)
        return true;
    else// w ww .j a va 2 s. co m
        return false;
}

From source file:gda.device.detector.countertimer.TFGScalerWithRatio.java

@Override
public double[] readout() throws DeviceException {
    double[] output = super.readout();

    if (getDarkCurrent() != null) {
        output = adjustForDarkCurrent(output, getCollectionTime());
    }/*from  ww  w  . j  a  va2  s  .com*/

    if (outputRatio) {
        Double ratio = new Double(0);
        // find which col is which I0, It and Iref
        Double[] values = getI0It(output);

        ratio = values[1] / values[0];

        // always return a numerical value
        if (ratio.isInfinite() || ratio.isNaN()) {
            ratio = 0.0;
        }

        // append to output array
        output = correctCounts(output, values);
        output = ArrayUtils.add(output, ratio);
    }
    return output;
}

From source file:org.spantus.math.dtw.abeel.dtw.AbeelDTW.java

private static DtwCalculationCtx extractConstraintValues(Map<Pair<Integer, Integer>, Double> localConstraints,
        CostMatrix costMatrix) {// ww  w.  java2s  .c o m

    if (localConstraints == null) {
        return null;
    }

    Double minValue = null;
    Pair<Integer, Integer> minPair = null;
    Map<Pair<Integer, Integer>, Double> localValues = new HashMap<Pair<Integer, Integer>, Double>();
    for (Entry<Pair<Integer, Integer>, Double> pairEntry : localConstraints.entrySet()) {
        Pair<Integer, Integer> pair = pairEntry.getKey();
        Double cost = costMatrix.get(pair.fst(), pair.snd());
        debug("[extractConstraintValues] pair:{0}; cost: {1};", pair, cost);
        localValues.put(pair, cost);
        if (minPair == null) {
            minPair = pair;
            minValue = cost;
        }
        //if atleast one [0;0] item in the list this will always win.
        if (pair.fst() == 0 && pair.snd() == 0) {
            minPair = pair;
            minValue = cost;
            break;
        }
        if (minValue > cost) {
            minPair = pair;
            minValue = cost;
        }
    }
    //      System.out.println("[createCostMatrix]minPair: " +minPair);
    if (minValue != null && minValue.isInfinite()) {
        //         System.out.println("Infinity");
    }
    DtwCalculationCtx ctx = new DtwCalculationCtx(localValues, minPair);
    return ctx;
}

From source file:fr.ens.transcriptome.aozan.util.StatisticsUtils.java

/**
 * Add values in dataset./*from w ww. j  ava 2 s . com*/
 * @param number new values to put in dataset
 */
public void addValues(final Number number) {
    final Double val = number.doubleValue();

    if (val != null) {
        if (!val.isInfinite()) {
            this.ds.addValue(val);
        }
    }
}

From source file:org.apache.solr.handler.component.RatiosComponent.java

private OpenBitSet filter(Map<String, Double> dimensions1, Map<String, Double> dimensions2, double min,
        double max) {

    OpenBitSet ratios = new OpenBitSet();

    for (String id : dimensions1.keySet()) {
        Double a = dimensions1.get(id);
        Double b = dimensions2.get(id);
        if (a == null || a.isInfinite() || a.isNaN()) {
            continue;
        }//from w  ww.ja va  2 s.c  o m
        if (b == null || b.isInfinite() || b.isNaN() || b == 0) {
            continue;
        }
        Double r = a / b;
        if (r < min || r > max) {
            continue;
        }

        ratios.set(Long.parseLong(id));
    }

    return ratios;
}

From source file:fr.ens.transcriptome.aozan.util.StatisticsUtils.java

/**
 * Public constructor, build a list of values used for compute statistics.
 * Infinity values are ignored.//from  w w w  .  ja  v a  2s  .  c o  m
 * @param list values
 */
public StatisticsUtils(final List<? extends Number> list) {

    this.ds = new DescriptiveStatistics();

    for (final Number n : list) {
        final Double val = n.doubleValue();

        if (val != null) {
            if (!val.isInfinite()) {
                this.ds.addValue(val);
            }
        }

    }
}

From source file:net.grinder.SingleConsole.java

private static Object getRealDoubleValue(Double doubleValue) {
    if (doubleValue == null) {
        return (double) 0;
    }//  w  ww  .  j  a va2 s.  c om
    return (doubleValue.isInfinite() || doubleValue.isNaN()) ? (double) 0 : doubleValue;
}

From source file:org.hawkular.alerts.engine.util.NelsonData.java

private boolean isValid(Double d) {
    return null != d && !d.isNaN() && !d.isInfinite();
}

From source file:org.locationtech.udig.processingtoolbox.tools.BoxPlotDialog.java

private BoxAndWhiskerCategoryDataset getDataset(SimpleFeatureCollection features, String[] fields) {
    minMaxVisitor.reset();/*from w  ww  .j av  a  2  s. c o m*/

    Expression[] expression = new Expression[fields.length];
    Map<String, List<Double>> listMap = new TreeMap<String, List<Double>>();
    for (int index = 0; index < expression.length; index++) {
        expression[index] = ff.property(fields[index]);
        listMap.put(fields[index], new ArrayList<Double>());
    }

    SimpleFeatureIterator featureIter = features.features();
    try {
        while (featureIter.hasNext()) {
            SimpleFeature feature = featureIter.next();
            for (int index = 0; index < expression.length; index++) {
                Double val = expression[index].evaluate(feature, Double.class);
                if (val == null || val.isNaN() || val.isInfinite()) {
                    continue;
                }
                minMaxVisitor.visit(val, val);
                listMap.get(fields[index]).add(val);
            }
        }
    } finally {
        featureIter.close();
    }

    DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
    for (int index = 0; index < fields.length; index++) {
        dataset.add(listMap.get(fields[index]), "Series1", fields[index]); //$NON-NLS-1$
    }
    return dataset;
}