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:org.spantus.exp.segment.draw.DrawDtw.java

public DrawDtw(DtwInfo info) {
    this.info = info;
    Double[] minMax = new Double[] { Double.MAX_VALUE, -Double.MAX_VALUE };
    for (List<Double> list : info.getDistanceMatrix()) {
        for (Double float1 : list) {
            minMax[0] = Double.isNaN(float1) ? minMax[0] : Math.min(minMax[0], float1);
            minMax[1] = Double.isNaN(float1) ? minMax[1] : Math.max(minMax[1], float1);
        }//from  w  w w. ja  v  a  2  s.  co m
    }
    this.min = minMax[0];
    this.max = minMax[1];
    log.debug("min: " + min + "; max: " + max);
}

From source file:inflor.core.plots.CategoryResponseChart.java

public JFreeChart createChart(FCSFrame dataFrame) {

    CategoryXYZDataSet categoryData = new CategoryXYZDataSet();
    double zMin = Double.MAX_VALUE;
    double zMax = 1;
    if (dataFrame.getKeywords().containsKey(FCSUtilities.KEY_MERGE_MAP)) {
        String[] mergeMap = dataFrame.getKeywordValue(FCSUtilities.KEY_MERGE_MAP)
                .split(NodeUtilities.DELIMITER_REGEX);
        FCSDimension dim = dataFrame.getDimension(axisName);
        double[] transformedData = transform.transform(dim.getData());
        int perFileSize = dim.getData().length / mergeMap.length;
        for (int i = 0; i < mergeMap.length; i++) {

            double[] unMergedData = new double[perFileSize];
            for (int j = 0; j < unMergedData.length; j++) {
                unMergedData[j] = transformedData[i * unMergedData.length + j];
            }/*  w w  w.java2 s. c  o  m*/
            double tMin = transform.getMinTranformedValue();
            double tMax = transform.getMaxTransformedValue();
            Histogram1D hist = new Histogram1D(unMergedData, tMin, tMax, ChartingDefaults.BIN_COUNT);
            double[] x = hist.getNonZeroX();
            double[] y = new double[x.length];
            for (int j = 0; j < y.length; j++) {
                y[j] = i;
            }
            double[] z = hist.getNonZeroY();
            double currentZMin = Doubles.min(z);
            double currentZMax = Doubles.max(z);
            if (currentZMin < zMin) {
                zMin = currentZMin;
            } else if (currentZMax > zMax) {
                zMax = currentZMax;
            }

            categoryData.addCategoricalSeries(mergeMap[i], x, z);
        }
    } else {
        FCSDimension dim = dataFrame.getDimension(axisName);
        double[] transformedData = transform.transform(dim.getData());
        Histogram1D hist = new Histogram1D(transformedData, transform.getMinTranformedValue(),
                transform.getMaxTransformedValue(), ChartingDefaults.BIN_COUNT);
        double[] x = hist.getNonZeroX();
        double[] y = new double[x.length];
        for (int j = 0; j < y.length; j++) {
            y[j] = 0;
        }
        double[] z = hist.getNonZeroY();
        double currentZMin = Doubles.min(z);
        double currentZMax = Doubles.max(z);
        if (currentZMin < zMin) {
            zMin = currentZMin;
        } else if (currentZMax > zMax) {
            zMax = currentZMax;
        }

        categoryData.addCategoricalSeries(dataFrame.getDisplayName(), x, z);
    }

    ValueAxis domainAxis = PlotUtils.createAxis(axisName, transform);
    NumberAxis rangeAxis = new CategoricalNumberAxis("", categoryData.getLabelMap());
    // Renderer configuration
    XYBlockRenderer renderer = new XYBlockRenderer();
    double xWidth = (transform.getMaxTransformedValue() - transform.getMinTranformedValue())
            / ChartingDefaults.BIN_COUNT;
    renderer.setBlockWidth(xWidth);
    renderer.setBlockHeight(0.5);
    renderer.setBlockAnchor(RectangleAnchor.LEFT);

    PaintScale paintScale = PlotUtils.createPaintScale(zMax, ChartingDefaults.DEFAULT_COLOR_SCHEME);
    renderer.setPaintScale(paintScale);

    // Add to panel.
    XYPlot responsePlot = new XYPlot(categoryData, domainAxis, rangeAxis, renderer);
    JFreeChart chart = new JFreeChart(responsePlot);
    chart.removeLegend();
    return chart;
}

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

