List of usage examples for java.lang Float MAX_VALUE
float MAX_VALUE
To view the source code for java.lang Float MAX_VALUE.
Click Source Link
From source file:org.broad.igv.data.ProcessingUtils.java
private static float computeMin(float[] data) { float min = Float.MAX_VALUE; for (int i = 0; i < data.length; i++) { if (!Float.isNaN(data[i])) { min = Math.min(data[i], min); }/*from w w w. j ava 2 s .c o m*/ } return min; }
From source file:org.cellcore.code.engine.page.extractor.mcc.MCCPageDataExtractor.java
@Override protected int getStock(Document doc) { Elements tr = doc.select("#blockContent").get(5).select("tr"); float iPrice = Float.MAX_VALUE; int iStock = 0; for (int i = 0; i < tr.size(); i++) { try {/*from w ww.jav a 2 s . c o m*/ String val = tr.get(i).getElementsByTag("td").get(3).childNodes().get(0).attr("text"); String stockV = tr.get(i).getElementsByTag("td").get(4).select("option").last().childNodes().get(0) .attr("text"); val = cleanPriceString(val); float price = Float.parseFloat(val); if (price < iPrice) { iPrice = price; iStock = Integer.parseInt(stockV.replaceAll("\\(", "").replaceAll("\\)", "")); } } catch (Throwable t) { } } return iStock; }
From source file:org.joda.primitives.collection.impl.AbstractTestFloatCollection.java
public Float[] getFullNonNullElements() { return new Float[] { new Float(2f), new Float(-2f), new Float(38.874f), new Float(0f), new Float(10000f), new Float(202f), new Float(Float.MIN_VALUE), new Float(Float.MAX_VALUE) }; }
From source file:org.cellcore.code.engine.page.extractor.mb.MBPageDataExtractor.java
@Override protected int getStock(Document doc) { if (!doc.getElementsContainingText("Cette carte n'est pas disponible en stock").isEmpty()) { return 0; }/*from ww w.j ava 2s .c o m*/ Elements tr = doc.select(".stock").get(0).getElementsByTag("tr"); float iPrice = Float.MAX_VALUE; int iStock = 0; for (int i = 1; i < tr.size(); i++) { String val = tr.get(i).getElementsByTag("td").get(3).childNodes().get(0).attr("text"); String stockV = tr.get(i).getElementsByTag("td").get(4).childNodes().get(1).attr("text"); val = cleanPriceString(val); float price = Float.parseFloat(val); if (price < iPrice) { iPrice = price; iStock = Integer.parseInt(stockV.replaceAll("\\(", "").replaceAll("\\)", "")); } } return iStock; }
From source file:org.broad.igv.data.ProcessingUtils.java
private static float computeMax(float[] data) { float max = -Float.MAX_VALUE; for (int i = 0; i < data.length; i++) { if (!Float.isNaN(data[i])) { max = Math.max(data[i], max); }// w w w .ja v a 2s . com } return max; }
From source file:org.apache.nifi.xml.inference.XmlSchemaInference.java
private DataType inferTextualDataType(final String text) { if (text == null || text.isEmpty()) { return null; }/*from ww w . j a va 2 s . c o m*/ if (NumberUtils.isParsable(text)) { if (text.contains(".")) { try { final double doubleValue = Double.parseDouble(text); if (doubleValue > Float.MAX_VALUE || doubleValue < Float.MIN_VALUE) { return RecordFieldType.DOUBLE.getDataType(); } return RecordFieldType.FLOAT.getDataType(); } catch (final NumberFormatException nfe) { return RecordFieldType.STRING.getDataType(); } } try { final long longValue = Long.parseLong(text); if (longValue > Integer.MAX_VALUE || longValue < Integer.MIN_VALUE) { return RecordFieldType.LONG.getDataType(); } return RecordFieldType.INT.getDataType(); } catch (final NumberFormatException nfe) { return RecordFieldType.STRING.getDataType(); } } if (text.equalsIgnoreCase("true") || text.equalsIgnoreCase("false")) { return RecordFieldType.BOOLEAN.getDataType(); } final Optional<DataType> timeDataType = timeValueInference.getDataType(text); return timeDataType.orElse(RecordFieldType.STRING.getDataType()); }
From source file:de.metanome.algorithm_integration.ColumnConditionAnd.java
@Override public float getCoverage() { if (Float.isNaN(this.coverage)) { float coverage = Float.MAX_VALUE; for (ColumnCondition subCondition : this.columnValues) { if (coverage > subCondition.getCoverage()) { coverage = subCondition.getCoverage(); }/*from w w w .ja v a 2 s .c o m*/ } return coverage; } else { return this.coverage; } }
From source file:com.couchbase.sqoop.mapreduce.db.CouchbaseRecordReadSerializeTest.java
@Before @Override//w w w.ja v a 2s .c o m public void setUp() throws Exception { super.setUp(); tappedStuff = new HashMap<String, ResponseMessage>(); URI uri = new URI(CouchbaseUtils.CONNECT_STRING); String user = CouchbaseUtils.COUCHBASE_USER_NAME; String pass = CouchbaseUtils.COUCHBASE_USER_PASS; try { cb = new CouchbaseClient(Arrays.asList(uri), user, pass); } catch (IOException e) { LOG.error("Couldn't connect to server" + e.getMessage()); fail(e.toString()); } this.client = new TapClient(Arrays.asList(uri), user, pass); cb.flush(); Thread.sleep(500); // set up the items we're going to deserialize Integer anint = new Integer(Integer.MIN_VALUE); cb.set(anint.toString(), 0x300, anint).get(); Long along = new Long(Long.MAX_VALUE); cb.set(along.toString(), 0, along).get(); Float afloat = new Float(Float.MAX_VALUE); cb.set(afloat.toString(), 0, afloat).get(); Double doubleBase = new Double(Double.NEGATIVE_INFINITY); cb.set(doubleBase.toString(), 0, doubleBase).get(); Boolean booleanBase = true; cb.set(booleanBase.toString(), 0, booleanBase).get(); rightnow = new Date(); // instance, needed later dateText = rightnow.toString().replaceAll(" ", "_"); cb.set(dateText, 0, rightnow).get(); Byte byteMeSix = new Byte("6"); cb.set(byteMeSix.toString(), 0, byteMeSix).get(); String ourString = "hi,there"; cb.set(ourString.toString(), 0, ourString).get(); client.tapDump("tester"); while (client.hasMoreMessages()) { ResponseMessage m = client.getNextMessage(); if (m == null) { continue; } tappedStuff.put(m.getKey(), m); } }
From source file:com.jaeksoft.searchlib.result.collector.docsethit.DistanceCollector.java
public DistanceCollector(final DocSetHitBaseCollector base, final ReaderAbstract reader, final GeoParameters geoParams) throws IOException { super(base);/* ww w .j av a2 s .co m*/ this.distancesBuffer = new FloatBufferedArray(base.getMaxDoc()); radius = DistanceReturn.getRadius(geoParams.getDistanceReturn()); latitudeProvider = reader.getDocValueInterface(geoParams.getLatitudeField(), DocValueType.RADIANS); longitudeProvider = reader.getDocValueInterface(geoParams.getLongitudeField(), DocValueType.RADIANS); latitude = geoParams.getLatitudeRadian(); longitude = geoParams.getLongitudeRadian(); distances = null; currentDistance = 0; currentDoc = -1; maxDistance = 0; minDistance = Float.MAX_VALUE; }
From source file:org.thymeleaf.util.EvaluationUtilTest.java
@Test public void convertToBooleanTest() { Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(null)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Boolean.TRUE)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Boolean.FALSE)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(BigDecimal.ZERO)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigDecimal.ONE)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigDecimal.TEN)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(BigInteger.ZERO)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigInteger.ONE)); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(BigInteger.TEN)); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Double.valueOf(0.0d))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Float.valueOf(0.0f))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(0.1d))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(0.1f))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(-0.1d))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(-0.1f))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(Double.MAX_VALUE))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(Float.MAX_VALUE))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Double.valueOf(Double.MIN_VALUE))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Float.valueOf(Float.MIN_VALUE))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(Character.valueOf((char) 0))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('x'))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('0'))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(Character.valueOf('1'))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("true")); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("false")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("yes")); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("no")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("on")); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean("off")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("sky")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean("high above")); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("true"))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("false"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("yes"))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("no"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("on"))); Assert.assertFalse(EvaluationUtil.evaluateAsBoolean(new LiteralValue("off"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("sky"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(new LiteralValue("high above"))); Assert.assertTrue(EvaluationUtil.evaluateAsBoolean(EvaluationUtil.class)); }