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:mastermind.RandomGenerator.java

public double getSecureRandomDouble() {
    return getSecureRandomDouble(Double.MIN_VALUE, Double.MAX_VALUE);
}

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

/**
 * Checks if the value is correct./*from www .  j  av  a 2 s  .  com*/
 *
 * @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:com.basetechnology.s0.agentserver.field.FloatField.java

public JSONObject toJson() throws JSONException {
    JSONObject json = new JSONObject();
    json.put("type", "float");
    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 != Double.MIN_VALUE)
        json.put("min_value", minValue);
    if (minValue != 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;/*w ww . j a  v a 2 s . com*/
}

From source file:org.apache.hadoop.hive.accumulo.AccumuloTestSetup.java

protected void createAccumuloTable(Connector conn)
        throws TableExistsException, TableNotFoundException, AccumuloException, AccumuloSecurityException {
    TableOperations tops = conn.tableOperations();
    if (tops.exists(TABLE_NAME)) {
        tops.delete(TABLE_NAME);/*from  ww w .  j  a  v a 2 s.com*/
    }

    tops.create(TABLE_NAME);

    boolean[] booleans = new boolean[] { true, false, true };
    byte[] bytes = new byte[] { Byte.MIN_VALUE, -1, Byte.MAX_VALUE };
    short[] shorts = new short[] { Short.MIN_VALUE, -1, Short.MAX_VALUE };
    int[] ints = new int[] { Integer.MIN_VALUE, -1, Integer.MAX_VALUE };
    long[] longs = new long[] { Long.MIN_VALUE, -1, Long.MAX_VALUE };
    String[] strings = new String[] { "Hadoop, Accumulo", "Hive", "Test Strings" };
    float[] floats = new float[] { Float.MIN_VALUE, -1.0F, Float.MAX_VALUE };
    double[] doubles = new double[] { Double.MIN_VALUE, -1.0, Double.MAX_VALUE };
    HiveDecimal[] decimals = new HiveDecimal[] { HiveDecimal.create("3.14159"), HiveDecimal.create("2.71828"),
            HiveDecimal.create("0.57721") };
    Date[] dates = new Date[] { Date.valueOf("2014-01-01"), Date.valueOf("2014-03-01"),
            Date.valueOf("2014-05-01") };
    Timestamp[] timestamps = new Timestamp[] { new Timestamp(50), new Timestamp(100), new Timestamp(150) };

    BatchWriter bw = conn.createBatchWriter(TABLE_NAME, new BatchWriterConfig());
    final String cf = "cf";
    try {
        for (int i = 0; i < 3; i++) {
            Mutation m = new Mutation("key-" + i);
            m.put(cf, "cq-boolean", Boolean.toString(booleans[i]));
            m.put(cf.getBytes(), "cq-byte".getBytes(), new byte[] { bytes[i] });
            m.put(cf, "cq-short", Short.toString(shorts[i]));
            m.put(cf, "cq-int", Integer.toString(ints[i]));
            m.put(cf, "cq-long", Long.toString(longs[i]));
            m.put(cf, "cq-string", strings[i]);
            m.put(cf, "cq-float", Float.toString(floats[i]));
            m.put(cf, "cq-double", Double.toString(doubles[i]));
            m.put(cf, "cq-decimal", decimals[i].toString());
            m.put(cf, "cq-date", dates[i].toString());
            m.put(cf, "cq-timestamp", timestamps[i].toString());

            bw.addMutation(m);
        }
    } finally {
        bw.close();
    }
}

From source file:ai.grakn.graql.internal.analytics.GraknMapReduce.java

final Number minValue() {
    return usingLong() ? Long.MIN_VALUE : Double.MIN_VALUE;
}

From source file:peakml.util.jfreechart.FastTimePlot.java

public void clear() {
    xmin = Double.MAX_VALUE;//from  www  . j  av a2 s.c o  m
    xmax = Double.MIN_VALUE;
    ymin = Double.MAX_VALUE;
    ymax = Double.MIN_VALUE;
    dataseries.clear();

    this.fireChangeEvent();
}

