Example usage for java.lang Double MAX_VALUE

List of usage examples for java.lang Double MAX_VALUE

Introduction

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

Prototype

double MAX_VALUE

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

Click Source Link

Document

A constant holding the largest positive finite value of type double , (2-2-52)·21023.

Usage

From source file:com.redhat.lightblue.metadata.types.BigIntegerTypeTest.java

@Test
public void testEqualsFalse() {
    assertFalse(bigIntegerType.equals(Double.MAX_VALUE));
}

From source file:de.codesourcery.eve.skills.market.impl.MarketLogFile.java

public double getMinPrice(final PriceInfo.Type type, final IMarketLogFilter filter) {

    final double[] minPrice = new double[] { Double.MAX_VALUE };

    visit(new IMarketLogVisitor() {

        @Override//from  w  w w. ja v a 2  s  .c  o  m
        public void visit(MarketLogEntry entry) {
            if (entry.getType().matches(type) && filter.includeInResult(entry)) {
                if (entry.getPrice() < minPrice[0]) {
                    minPrice[0] = entry.getPrice();
                }
            }
        }
    });

    if (minPrice[0] == Double.MAX_VALUE) {
        return 0.0;
    }
    return minPrice[0];
}

From source file:com.espertech.esper.filter.FilterParamIndexRange.java

public final void matchEvent(EventBean eventBean, Collection<FilterHandle> matches,
        ExprEvaluatorContext exprEvaluatorContext) {
    Object objAttributeValue = this.getGetter().get(eventBean);

    if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) {
        log.debug(".match Finding range matches, attribute=" + this.getPropertyName() + "  attrValue="
                + objAttributeValue);/*  w  w w  .  ja  v a2 s .  c  o m*/
    }

    if (objAttributeValue == null) {
        return;
    }

    double attributeValue = ((Number) objAttributeValue).doubleValue();

    DoubleRange rangeStart = new DoubleRange(attributeValue - largestRangeValueDouble, attributeValue);
    DoubleRange rangeEnd = new DoubleRange(attributeValue, Double.MAX_VALUE);

    SortedMap<DoubleRange, EventEvaluator> subMap = ranges.subMap(rangeStart, rangeEnd);

    // For not including either endpoint
    // A bit awkward to duplicate the loop code, however better than checking the boolean many times over
    // This may be a bit of an early performance optimization - the optimizer after all may do this better
    if (this.getFilterOperator() == FilterOperator.RANGE_OPEN) // include neither endpoint
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue > entry.getKey().getMin()) && (attributeValue < entry.getKey().getMax())) {
                entry.getValue().matchEvent(eventBean, matches, exprEvaluatorContext);
            }
        }
    } else if (this.getFilterOperator() == FilterOperator.RANGE_CLOSED) // include all endpoints
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue >= entry.getKey().getMin()) && (attributeValue <= entry.getKey().getMax())) {
                entry.getValue().matchEvent(eventBean, matches, exprEvaluatorContext);
            }
        }
    } else if (this.getFilterOperator() == FilterOperator.RANGE_HALF_CLOSED) // include high endpoint not low endpoint
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue > entry.getKey().getMin()) && (attributeValue <= entry.getKey().getMax())) {
                entry.getValue().matchEvent(eventBean, matches, exprEvaluatorContext);
            }
        }
    } else if (this.getFilterOperator() == FilterOperator.RANGE_HALF_OPEN) // include low endpoint not high endpoint
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue >= entry.getKey().getMin()) && (attributeValue < entry.getKey().getMax())) {
                entry.getValue().matchEvent(eventBean, matches, exprEvaluatorContext);
            }
        }
    } else {
        throw new IllegalStateException("Invalid filter operator " + this.getFilterOperator());
    }
}

From source file:edu.oregonstate.eecs.mcplan.rl.QLearner.java

private A maxA(final TObjectDoubleMap<A> Qfunction) {
    double best = -Double.MAX_VALUE;
    A best_a = null;//from   ww  w  . j  a  va 2s.c  om
    final TObjectDoubleIterator<A> itr = Qfunction.iterator();
    while (itr.hasNext()) {
        itr.advance();
        final double d = itr.value();
        if (d > best) {
            best = d;
            best_a = itr.key();
        }
    }
    return best_a;
}

From source file:com.redhat.lightblue.metadata.types.DoubleTypeTest.java

@Test
public void testCompareNotEqual() {
    assertEquals(doubleType.compare((Object) BigDecimal.ZERO, (Object) Double.MAX_VALUE), -1);
}

From source file:com.basetechnology.s0.agentserver.field.MoneyField.java

public JSONObject toJson() throws JSONException {
    JSONObject json = new JSONObject();
    json.put("type", "money");
    if (symbol.name != null)
        json.put("name", symbol.name);
    if (label != null)
        json.put("label", label);
    if (description != null)
        json.put("description", description);
    if (defaultValue != 0)
        json.put("default_value", defaultValue);
    if (minValue != 0)
        json.put("min_value", minValue);
    if (maxValue != Double.MAX_VALUE)
        json.put("max_value", maxValue);
    if (nominalWidth != 0)
        json.put("nominal_width", nominalWidth);
    if (compute != null)
        json.put("compute", compute);
    return json;//ww  w .  ja v  a2 s  .c  om
}