@Test
public void testToJson() {
    JsonNodeFactory jsonNodeFactory = new JsonNodeFactory(true);
    JsonNode jsonNode = doubleType.toJson(jsonNodeFactory, Double.MAX_VALUE);
    assertTrue(new Double(jsonNode.asDouble()).equals(Double.MAX_VALUE));
}

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

public MoneyField(SymbolTable symbolTable, String name, String label) {
    this.symbol = new Symbol(symbolTable, name, IntegerTypeNode.one);
    this.label = label;
    minValue = 0;//from   ww  w .j a va  2 s .c o  m
    maxValue = Double.MAX_VALUE;
}

From source file:com.l2jfree.gameserver.instancemanager.CastleManager.java

public final Castle getClosestCastle(L2Object activeObject) {
    Castle castle = getCastle(activeObject);
    if (castle == null) {
        double closestDistance = Double.MAX_VALUE;
        double distance;

        for (Castle castleToCheck : getCastles().values()) {
            if (castleToCheck == null)
                continue;
            distance = castleToCheck.getDistanceToZone(activeObject.getX(), activeObject.getY());
            if (closestDistance > distance) {
                closestDistance = distance;
                castle = castleToCheck;//from  w ww  . j a v  a 2  s  .c  o m
            }
        }
    }
    return castle;
}

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

@Test
public void testToJson() {
    JsonNodeFactory jsonNodeFactory = new JsonNodeFactory(true);
    JsonNode jsonNode = bigDecimalType.toJson(jsonNodeFactory, Double.MAX_VALUE);
    assertTrue(new Double(jsonNode.asDouble()).equals(Double.MAX_VALUE));
}

From source file:ch.ethz.bsse.quasirecomb.model.hmm.EM.java

private void blackbox(Read[] reads, int N, int L, int K, int n) {
    Globals.getINSTANCE().setLOG(new StringBuilder());
    Globals.getINSTANCE().setMAX_LLH(-1);
    Globals.getINSTANCE().setMIN_BIC(Double.MAX_VALUE);
    String pathOptimum = null;/*from  ww  w .  j av a2 s .  c  o  m*/
    if (K == 1 || Globals.getINSTANCE().isFORCE_NO_RECOMB()) {
        Globals.getINSTANCE().setNO_RECOMB(true);
    } else {
        Globals.getINSTANCE().setNO_RECOMB(false);
    }
    if (Globals.getINSTANCE().getOPTIMUM() == null) {
        double maxLLH = Double.NEGATIVE_INFINITY;
        bics = new Double[Globals.getINSTANCE().getREPEATS()];
        double[] bics_local = new double[Globals.getINSTANCE().getREPEATS()];
        for (int i = 0; i < Globals.getINSTANCE().getREPEATS(); i++) {
            SingleEM sem = new SingleEM(N, K, L, n, reads, Globals.getINSTANCE().getDELTA_LLH(), i);
            bics_local[i] = sem.getOptimalResult().getBIC();
            bics[i] = sem.getOptimalResult().getBIC();
            this.maxBIC = Math.max(this.maxBIC, sem.getOptimalResult().getBIC());
            if (sem.getLoglikelihood() > maxLLH) {
                maxLLH = sem.getLoglikelihood();
                pathOptimum = sem.getOptimumPath();
            }
        }
        medianBIC = new Median().evaluate(bics_local);
        lowerBoundBIC = medianBIC
                - new StandardDeviation().evaluate(bics_local) * Math.sqrt(1 + 1d / bics_local.length);
    } else {
        pathOptimum = Globals.getINSTANCE().getOPTIMUM();
    }
    if (Globals.getINSTANCE().isMODELSELECTION()) {
        try {
            FileInputStream fis = new FileInputStream(pathOptimum);
            try (ObjectInputStream in = new ObjectInputStream(fis)) {
                or = (OptimalResult) in.readObject();
            }
        } catch (IOException | ClassNotFoundException ex) {
            System.err.println(ex);
        }
        StatusUpdate.getINSTANCE().printBIC(K, (int) or.getBIC());
    } else {
        try {
            FileInputStream fis = new FileInputStream(pathOptimum);
            try (ObjectInputStream in = new ObjectInputStream(fis)) {
                or = (OptimalResult) in.readObject();
            }
        } catch (IOException | ClassNotFoundException ex) {
            System.err.println(ex);
        }

        StatusUpdate.getINSTANCE().printBIC(K, (int) or.getBIC());
        System.out.print("\n");
        if (!Globals.getINSTANCE().isSUBSAMPLE()) {
            //            Globals.getINSTANCE().setREFINEMENT(true);
            if (!Globals.getINSTANCE().isANNEALING()) {
                SingleEM bestEM = new SingleEM(or, Globals.getINSTANCE().getDELTA_REFINE_LLH(), reads);
                this.or = bestEM.getOptimalResult();
            }
            StatusUpdate.getINSTANCE().printBIC(K, 100, (int) this.or.getBIC());
            if (Globals.getINSTANCE().isLOGGING()) {
                Utils.saveFile(Globals.getINSTANCE().getSAVEPATH() + "support" + File.separator + "log_K" + K,
                        Globals.getINSTANCE().getLOG().toString());
            }
        }
    }
}