From source file:org.openmicroscopy.shoola.util.file.modulo.ModuloParser.java

/** 
 * Creates a concrete <code>ModuloInfo</code> object to handle the
 * conversion of the content of the passed tag into an object. 
 *
 * @param tag DOM node representing either a <i>modulo</i> tag.
 * @return See above.//from   w w w  .  java  2s . c o  m
 * @throws Exception If the tag couldn't be handled.
 */
ModuloInfo createModuloFor(Node tag) throws Exception {
    if (!tag.hasAttributes())
        throw new Exception("Missing tag's attributes.");
    ModuloInfo info = new ModuloInfo(tag.getNodeName());
    NamedNodeMap attributes = tag.getAttributes();
    Node attribute;
    for (int i = 0; i < attributes.getLength(); ++i) {
        attribute = attributes.item(i);
        if (ModuloInfo.START.equals(attribute.getNodeName()))
            info.setStart(Double.parseDouble(attribute.getNodeValue()));
        else if (ModuloInfo.END.equals(attribute.getNodeName()))
            info.setEnd(Double.parseDouble(attribute.getNodeValue()));
        else if (ModuloInfo.STEP.equals(attribute.getNodeName()))
            info.setStep(Double.parseDouble(attribute.getNodeValue()));
        else if (ModuloInfo.TYPE.equals(attribute.getNodeName()))
            info.setType(attribute.getNodeValue());
        else if (ModuloInfo.TYPE_DESCRIPTION.equals(attribute.getNodeName()))
            info.setTypeDescription(attribute.getNodeValue());
        else if (ModuloInfo.UNIT.equals(attribute.getNodeName()))
            info.setUnit(attribute.getNodeValue());
    }
    NodeList nodes = tag.getChildNodes();
    Double min = Double.MAX_VALUE;
    Double max = Double.MIN_VALUE;
    Double v;
    List<Double> labels = new ArrayList<Double>();
    for (int i = 0; i < nodes.getLength(); i++) {
        attribute = nodes.item(i);
        if (attribute.getNodeType() == Node.ELEMENT_NODE) {
            if (ModuloInfo.LABEL.equals(attribute.getNodeName())) {
                v = Double.parseDouble(attribute.getFirstChild().getNodeValue());
                if (v < min)
                    min = v;
                if (v > max)
                    max = v;
                labels.add(v);
            }
        }
    }
    if (!CollectionUtils.isEmpty(labels)) {
        info.setStart(min);
        info.setEnd(max);
        info.setLabels(labels);
    }

    return info;
}

From source file:com.opensymphony.xwork2.conversion.impl.NumberConverterTest.java

public void testStringToDoubleConversionPL() throws Exception {
    // given//from w ww  . j av a  2 s .c om
    NumberConverter converter = new NumberConverter();
    Map<String, Object> context = new HashMap<>();
    context.put(ActionContext.LOCALE, new Locale("pl", "PL"));

    // when has max fraction digits
    Object value = converter.convertValue(context, null, null, null, "0," + StringUtils.repeat('0', 323) + "49",
            Double.class);

    // then does not lose fraction digits
    assertEquals(Double.MIN_VALUE, value);

    // when has max integer digits
    value = converter.convertValue(context, null, null, null,
            "17976931348623157" + StringUtils.repeat('0', 292) + ",0", Double.class);

    // then does not lose integer digits
    assertEquals(Double.MAX_VALUE, value);
}

From source file:org.elasticsearch.client.RankEvalIT.java

/**
 * Test cases retrieves all six documents indexed above and checks the Prec@10
 * calculation where all unlabeled documents are treated as not relevant.
 *//*  w w  w.  jav a2  s. c  o m*/
