List of usage examples for java.lang Float MIN_VALUE
float MIN_VALUE
To view the source code for java.lang Float MIN_VALUE.
Click Source Link
From source file:qtiscoringengine.VariableMapping.java
@Override boolean validate(QTIRubric rubric, ValidationLog log) { boolean ok = true; if (_entries.size() == 0) { log.addMessage(_node, "Area Mapping did not contain any entries, at least 1 is required"); switch (log.getValidationRigor()) { case None: break; default:/*from w ww.j ava 2 s . com*/ ok = false; break; } } if (_defaultValue == null) { log.addMessage(_node, "Required node defaultValue was not specified"); switch (log.getValidationRigor()) { case None: break; default: ok = false; break; } } else if (_defaultValue.getIsError()) { log.addMessage(_node, _defaultValue.getErrorMessage()); switch (log.getValidationRigor()) { case None: break; default: ok = false; break; } } else if (_defaultValue.getValue() == Float.MIN_VALUE) { log.addMessage(_node, "Could not parse defaultValue"); switch (log.getValidationRigor()) { case None: break; default: ok = false; break; } } return ok; }
From source file:org.apache.hadoop.hive.hbase.HBaseTestSetup.java
private void createHBaseTable() throws IOException { final String HBASE_TABLE_NAME = "HiveExternalTable"; HTableDescriptor htableDesc = new HTableDescriptor(HBASE_TABLE_NAME.getBytes()); HColumnDescriptor hcolDesc = new HColumnDescriptor("cf".getBytes()); htableDesc.addFamily(hcolDesc);// w ww . j ava 2 s . co m 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, HBase,", "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 }; HBaseAdmin hbaseAdmin = null; HTableInterface htable = null; try { hbaseAdmin = new HBaseAdmin(hbaseConn.getConfiguration()); if (Arrays.asList(hbaseAdmin.listTables()).contains(htableDesc)) { // if table is already in there, don't recreate. return; } hbaseAdmin.createTable(htableDesc); htable = hbaseConn.getTable(HBASE_TABLE_NAME); // data Put[] puts = new Put[] { new Put("key-1".getBytes()), new Put("key-2".getBytes()), new Put("key-3".getBytes()) }; // store data for (int i = 0; i < puts.length; i++) { puts[i].add("cf".getBytes(), "cq-boolean".getBytes(), Bytes.toBytes(booleans[i])); puts[i].add("cf".getBytes(), "cq-byte".getBytes(), new byte[] { bytes[i] }); puts[i].add("cf".getBytes(), "cq-short".getBytes(), Bytes.toBytes(shorts[i])); puts[i].add("cf".getBytes(), "cq-int".getBytes(), Bytes.toBytes(ints[i])); puts[i].add("cf".getBytes(), "cq-long".getBytes(), Bytes.toBytes(longs[i])); puts[i].add("cf".getBytes(), "cq-string".getBytes(), Bytes.toBytes(strings[i])); puts[i].add("cf".getBytes(), "cq-float".getBytes(), Bytes.toBytes(floats[i])); puts[i].add("cf".getBytes(), "cq-double".getBytes(), Bytes.toBytes(doubles[i])); htable.put(puts[i]); } } finally { if (htable != null) htable.close(); if (hbaseAdmin != null) hbaseAdmin.close(); } }
From source file:org.apache.camel.dataformat.bindy.BindyAbstractFactory.java
public static Object getDefaultValueForPrimitive(Class<?> clazz) throws Exception { if (clazz == byte.class) { return Byte.MIN_VALUE; } else if (clazz == short.class) { return Short.MIN_VALUE; } else if (clazz == int.class) { return Integer.MIN_VALUE; } else if (clazz == long.class) { return Long.MIN_VALUE; } else if (clazz == float.class) { return Float.MIN_VALUE; } else if (clazz == double.class) { return Double.MIN_VALUE; } else if (clazz == char.class) { return Character.MIN_VALUE; } else if (clazz == boolean.class) { return false; } else {/*w w w . j a va 2 s . c o m*/ return null; } }
From source file:com.stratio.ingestion.sink.cassandra.EventParserTest.java
@Test public void shouldParsePrimitiveTypes() throws Exception { Object integer = EventParser.parseValue("1", DataType.Name.INT); assertThat(integer).isInstanceOf(Integer.class).isEqualTo(1); integer = EventParser.parseValue(Integer.toString(Integer.MAX_VALUE), DataType.Name.INT); assertThat(integer).isInstanceOf(Integer.class).isEqualTo(Integer.MAX_VALUE); integer = EventParser.parseValue(Integer.toString(Integer.MIN_VALUE), DataType.Name.INT); assertThat(integer).isInstanceOf(Integer.class).isEqualTo(Integer.MIN_VALUE); integer = EventParser.parseValue(" 1 2 ", DataType.Name.INT); assertThat(integer).isInstanceOf(Integer.class).isEqualTo(12); Object counter = EventParser.parseValue("1", DataType.Name.COUNTER); assertThat(counter).isEqualTo(1L);/*from ww w .j a va 2 s. co m*/ counter = EventParser.parseValue(Long.toString(Long.MAX_VALUE), DataType.Name.COUNTER); assertThat(counter).isEqualTo(Long.MAX_VALUE); counter = EventParser.parseValue(Long.toString(Long.MIN_VALUE), DataType.Name.COUNTER); assertThat(counter).isEqualTo(Long.MIN_VALUE); counter = EventParser.parseValue(" 1 2 ", DataType.Name.COUNTER); assertThat(counter).isEqualTo(12L); Object _float = EventParser.parseValue("1", DataType.Name.FLOAT); assertThat(_float).isInstanceOf(Float.class).isEqualTo(1f); _float = EventParser.parseValue("1.0", DataType.Name.FLOAT); assertThat(_float).isInstanceOf(Float.class).isEqualTo(1f); _float = EventParser.parseValue(Float.toString(Float.MAX_VALUE), DataType.Name.FLOAT); assertThat(_float).isInstanceOf(Float.class).isEqualTo(Float.MAX_VALUE); _float = EventParser.parseValue(Float.toString(Float.MIN_VALUE), DataType.Name.FLOAT); assertThat(_float).isInstanceOf(Float.class).isEqualTo(Float.MIN_VALUE); _float = EventParser.parseValue(" 1 . 0 ", DataType.Name.FLOAT); assertThat(_float).isInstanceOf(Float.class).isEqualTo(1f); Object _double = EventParser.parseValue("1", DataType.Name.DOUBLE); assertThat(_double).isInstanceOf(Double.class).isEqualTo(1.0); _double = EventParser.parseValue("0", DataType.Name.DOUBLE); assertThat(_double).isInstanceOf(Double.class).isEqualTo(0.0); _double = EventParser.parseValue(Double.toString(Double.MAX_VALUE), DataType.Name.DOUBLE); assertThat(_double).isInstanceOf(Double.class).isEqualTo(Double.MAX_VALUE); _double = EventParser.parseValue(Double.toString(Double.MIN_VALUE), DataType.Name.DOUBLE); assertThat(_double).isInstanceOf(Double.class).isEqualTo(Double.MIN_VALUE); _double = EventParser.parseValue(" 1 . 0 ", DataType.Name.DOUBLE); assertThat(_double).isInstanceOf(Double.class).isEqualTo(1.0); for (DataType.Name type : Arrays.asList(DataType.Name.BIGINT)) { Object bigInteger = EventParser.parseValue("1", type); assertThat(bigInteger).isInstanceOf(Long.class).isEqualTo(1L); bigInteger = EventParser.parseValue("0", type); assertThat(bigInteger).isInstanceOf(Long.class).isEqualTo(0L); bigInteger = EventParser.parseValue(Long.toString(Long.MAX_VALUE), type); assertThat(bigInteger).isInstanceOf(Long.class).isEqualTo(Long.MAX_VALUE); bigInteger = EventParser.parseValue(Long.toString(Long.MIN_VALUE), type); assertThat(bigInteger).isInstanceOf(Long.class).isEqualTo(Long.MIN_VALUE); } for (DataType.Name type : Arrays.asList(DataType.Name.VARINT)) { Object bigInteger = EventParser.parseValue("1", type); assertThat(bigInteger).isInstanceOf(BigInteger.class).isEqualTo(BigInteger.ONE); bigInteger = EventParser.parseValue("0", type); assertThat(bigInteger).isInstanceOf(BigInteger.class).isEqualTo(BigInteger.ZERO); bigInteger = EventParser.parseValue( BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(2L)).toString(), type); assertThat(bigInteger).isInstanceOf(BigInteger.class) .isEqualTo(BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(2L))); bigInteger = EventParser.parseValue( BigInteger.valueOf(Long.MIN_VALUE).multiply(BigInteger.valueOf(2L)).toString(), type); assertThat(bigInteger).isInstanceOf(BigInteger.class) .isEqualTo(BigInteger.valueOf(Long.MIN_VALUE).multiply(BigInteger.valueOf(2L))); } Object bigDecimal = EventParser.parseValue("1", DataType.Name.DECIMAL); assertThat(bigDecimal).isInstanceOf(BigDecimal.class).isEqualTo(BigDecimal.valueOf(1)); bigDecimal = EventParser.parseValue("0", DataType.Name.DECIMAL); assertThat(bigDecimal).isInstanceOf(BigDecimal.class).isEqualTo(BigDecimal.valueOf(0)); bigDecimal = EventParser.parseValue( BigDecimal.valueOf(Double.MAX_VALUE).multiply(BigDecimal.valueOf(2)).toString(), DataType.Name.DECIMAL); assertThat(bigDecimal).isInstanceOf(BigDecimal.class) .isEqualTo(BigDecimal.valueOf(Double.MAX_VALUE).multiply(BigDecimal.valueOf(2))); bigDecimal = EventParser.parseValue( BigDecimal.valueOf(Double.MIN_VALUE).multiply(BigDecimal.valueOf(2)).toString(), DataType.Name.DECIMAL); assertThat(bigDecimal).isInstanceOf(BigDecimal.class) .isEqualTo(BigDecimal.valueOf(Double.MIN_VALUE).multiply(BigDecimal.valueOf(2))); bigDecimal = EventParser.parseValue(" 1 2 ", DataType.Name.DECIMAL); assertThat(bigDecimal).isInstanceOf(BigDecimal.class).isEqualTo(BigDecimal.valueOf(12)); Object string = EventParser.parseValue("string", DataType.Name.TEXT); assertThat(string).isInstanceOf(String.class).isEqualTo("string"); Object bool = EventParser.parseValue("true", DataType.Name.BOOLEAN); assertThat(bool).isInstanceOf(Boolean.class).isEqualTo(true); Object addr = EventParser.parseValue("192.168.1.1", DataType.Name.INET); assertThat(addr).isInstanceOf(InetAddress.class).isEqualTo(InetAddress.getByName("192.168.1.1")); UUID randomUUID = UUID.randomUUID(); Object uuid = EventParser.parseValue(randomUUID.toString(), DataType.Name.UUID); assertThat(uuid).isInstanceOf(UUID.class).isEqualTo(randomUUID); }
From source file:com.github.rvesse.airline.restrictions.factories.RangeRestrictionFactory.java
protected RangeRestriction createFloatRange(Annotation annotation) { FloatRange sRange = (FloatRange) annotation; return new RangeRestriction( sRange.min() != Float.MIN_VALUE || !sRange.minInclusive() ? Float.valueOf(sRange.min()) : null, sRange.minInclusive(),//from w ww. j a v a 2 s. c o m sRange.max() != Float.MAX_VALUE || !sRange.maxInclusive() ? Float.valueOf(sRange.max()) : null, sRange.maxInclusive(), FLOAT_COMPARATOR); }
From source file:fr.immotronic.ubikit.pems.smartbuilding.impl.node.CarbonDioxideNodeImpl.java
@Override public float getCO2Concentration() { if (isLocal()) { switch (getPemLocalID()) { case ENOCEAN: switch (eep) { case EEP_07_09_04: { EEP070904Data data = (EEP070904Data) getActualNodeValue(); if (data == null) { return Float.MIN_VALUE; }//from ww w .j ava 2 s. c o m return data.getCO2concentration(); } default: break; } break; } } return Float.MIN_VALUE; }
From source file:com.distantfuture.castcompanionlibrary.lib.cast.player.VideoCastControllerActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (mVolumeIncrement == Float.MIN_VALUE) { return false; }/* www. j a v a 2 s. co m*/ if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { onVolumeChange(mVolumeIncrement); } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { onVolumeChange(-(double) mVolumeIncrement); } else { return super.onKeyDown(keyCode, event); } return true; }
From source file:org.bitpipeline.lib.friendlyjson.JSONEntityTest.java
@Test public void testSerializationStrings() throws JSONMappingException, JSONException { Entity orig = createEntity(); JSONObject json = orig.toJson();/*from w ww .j av a2 s . c om*/ assertNotNull(json); String origJsonStr = orig.toString(4); assertNotNull(origJsonStr); Entity copy = new Entity(origJsonStr); assertNotNull(copy); assertEquals(orig.aBoolean, copy.aBoolean); assertEquals(orig.aByte, copy.aByte); assertEquals(orig.aChar, copy.aChar); assertEquals(orig.aShort, copy.aShort); assertEquals(orig.aInt, copy.aInt); assertEquals(orig.aLong, copy.aLong); assertEquals(orig.aFloat, copy.aFloat, Float.MIN_VALUE * 10.0f); assertEquals(orig.aDouble, copy.aDouble, Double.MIN_VALUE * 10.0); assertEquals(orig.aString, copy.aString); assertFalse(orig.transientValue == copy.transientValue); assertNotNull(copy.aMap); for (String key : orig.aMap.keySet()) { assertEquals(orig.aMap.get(key), copy.aMap.get(key)); } assertNotNull(copy.aMapOfLists); for (String key : orig.aMapOfLists.keySet()) { assertEquals(orig.aMapOfLists.get(key), copy.aMapOfLists.get(key)); } assertNotNull(copy.xptos); assertEquals(copy.xptos.size(), orig.xptos.size()); for (Xpto x : orig.xptos) { boolean found = false; for (Xpto y : copy.xptos) if (x.getName().equals(y.getName())) found = true; assertTrue(found); } assertEquals(orig.toString(), copy.toString()); }
From source file:fr.immotronic.ubikit.pems.enocean.impl.item.datahandler.EEP0702xxDataHandler.java
@Override public void processNewIncomingData(int transmitterID, EnoceanData data) { List<AbstractEvent> events = new ArrayList<AbstractEvent>(); byte[] dataBytes = data.getBytes(); // Checking if telegram is a teach-in telegram. If so, ignore it. if ((dataBytes[0] & 0x8) == 0x0) { return;//from w w w. ja v a 2s .c om } float temperature = Float.MIN_VALUE; // According to Enocean Equipment Profile: temperature = min..maxC, DB1 = 255..0, linear temperature = ((float) (255 - (int) (dataBytes[1] & 0xff)) * temperatureMultiplier) + temperatureLowerRange; // Generate a Temperature event. events.add(new TemperatureEvent(itemUID, temperature, data.getDate())); // Remembering received data sensorData = new EEP0702xxDataImpl(temperature, data.getDate()); // And then, send all generated events. Sending MUST be done after remembering received data, otherwise if an event listener performs // a getLastKnownData() on event reception, it might obtain non up-to-date data. eventGate.postEvents(events); }
From source file:net.ymate.platform.configuration.provider.impl.JConfigProvider.java
public float getFloat(String key) { return getFloat(key, Float.MIN_VALUE); }