From source file:mt.listeners.WriteStatsListener.java

public double leastX(ArrayList<Pair<AbstractFunction2D, ArrayList<PointFunctionMatch>>> segments) {

    // Ignore the event starting from zero time
    double minstartX = Double.MAX_VALUE;

    for (final Pair<AbstractFunction2D, ArrayList<PointFunctionMatch>> result : segments) {

        final Pair<Double, Double> minMax = Tracking.fromTo(result.getB());

        double startX = minMax.getB();

        if (startX <= minstartX) {

            minstartX = startX;/*from  w  ww. j  a  va2 s.  c o  m*/

        }

    }

    return minstartX;

}

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

public final void matchEvent(EventBean theEvent, Collection<FilterHandle> matches) {
    Object objAttributeValue = lookupable.getGetter().get(theEvent);

    if (objAttributeValue == null) {
        return;/*  w w  w.  j  av  a2 s. co m*/
    }

    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(theEvent, matches);
            }
        }
    } 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(theEvent, matches);
            }
        }
    } 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(theEvent, matches);
            }
        }
    } 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(theEvent, matches);
            }
        }
    } else {
        throw new IllegalStateException("Invalid filter operator " + this.getFilterOperator());
    }
}

From source file:Licht.java

/**
 * Erstellt den Szenegraphen/*from  ww  w. ja va2s.c o m*/
 * 
 * @return BranchGroup
 */
public BranchGroup macheSzene() {
    BranchGroup objWurzel = new BranchGroup();
    // Transformation, 2 Rotationen:
    Transform3D drehung = new Transform3D();
    Transform3D drehung2 = new Transform3D();
    drehung.rotX(Math.PI / 4.0d);
    drehung2.rotY(Math.PI / 5.0d);
    drehung.mul(drehung2);
    TransformGroup objDreh = new TransformGroup(drehung);

    Sphere kugel = new Sphere(0.5f, Sphere.GENERATE_NORMALS, 50, makeAppearance());
    objWurzel.addChild(kugel);
    objWurzel.addChild(objDreh);

    //directes Licht
    DirectionalLight d_Licht = new DirectionalLight();
    d_Licht.setInfluencingBounds(new BoundingSphere(new Point3d(0.0d, 0.0d, 0.0d), Double.MAX_VALUE));
    d_Licht.setColor(new Color3f(1.0f, 0.0f, 0.0f));
    Vector3f dir = new Vector3f(1.0f, 2.0f, -1.0f);
    dir.normalize();
    d_Licht.setDirection(dir);
    objWurzel.addChild(d_Licht);

    // ambient Licht
    AmbientLight a_licht = new AmbientLight();
    a_licht.setInfluencingBounds(new BoundingSphere(new Point3d(0.0f, 0.0f, 0.0f), Double.MAX_VALUE));
    a_licht.setColor(new Color3f(1.0f, 0.0f, 0.0f));
    objWurzel.addChild(a_licht);

    return objWurzel;
}