public void testRankEvalRequest() throws IOException {
    SearchSourceBuilder testQuery = new SearchSourceBuilder();
    testQuery.query(new MatchAllQueryBuilder());
    List<RatedDocument> amsterdamRatedDocs = createRelevant("index", "2", "3", "4", "5");
    amsterdamRatedDocs.addAll(createRelevant("index2", "7"));
    RatedRequest amsterdamRequest = new RatedRequest("amsterdam_query", amsterdamRatedDocs, testQuery);
    RatedRequest berlinRequest = new RatedRequest("berlin_query", createRelevant("index", "1"), testQuery);
    List<RatedRequest> specifications = new ArrayList<>();
    specifications.add(amsterdamRequest);
    specifications.add(berlinRequest);
    PrecisionAtK metric = new PrecisionAtK(1, false, 10);
    RankEvalSpec spec = new RankEvalSpec(specifications, metric);

    RankEvalRequest rankEvalRequest = new RankEvalRequest(spec, new String[] { "index", "index2" });
    RankEvalResponse response = execute(rankEvalRequest, highLevelClient()::rankEval,
            highLevelClient()::rankEvalAsync);
    // the expected Prec@ for the first query is 5/7 and the expected Prec@ for the second is 1/7, divided by 2 to get the average
    double expectedPrecision = (1.0 / 7.0 + 5.0 / 7.0) / 2.0;
    assertEquals(expectedPrecision, response.getEvaluationResult(), Double.MIN_VALUE);
    Map<String, EvalQueryQuality> partialResults = response.getPartialResults();
    assertEquals(2, partialResults.size());
    EvalQueryQuality amsterdamQueryQuality = partialResults.get("amsterdam_query");
    assertEquals(2, filterUnknownDocuments(amsterdamQueryQuality.getHitsAndRatings()).size());
    List<RatedSearchHit> hitsAndRatings = amsterdamQueryQuality.getHitsAndRatings();
    assertEquals(7, hitsAndRatings.size());
    for (RatedSearchHit hit : hitsAndRatings) {
        String id = hit.getSearchHit().getId();
        if (id.equals("1") || id.equals("6")) {
            assertFalse(hit.getRating().isPresent());
        } else {
            assertEquals(1, hit.getRating().get().intValue());
        }
    }
    EvalQueryQuality berlinQueryQuality = partialResults.get("berlin_query");
    assertEquals(6, filterUnknownDocuments(berlinQueryQuality.getHitsAndRatings()).size());
    hitsAndRatings = berlinQueryQuality.getHitsAndRatings();
    assertEquals(7, hitsAndRatings.size());
    for (RatedSearchHit hit : hitsAndRatings) {
        String id = hit.getSearchHit().getId();
        if (id.equals("1")) {
            assertEquals(1, hit.getRating().get().intValue());
        } else {
            assertFalse(hit.getRating().isPresent());
        }
    }

    // now try this when test2 is closed
    client().performRequest("POST", "index2/_close", Collections.emptyMap());
    rankEvalRequest.indicesOptions(
            IndicesOptions.fromParameters(null, "true", null, SearchRequest.DEFAULT_INDICES_OPTIONS));
    response = execute(rankEvalRequest, highLevelClient()::rankEval, highLevelClient()::rankEvalAsync);
}

From source file:ca.uhn.hl7v2.testpanel.ui.AddMessageDialog.java

/**
 * Create the dialog.//from  ww  w  .j  a v  a  2s  .co  m
 */
