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.seedstack.seed.core.internal.application.ConfigurationMembersInjectorTest.java
@Test public void injectorConfigFloatTest() { injectMembersTest("testConfigFloat", false); Assertions.assertThat(testConfigFloat).isNull(); injectMembersTest("testConfigFloat", true); Assertions.assertThat(testConfigFloat).isNotNull(); Assertions.assertThat(testConfigFloat).isEqualTo(Float.MAX_VALUE); }
From source file:com.eventsourcing.postgresql.PostgreSQLJournalTest.java
@Test @SneakyThrows/*from www . j a v a2 s .c o m*/ public void serializationValue() { assertEquals(serializationResult(TestClass.builder().pByte(Byte.MIN_VALUE).build()).pByte(), Byte.MIN_VALUE); assertEquals(serializationResult(TestClass.builder().pByte(Byte.MAX_VALUE).build()).pByte(), Byte.MAX_VALUE); assertEquals((byte) serializationResult(TestClass.builder().oByte(Byte.MIN_VALUE).build()).oByte(), Byte.MIN_VALUE); assertEquals((byte) serializationResult(TestClass.builder().oByte(Byte.MAX_VALUE).build()).oByte(), Byte.MAX_VALUE); assertEquals( serializationResult(TestClass.builder().pByteArr("Hello, world".getBytes()).build()).pByteArr(), "Hello, world".getBytes()); assertEquals( serializationResult(TestClass.builder().oByteArr(toObject(("Hello, world").getBytes())).build()) .oByteArr(), "Hello, world".getBytes()); assertEquals(serializationResult(TestClass.builder().pShort(Short.MIN_VALUE).build()).pShort(), Short.MIN_VALUE); assertEquals((short) serializationResult(TestClass.builder().oShort(Short.MAX_VALUE).build()).oShort(), Short.MAX_VALUE); assertEquals(serializationResult(TestClass.builder().pInt(Integer.MIN_VALUE).build()).pInt(), Integer.MIN_VALUE); assertEquals((int) serializationResult(TestClass.builder().oInt(Integer.MAX_VALUE).build()).oInt(), Integer.MAX_VALUE); assertEquals(serializationResult(TestClass.builder().pLong(Long.MIN_VALUE).build()).pLong(), Long.MIN_VALUE); assertEquals((long) serializationResult(TestClass.builder().oLong(Long.MAX_VALUE).build()).oLong(), Long.MAX_VALUE); assertEquals(serializationResult(TestClass.builder().pFloat(Float.MIN_VALUE).build()).pFloat(), Float.MIN_VALUE); assertEquals(serializationResult(TestClass.builder().oFloat(Float.MAX_VALUE).build()).oFloat(), Float.MAX_VALUE); assertEquals(serializationResult(TestClass.builder().pDouble(Double.MIN_VALUE).build()).pDouble(), Double.MIN_VALUE); assertEquals(serializationResult(TestClass.builder().oDouble(Double.MAX_VALUE).build()).oDouble(), Double.MAX_VALUE); assertEquals(serializationResult(TestClass.builder().pBoolean(true).build()).pBoolean(), true); assertEquals(serializationResult(TestClass.builder().pBoolean(false).build()).pBoolean(), false); assertEquals((boolean) serializationResult(TestClass.builder().oBoolean(true).build()).oBoolean(), true); assertEquals((boolean) serializationResult(TestClass.builder().oBoolean(false).build()).oBoolean(), false); assertEquals(serializationResult(TestClass.builder().str("Hello, world").build()).str(), "Hello, world"); UUID uuid = UUID.randomUUID(); assertEquals(serializationResult(TestClass.builder().uuid(uuid).build()).uuid(), uuid); assertEquals(serializationResult(TestClass.builder().e(TestClass.E.B).build()).e(), TestClass.E.B); assertEquals(serializationResult(TestClass.builder().value(new SomeValue("test")).build()).value().value(), "test"); assertEquals(serializationResult(TestClass.builder() .value1(new SomeValue1(Collections.singletonList(new SomeValue2(new SomeValue("test"))))).build()) .value1().value().get(0).value().value(), "test"); ArrayList<List<String>> l = new ArrayList<>(); ArrayList<String> l1 = new ArrayList<>(); l1.add("test"); l.add(l1); assertEquals(serializationResult(TestClass.builder().list(l).build()).list().get(0).get(0), "test"); Map<String, List<String>> map = new HashMap<>(); LinkedList<String> list = new LinkedList<>(Arrays.asList("Hello")); map.put("test", list); map.put("anothertest", list); assertEquals(serializationResult(TestClass.builder().map(map).build()).map().get("test").get(0), "Hello"); assertEquals(serializationResult(TestClass.builder().map(map).build()).map().get("anothertest").get(0), "Hello"); assertFalse( serializationResult(TestClass.builder().optional(Optional.empty()).build()).optional().isPresent()); assertTrue(serializationResult(TestClass.builder().optional(Optional.of("test")).build()).optional() .isPresent()); assertEquals( serializationResult(TestClass.builder().optional(Optional.of("test")).build()).optional().get(), "test"); BigDecimal bigDecimal = new BigDecimal("0.00000000000000000000000000001"); assertEquals(serializationResult(TestClass.builder().bigDecimal(bigDecimal).build()).bigDecimal(), bigDecimal); BigInteger bigInteger = new BigInteger("100001"); assertEquals(serializationResult(TestClass.builder().bigInteger(bigInteger).build()).bigInteger(), bigInteger); Date date = new Date(); assertEquals(serializationResult(TestClass.builder().date(date).build()).date(), date); }
From source file:org.seedstack.seed.core.internal.application.ConfigurationMembersInjectorTest.java
@Test public void injectorConfigFloatArrayTest() { injectMembersTest("testConfigFloatArray", false); Assertions.assertThat(testConfigFloatArray).isNull(); injectMembersTest("testConfigFloatArray", true); Assertions.assertThat(testConfigFloatArray).isNotNull(); Assertions.assertThat(testConfigFloatArray.length).isEqualTo(1); Assertions.assertThat(testConfigFloatArray[0]).isEqualTo(Float.MAX_VALUE); }
From source file:eu.itesla_project.eurostag.EurostagImpactAnalysis.java
private static void dumpLimits(EurostagDictionary dictionary, BufferedWriter writer, String branchId, CurrentLimits cl1, CurrentLimits cl2, float nominalV1, float nominalV2) throws IOException { writer.write(dictionary.getEsgId(branchId)); writer.write(";"); writer.write(Float.toString(cl1 != null ? cl1.getPermanentLimit() : Float.MAX_VALUE)); writer.write(";"); writer.write(Float.toString(cl2 != null ? cl2.getPermanentLimit() : Float.MAX_VALUE)); writer.write(";"); writer.write(Float.toString(nominalV1)); writer.write(";"); writer.write(Float.toString(nominalV2)); writer.write(";"); writer.write(branchId);/*from w ww. java 2 s . c om*/ writer.newLine(); }
From source file:com.nadmm.airports.wx.MetarFragment.java
protected void showMetar(Intent intent) { if (getActivity() == null) { // Not ready to do this yet return;/* w ww.j a v a2 s .co m*/ } Metar metar = (Metar) intent.getSerializableExtra(NoaaService.RESULT); if (metar == null) { return; } View detail = findViewById(R.id.wx_detail_layout); LinearLayout layout = (LinearLayout) findViewById(R.id.wx_status_layout); layout.removeAllViews(); TextView tv = (TextView) findViewById(R.id.status_msg); if (!metar.isValid) { tv.setVisibility(View.VISIBLE); layout.setVisibility(View.VISIBLE); tv.setText("Unable to get METAR for this location"); addRow(layout, "This could be due to the following reasons:"); addBulletedRow(layout, "Network connection is not available"); addBulletedRow(layout, "ADDS does not publish METAR for this station"); addBulletedRow(layout, "Station is currently out of service"); addBulletedRow(layout, "Station has not updated the METAR for more than 3 hours"); detail.setVisibility(View.GONE); stopRefreshAnimation(); setFragmentContentShown(true); return; } else { tv.setText(""); tv.setVisibility(View.GONE); layout.setVisibility(View.GONE); detail.setVisibility(View.VISIBLE); } tv = (TextView) findViewById(R.id.wx_station_info2); WxUtils.setFlightCategoryDrawable(tv, metar.flightCategory); tv = (TextView) findViewById(R.id.wx_age); tv.setText(TimeUtils.formatElapsedTime(metar.observationTime)); // Raw Text tv = (TextView) findViewById(R.id.wx_raw_metar); tv.setText(metar.rawText); // Winds tv = (TextView) findViewById(R.id.wx_wind_label); layout = (LinearLayout) findViewById(R.id.wx_wind_layout); layout.removeAllViews(); int visibility = View.GONE; if (metar.windSpeedKnots < Integer.MAX_VALUE) { showWindInfo(layout, metar); visibility = View.VISIBLE; } tv.setVisibility(visibility); layout.setVisibility(visibility); // Visibility tv = (TextView) findViewById(R.id.wx_vis_label); layout = (LinearLayout) findViewById(R.id.wx_vis_layout); layout.removeAllViews(); visibility = View.GONE; if (metar.visibilitySM < Float.MAX_VALUE) { if (metar.flags.contains(Flags.AutoReport) && metar.visibilitySM == 10) { addRow(layout, "10+ statute miles horizontal"); } else { NumberFormat decimal2 = NumberFormat.getNumberInstance(); decimal2.setMaximumFractionDigits(2); decimal2.setMinimumFractionDigits(0); addRow(layout, String.format("%s statute miles horizontal", FormatUtils.formatNumber(metar.visibilitySM))); } if (metar.vertVisibilityFeet < Integer.MAX_VALUE) { addRow(layout, String.format("%s vertical", FormatUtils.formatFeetAgl(metar.vertVisibilityFeet))); } visibility = View.VISIBLE; } tv.setVisibility(visibility); layout.setVisibility(visibility); // Weather layout = (LinearLayout) findViewById(R.id.wx_weather_layout); layout.removeAllViews(); for (WxSymbol wx : metar.wxList) { addWeatherRow(layout, wx, metar.flightCategory); } // Sky Conditions tv = (TextView) findViewById(R.id.wx_sky_cond_label); layout = (LinearLayout) findViewById(R.id.wx_sky_cond_layout); layout.removeAllViews(); visibility = View.GONE; if (!metar.skyConditions.isEmpty()) { for (SkyCondition sky : metar.skyConditions) { addSkyConditionRow(layout, sky, metar.flightCategory); } visibility = View.VISIBLE; } tv.setVisibility(visibility); layout.setVisibility(visibility); // Temperature tv = (TextView) findViewById(R.id.wx_temp_label); layout = (LinearLayout) findViewById(R.id.wx_temp_layout); layout.removeAllViews(); visibility = View.GONE; if (metar.tempCelsius < Float.MAX_VALUE && metar.dewpointCelsius < Float.MAX_VALUE) { addRow(layout, "Temperature", FormatUtils.formatTemperature(metar.tempCelsius)); if (metar.dewpointCelsius < Float.MAX_VALUE) { addRow(layout, "Dew point", FormatUtils.formatTemperature(metar.dewpointCelsius)); addRow(layout, "Relative humidity", String.format("%.0f%%", WxUtils.getRelativeHumidity(metar))); long denAlt = WxUtils.getDensityAltitude(metar); if (denAlt > mElevation) { addRow(layout, "Density altitude", FormatUtils.formatFeet(denAlt)); } } else { addRow(layout, "Dew point", "n/a"); } if (metar.maxTemp6HrCentigrade < Float.MAX_VALUE) { addRow(layout, "6-hour maximum", FormatUtils.formatTemperature(metar.maxTemp6HrCentigrade)); } if (metar.minTemp6HrCentigrade < Float.MAX_VALUE) { addRow(layout, "6-hour minimum", FormatUtils.formatTemperature(metar.minTemp6HrCentigrade)); } if (metar.maxTemp24HrCentigrade < Float.MAX_VALUE) { addRow(layout, "24-hour maximum", FormatUtils.formatTemperature(metar.maxTemp24HrCentigrade)); } if (metar.minTemp24HrCentigrade < Float.MAX_VALUE) { addRow(layout, "24-hour minimum", FormatUtils.formatTemperature(metar.minTemp24HrCentigrade)); } visibility = View.VISIBLE; } tv.setVisibility(visibility); layout.setVisibility(visibility); // Pressure tv = (TextView) findViewById(R.id.wx_pressure_label); layout = (LinearLayout) findViewById(R.id.wx_pressure_layout); layout.removeAllViews(); visibility = View.GONE; if (metar.altimeterHg < Float.MAX_VALUE) { addRow(layout, "Altimeter", FormatUtils.formatAltimeter(metar.altimeterHg)); if (metar.seaLevelPressureMb < Float.MAX_VALUE) { addRow(layout, "Sea level pressure", String.format("%s mb", FormatUtils.formatNumber(metar.seaLevelPressureMb))); } long presAlt = WxUtils.getPressureAltitude(metar); if (presAlt > mElevation) { addRow(layout, "Pressure altitude", FormatUtils.formatFeet(presAlt)); } if (metar.pressureTend3HrMb < Float.MAX_VALUE) { addRow(layout, "3-hour tendency", String.format("%+.2f mb", metar.pressureTend3HrMb)); } if (metar.presfr) { addRow(layout, "Pressure falling rapidly"); } if (metar.presrr) { addRow(layout, "Pressure rising rapidly"); } visibility = View.VISIBLE; } tv.setVisibility(visibility); layout.setVisibility(visibility); // Precipitation tv = (TextView) findViewById(R.id.wx_precip_label); layout = (LinearLayout) findViewById(R.id.wx_precip_layout); layout.removeAllViews(); if (metar.precipInches < Float.MAX_VALUE) { addRow(layout, "1-hour precipitation", String.format("%.2f\"", metar.precipInches)); } if (metar.precip3HrInches < Float.MAX_VALUE) { addRow(layout, "3-hour precipitation", String.format("%.2f\"", metar.precip3HrInches)); } if (metar.precip6HrInches < Float.MAX_VALUE) { addRow(layout, "6-hour precipitation", String.format("%.2f\"", metar.precip6HrInches)); } if (metar.precip24HrInches < Float.MAX_VALUE) { addRow(layout, "24-hour precipitation", String.format("%.2f\"", metar.precip24HrInches)); } if (metar.snowInches < Float.MAX_VALUE) { addRow(layout, "Snow depth", String.format("%.0f\"", metar.snowInches)); } if (metar.snincr) { addRow(layout, "Snow is increasing rapidly"); } visibility = layout.getChildCount() > 0 ? View.VISIBLE : View.GONE; tv.setVisibility(visibility); layout.setVisibility(visibility); // Remarks tv = (TextView) findViewById(R.id.wx_remarks_label); layout = (LinearLayout) findViewById(R.id.wx_remarks_layout); layout.removeAllViews(); for (Flags flag : metar.flags) { addBulletedRow(layout, flag.toString()); } for (String remark : mRemarks) { addBulletedRow(layout, remark); } visibility = layout.getChildCount() > 0 ? View.VISIBLE : View.GONE; tv.setVisibility(visibility); layout.setVisibility(visibility); // Fetch time tv = (TextView) findViewById(R.id.wx_fetch_time); tv.setText("Fetched on " + TimeUtils.formatDateTime(getActivity(), metar.fetchTime)); tv.setVisibility(View.VISIBLE); stopRefreshAnimation(); setFragmentContentShown(true); }
From source file:edu.snu.leader.hidden.builder.AssertivenessAndDirectionIndividualBuilder.java
/** * Creates a preferred direction using a random value drawn from a * Gaussian distribution//from w w w . java2s . com * * @return The direction */ protected float createGaussianDirection() { int tries = 0; float direction = Float.MAX_VALUE; while (((_minDirection > direction) || (_maxDirection < direction)) && (_maxTries > tries)) { direction = _directionMean + ((float) _simState.getRandom().nextGaussian() * _directionStdDev); tries++; } if (_maxDirection < direction) { direction = _maxDirection; } else if (_minDirection > direction) { direction = _minDirection; } return direction; }
From source file:com.epam.catgenome.entity.vcf.VcfFilterForm.java
private void tryAddFloatingKeyFalueFilter(BooleanQuery.Builder builder, Map.Entry<String, Object> entry, String key, List list, Object val) { if (val instanceof Float || entry.getValue() instanceof Double) { builder.add(FloatPoint.newRangeQuery(key, list.get(0) != null ? (Float) list.get(0) : Float.MIN_VALUE, list.get(1) != null ? (Float) list.get(1) : Float.MAX_VALUE), BooleanClause.Occur.MUST); }//from ww w . ja v a2 s. co m }
From source file:org.vertx.java.http.eventbusbridge.integration.MessageSendWithReplyTest.java
@Test public void testSendingFloatJsonWithResponseJson() throws IOException { final EventBusMessageType messageType = EventBusMessageType.Float; final Float sentFloat = Float.MAX_VALUE; int port = findFreePort(); String responseUrl = createHttpServerUrl(port); Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentFloat.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON); String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations); createHttpServer(port, MediaType.APPLICATION_JSON, responseBody); Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentFloat, expectations); vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler); String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations); HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON); }
From source file:tilt.image.page.Line.java
Point closestTo(Point other) { float minDist = Float.MAX_VALUE; Point minP = null;/*from w ww . j av a2s . c om*/ for (Point p : points) { float dist = p.distance(other); if (dist < minDist) { minDist = dist; minP = p; } } return minP; }
From source file:pipeline.misc_util.Utils.java
public static int indexOfMin(float[] a) { float min = Float.MAX_VALUE; int min_index = -1; for (int i = 0; i < a.length; i++) { if (a[i] < min) { min = a[i];//from w ww .j a v a 2s.co m min_index = i; } } return min_index; }