From source file:com.github.ithildir.airbot.service.impl.AirNowMeasurementServiceImpl.java

private String _getReportingArea(double latitude, double longitude) {
    Location coordinates = new Location(latitude, longitude, "US");

    double distance = Double.MAX_VALUE;
    String reportingArea = null;//from   w ww.  j  av a 2 s . co m

    for (Map.Entry<String, Location> entry : _reportingAreaCoordinates.entrySet()) {

        Location curCoordinates = entry.getValue();

        double curDistance = coordinates.getDistance(curCoordinates);

        if ((reportingArea == null) || (curDistance < distance)) {
            distance = curDistance;
            reportingArea = entry.getKey();
        }
    }

    return reportingArea;
}

From source file:eu.crisis_economics.utilities.EmpiricalDistribution.java

private void reconcileInsertion(double insertionValue) {
    maxRecordValue = -Double.MAX_VALUE;
    minRecordValue = Double.MAX_VALUE;
    Iterator<SortedDatum> it = m_sortedData.iterator();
    while (it.hasNext()) {
        SortedDatum record = it.next();/*from w w  w  . jav  a  2  s.  c om*/
        maxRecordValue = Math.max(record.value, maxRecordValue);
        minRecordValue = Math.min(record.value, minRecordValue);
        if (record.value > insertionValue)
            record.numRecordsLessThan++;
    }
}

From source file:gov.nih.nci.caintegrator.ui.graphing.chart.plot.ClinicalPlot.java

/**
 * Get the range of values for a given clinical factor
 * @param dataPoints//  ww  w.j  a  va 2  s .  c  o m
 * @param factor
 * @return
 */
private DataRange getDataRange(Collection<ClinicalDataPoint> dataPoints2,
        gov.nih.nci.caintegrator.enumeration.ClinicalFactorType factor, boolean onlyIncludePositveValues) {
    double maxValue = Double.MIN_VALUE;
    double minValue = Double.MAX_VALUE;
    double value;
    ClinicalDataPoint dataPoint;
    for (Iterator i = dataPoints.iterator(); i.hasNext();) {
        dataPoint = (ClinicalDataPoint) i.next();
        value = dataPoint.getFactorValue(factor);
        if ((value < minValue) && (value >= 0)) {
            minValue = value;
        }

        if ((value > maxValue) && (value >= 0)) {
            maxValue = value;
        }
    }

    DataRange range = new DataRange(minValue, maxValue);
    return range;
}

From source file:com.espertech.esper.filter.FilterParamIndexNotRange.java

public final void matchEvent(EventBean eventBean, Collection<FilterHandle> matches,
        ExprEvaluatorContext exprEvaluatorContext) {
    Object objAttributeValue = this.getGetter().get(eventBean);

    if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) {
        log.debug(".match Finding range matches, attribute=" + this.getPropertyName() + "  attrValue="
                + objAttributeValue);//from w  w  w. j a  v a 2s .  c  o m
    }

    if (objAttributeValue == null) {
        return;
    }

    double attributeValue = ((Number) objAttributeValue).doubleValue();

    DoubleRange rangeStart = new DoubleRange(attributeValue - largestRangeValueDouble, attributeValue);
    DoubleRange rangeEnd = new DoubleRange(attributeValue, Double.MAX_VALUE);

    SortedMap<DoubleRange, EventEvaluator> subMap = ranges.subMap(rangeStart, rangeEnd);

    // For not including either endpoint
    // A bit awkward to duplicate the loop code, however better than checking the boolean many times over
    // This may be a bit of an early performance optimization - the optimizer after all may do this better
    Set<EventEvaluator> matchingEvals = new HashSet<EventEvaluator>();
    if (this.getFilterOperator() == FilterOperator.NOT_RANGE_OPEN) // include neither endpoint
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue > entry.getKey().getMin()) && (attributeValue < entry.getKey().getMax())) {
                matchingEvals.add(entry.getValue());
            }
        }
    } else if (this.getFilterOperator() == FilterOperator.NOT_RANGE_CLOSED) // include all endpoints
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue >= entry.getKey().getMin()) && (attributeValue <= entry.getKey().getMax())) {
                matchingEvals.add(entry.getValue());
            }
        }
    } else if (this.getFilterOperator() == FilterOperator.NOT_RANGE_HALF_CLOSED) // include high endpoint not low endpoint
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue > entry.getKey().getMin()) && (attributeValue <= entry.getKey().getMax())) {
                matchingEvals.add(entry.getValue());
            }
        }
    } else if (this.getFilterOperator() == FilterOperator.NOT_RANGE_HALF_OPEN) // include low endpoint not high endpoint
    {
        for (Map.Entry<DoubleRange, EventEvaluator> entry : subMap.entrySet()) {
            if ((attributeValue >= entry.getKey().getMin()) && (attributeValue < entry.getKey().getMax())) {
                matchingEvals.add(entry.getValue());
            }
        }
    } else {
        throw new IllegalStateException("Invalid filter operator " + this.getFilterOperator());
    }

    // Now we have all the matching evaluators, invoke all that don't match
    for (EventEvaluator eval : evaluators) {
        if (!matchingEvals.contains(eval)) {
            eval.matchEvent(eventBean, matches, exprEvaluatorContext);
        }
    }
}