public AddMessageDialog(Controller theController) {
    myController = theController;

    setMinimumSize(new Dimension(450, 400));
    setPreferredSize(new Dimension(450, 400));
    setSize(new Dimension(450, 400));
    setResizable(false);
    setMaximumSize(new Dimension(450, 400));
    setTitle("Add Message");
    setBounds(100, 100, 450, 401);
    getContentPane().setLayout(new BorderLayout());
    mycontentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(mycontentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 0, 0 };
    gbl_contentPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
    mycontentPanel.setLayout(gbl_contentPanel);
    {
        JPanel panel = new JPanel();
        panel.setBorder(
                new TitledBorder(null, "Message Type", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.weighty = 1.0;
        gbc_panel.insets = new Insets(0, 0, 5, 0);
        gbc_panel.fill = GridBagConstraints.BOTH;
        gbc_panel.gridx = 0;
        gbc_panel.gridy = 0;
        mycontentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0, 0 };
        gbl_panel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            JLabel lblVersion = new JLabel("Version");
            GridBagConstraints gbc_lblVersion = new GridBagConstraints();
            gbc_lblVersion.insets = new Insets(0, 0, 5, 5);
            gbc_lblVersion.gridx = 0;
            gbc_lblVersion.gridy = 0;
            panel.add(lblVersion, gbc_lblVersion);
        }
        {
            JLabel lblType = new JLabel("Type");
            GridBagConstraints gbc_lblType = new GridBagConstraints();
            gbc_lblType.insets = new Insets(0, 0, 5, 0);
            gbc_lblType.gridx = 1;
            gbc_lblType.gridy = 0;
            panel.add(lblType, gbc_lblType);
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportBorder(null);
            GridBagConstraints gbc_scrollPane = new GridBagConstraints();
            gbc_scrollPane.weighty = 1.0;
            gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
            gbc_scrollPane.fill = GridBagConstraints.BOTH;
            gbc_scrollPane.gridx = 0;
            gbc_scrollPane.gridy = 1;
            panel.add(scrollPane, gbc_scrollPane);
            {
                myVersionList = new JList();
                myVersionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane.setViewportView(myVersionList);
            }
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportBorder(null);
            GridBagConstraints gbc_scrollPane = new GridBagConstraints();
            gbc_scrollPane.weighty = 1.0;
            gbc_scrollPane.weightx = 1.0;
            gbc_scrollPane.fill = GridBagConstraints.BOTH;
            gbc_scrollPane.gridx = 1;
            gbc_scrollPane.gridy = 1;
            panel.add(scrollPane, gbc_scrollPane);
            {
                myMessageTypeList = new JList();
                myMessageTypeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane.setViewportView(myMessageTypeList);
            }
        }
    }
    {
        JPanel panel = new JPanel();
        panel.setBorder(new TitledBorder(null, "Options", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.fill = GridBagConstraints.BOTH;
        gbc_panel.gridx = 0;
        gbc_panel.gridy = 1;
        mycontentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0 };
        gbl_panel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            JLabel lblEncoding = new JLabel("Encoding");
            GridBagConstraints gbc_lblEncoding = new GridBagConstraints();
            gbc_lblEncoding.insets = new Insets(0, 0, 0, 5);
            gbc_lblEncoding.gridx = 0;
            gbc_lblEncoding.gridy = 0;
            panel.add(lblEncoding, gbc_lblEncoding);
        }
        {
            JPanel panel_1 = new JPanel();
            panel_1.setBorder(null);
            GridBagConstraints gbc_panel_1 = new GridBagConstraints();
            gbc_panel_1.anchor = GridBagConstraints.WEST;
            gbc_panel_1.fill = GridBagConstraints.VERTICAL;
            gbc_panel_1.gridx = 1;
            gbc_panel_1.gridy = 0;
            panel.add(panel_1, gbc_panel_1);
            {
                myEr7Radio = new JRadioButton("ER7");
                myEr7Radio.setSelected(true);
                encodingButtonGroup.add(myEr7Radio);
                panel_1.add(myEr7Radio);
            }
            {
                JRadioButton myXmlRadio = new JRadioButton("XML");
                encodingButtonGroup.add(myXmlRadio);
                panel_1.add(myXmlRadio);
            }
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    try {
                        String version = (String) myVersionList.getSelectedValue();
                        String fullType = (String) myMessageTypeList.getSelectedValue();
                        String structure = myTypesToStructures.get(fullType);
                        String[] fullTypeBits = fullType.split("\\^");
                        String type = fullTypeBits[0];
                        String trigger = fullTypeBits[1];

                        Hl7V2EncodingTypeEnum encoding = myEr7Radio.isSelected() ? Hl7V2EncodingTypeEnum.ER_7
                                : Hl7V2EncodingTypeEnum.XML;
                        myController.addMessage(version, type, trigger, structure, encoding);
                    } finally {
                        setVisible(false);
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    AddMessageDialog.this.setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }

    initLocal();
}