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:com.ahm.fileupload.FileController.java
public void algo() throws Exception { if (this.file != null) { String fname = this.getFileName(this.file); if (this.checkFileType(fname)) { String path = this.processUpload(file); String fileSavePath = FacesContext.getCurrentInstance().getExternalContext() .getRealPath(this.path_to); String pp = fileSavePath + "/" + path; try { this.targetsMax = Float.MIN_VALUE; this.targetsMin = Float.MAX_VALUE; this.estimates = new ArrayList<Float>(); this.targets = new ArrayList<Float>(); File filBefore = new File(pp); this.readLastInputColumn(filBefore); AHN.useAHN(pp, pp, this.moleculas, this.eta); File filAfter = new File(pp); this.estimatesMax = Float.MIN_VALUE; this.estimastesMin = Float.MAX_VALUE; this.readResult(filAfter); this.createLineModels(); this.activo = true; RequestContext.getCurrentInstance().update("main:graf"); } catch (Exception e) { e.printStackTrace();/*from ww w. j a v a 2s . c o m*/ } FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); File filer = new File(pp); if (!filer.exists()) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } Faces.sendFile(filer, false); this.deleteFile(path); } else { FacesContext context = FacesContext.getCurrentInstance(); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error! Your file is not a csv.", "Your file is not a csv.")); } } }
From source file:com.epam.catgenome.entity.vcf.VcfFilterForm.java
private void addQualityFilter(BooleanQuery.Builder builder) { if (quality != null && !quality.isEmpty()) { if (quality.size() < 2) { builder.add(FloatPoint.newExactQuery(FeatureIndexFields.QUALITY.getFieldName(), quality.get(0)), BooleanClause.Occur.MUST); } else {// www.jav a 2s. c o m Assert.isTrue(quality.get(0) != null || quality.get(1) != null, "Incorrect filter parameter:" + " quality:[null, null]"); builder.add( FloatPoint.newRangeQuery(FeatureIndexFields.QUALITY.getFieldName(), quality.get(0) != null ? quality.get(0) : Float.MIN_VALUE, quality.get(1) != null ? quality.get(1) : Float.MAX_VALUE), BooleanClause.Occur.MUST); } } }
From source file:edu.utexas.quietplaces.services.PlacesUpdateService.java
/** * {@inheritDoc}//from ww w . ja va 2s . com * Checks the battery and connectivity state before removing stale venues * and initiating a server poll for new venues around the specified * location within the given radius. */ @Override protected void onHandleIntent(Intent intent) { // Check if we're running in the foreground, if not, check if // we have permission to do background updates. //noinspection deprecation boolean backgroundAllowed = cm.getBackgroundDataSetting(); boolean inBackground = prefs.getBoolean(PlacesConstants.EXTRA_KEY_IN_BACKGROUND, true); if (!backgroundAllowed && inBackground) return; // Extract the location and radius around which to conduct our search. Location location = new Location(PlacesConstants.CONSTRUCTED_LOCATION_PROVIDER); int radius = PlacesConstants.PLACES_SEARCH_RADIUS; Bundle extras = intent.getExtras(); if (intent.hasExtra(PlacesConstants.EXTRA_KEY_LOCATION)) { location = (Location) (extras.get(PlacesConstants.EXTRA_KEY_LOCATION)); radius = extras.getInt(PlacesConstants.EXTRA_KEY_RADIUS, PlacesConstants.PLACES_SEARCH_RADIUS); } // Check if we're in a low battery situation. IntentFilter batIntentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); Intent battery = registerReceiver(null, batIntentFilter); lowBattery = getIsLowBattery(battery); // Check if we're connected to a data network, and if so - if it's a mobile network. NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); mobileData = activeNetwork != null && activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE; // If we're not connected, enable the connectivity receiver and disable the location receiver. // There's no point trying to poll the server for updates if we're not connected, and the // connectivity receiver will turn the location-based updates back on once we have a connection. if (!isConnected) { Log.w(TAG, "Not connected!"); } else { // If we are connected check to see if this is a forced update (typically triggered // when the location has changed). boolean doUpdate = intent.getBooleanExtra(PlacesConstants.EXTRA_KEY_FORCEREFRESH, false); // If it's not a forced update (for example from the Activity being restarted) then // check to see if we've moved far enough, or there's been a long enough delay since // the last update and if so, enforce a new update. if (!doUpdate) { // Retrieve the last update time and place. long lastTime = prefs.getLong(PlacesConstants.SP_KEY_LAST_LIST_UPDATE_TIME, Long.MIN_VALUE); float lastLat; try { lastLat = prefs.getFloat(PlacesConstants.SP_KEY_LAST_LIST_UPDATE_LAT, Float.MIN_VALUE); } catch (ClassCastException e) { // handle legacy version lastLat = Float.MIN_VALUE; } float lastLng; try { lastLng = prefs.getFloat(PlacesConstants.SP_KEY_LAST_LIST_UPDATE_LNG, Float.MIN_VALUE); } catch (ClassCastException e) { lastLng = Float.MIN_VALUE; } Location lastLocation = new Location(PlacesConstants.CONSTRUCTED_LOCATION_PROVIDER); lastLocation.setLatitude(lastLat); lastLocation.setLongitude(lastLng); long currentTime = System.currentTimeMillis(); float distanceMovedSinceLast = lastLocation.distanceTo(location); long elapsedTime = currentTime - lastTime; Log.i(TAG, "Last Location in places update service: " + lastLocation + " distance to current: " + distanceMovedSinceLast + " - current: " + location); if (location == null) { Log.w(TAG, "Location is null..."); } // If update time and distance bounds have been passed, do an update. else if (lastTime < currentTime - PlacesConstants.MAX_TIME_BETWEEN_PLACES_UPDATE) { Log.i(TAG, "Time bounds passed on places update, " + elapsedTime / 1000 + "s elapsed"); doUpdate = true; } else if (distanceMovedSinceLast > PlacesConstants.MIN_DISTANCE_TRIGGER_PLACES_UPDATE) { Log.i(TAG, "Distance bounds passed on places update, moved: " + distanceMovedSinceLast + " meters, time elapsed: " + elapsedTime / 1000 + "s"); doUpdate = true; } else { Log.d(TAG, "Time/distance bounds not passed on places update. Moved: " + distanceMovedSinceLast + " meters, time elapsed: " + elapsedTime / 1000 + "s"); } } if (location == null) { Log.e(TAG, "null location in onHandleIntent"); } else if (doUpdate) { // Refresh the prefetch count for each new location. prefetchCount = 0; // Remove the old locations - TODO: we flush old locations, but if the next request // fails we are left high and dry removeOldLocations(location, radius); // Hit the server for new venues for the current location. refreshPlaces(location, radius, null); // Tell the main activity about the new results. Intent placesUpdatedIntent = new Intent(Config.ACTION_PLACES_UPDATED); LocalBroadcastManager.getInstance(this).sendBroadcast(placesUpdatedIntent); } else { Log.i(TAG, "Place List is fresh: Not refreshing"); } // Retry any queued checkins. /* Intent checkinServiceIntent = new Intent(this, PlaceCheckinService.class); startService(checkinServiceIntent); */ } Log.d(TAG, "Place List Download Service Complete"); }
From source file:org.esa.s1tbx.ocean.toolviews.polarview.SpectraDataAsar.java
public PolarData getPolarData(final int currentRec, final SpectraUnit spectraUnit) throws Exception { final boolean realBand = spectraUnit != SpectraUnit.IMAGINARY; spectrum = getSpectrum(currentRec, realBand); float minValue = getMinValue(realBand); float maxValue = getMaxValue(realBand); if (waveProductType == SpectraData.WaveProductType.WAVE_SPECTRA) { if (spectraUnit == SpectraUnit.INTENSITY) { minValue = Float.MAX_VALUE; maxValue = Float.MIN_VALUE; for (int i = 0; i < spectrum.length; i++) { for (int j = 0; j < spectrum[0].length; j++) { final float realVal = spectrum[i][j]; final float val = realVal * realVal; spectrum[i][j] = val; minValue = Math.min(minValue, val); maxValue = Math.max(maxValue, val); }// w ww . j av a 2s .c o m } } } else if (spectraUnit == SpectraUnit.AMPLITUDE || spectraUnit == SpectraUnit.INTENSITY) { // complex data final float imagSpectrum[][] = getSpectrum(currentRec, false); minValue = Float.MAX_VALUE; maxValue = Float.MIN_VALUE; for (int i = 0; i < spectrum.length; i++) { for (int j = 0; j < spectrum[0].length; j++) { final float realVal = spectrum[i][j]; final float imagVal = imagSpectrum[i][j]; float val; if (sign(realVal) == sign(imagVal)) { val = realVal * realVal + imagVal * imagVal; } else { val = 0.0F; } if (spectraUnit == SpectraUnit.AMPLITUDE) { val = (float) Math.sqrt(val); } spectrum[i][j] = val; minValue = Math.min(minValue, val); maxValue = Math.max(maxValue, val); } } } final float rStep = (float) (Math.log(lastWLBin) - Math.log(firstWLBin)) / (float) (numWLBins - 1); double logr = Math.log(firstWLBin) - (rStep / 2.0); final float thFirst; final float thStep; if (waveProductType == SpectraData.WaveProductType.WAVE_SPECTRA) { thFirst = firstDirBins + 5f; thStep = -dirBinStep; } else { thFirst = firstDirBins - 5f; thStep = dirBinStep; } final float radii[] = new float[spectrum[0].length + 1]; for (int j = 0; j <= spectrum[0].length; j++) { radii[j] = (float) (10000.0 / FastMath.exp(logr)); logr += rStep; } return new PolarData(spectrum, 90f + thFirst, thStep, radii, minValue, maxValue); }
From source file:fr.immotronic.ubikit.pems.smartbuilding.impl.node.HVACControllerNodeImpl.java
@Override public void setAmbientTemperature(float currentAmbientTemperature) throws IllegalArgumentException { if (currentAmbientTemperature < 0 || currentAmbientTemperature > 40) { throw new IllegalArgumentException("currentAmbientTemperature=" + currentAmbientTemperature + ". It MUST BE in the interval [0..40]."); }/* www .j a v a 2 s .com*/ switch (getPemLocalID()) { case ENOCEAN: switch (enoceanProfile) { case INTESIS_BOX_DK_RC_ENO_1i1iC_DEVICE: TemperatureAndSetPointEvent e = new TemperatureAndSetPointEvent(getActualNodeUID(), Float.MIN_VALUE, currentAmbientTemperature); lowerEventGate.postEvent(e); break; } break; default: break; } }
From source file:org.fhcrc.cpl.toolbox.statistics.BasicStatistics.java
public static float max(float[] values) { float maxValue = Float.MIN_VALUE; for (float value : values) if (value > maxValue) maxValue = value;//from w w w .j a v a2 s.co m return maxValue; }
From source file:com.stimulus.archiva.language.LanguageIdentifier.java
/** * Identify language of content./*from w w w .ja va2 s. c om*/ * * @param content is the content to analyze. * @return The 2 letter * <a href="http://www.w3.org/WAI/ER/IG/ert/iso639.htm">ISO 639 * language code</a> (en, fi, sv, ...) of the language that best * matches the specified content. */ public synchronized String identify(StringBuffer content) { //logger.debug("language identification sample:"); //logger.debug(content.toString()); StringBuffer text = content; if ((analyzeLength > 0) && (content.length() > analyzeLength)) { text = new StringBuffer().append(content); text.setLength(analyzeLength); } suspect.analyze(text); Iterator iter = suspect.getSorted().iterator(); float topscore = Float.MIN_VALUE; String lang = null; HashMap scores = new HashMap(); NGramEntry searched = null; while (iter.hasNext()) { searched = (NGramEntry) iter.next(); NGramEntry[] ngrams = (NGramEntry[]) ngramsIdx.get(searched.getSeq()); if (ngrams != null) { for (int j = 0; j < ngrams.length; j++) { NGramProfile profile = ngrams[j].getProfile(); Float pScore = (Float) scores.get(profile); if (pScore == null) { pScore = new Float(0); } float plScore = pScore.floatValue(); plScore += ngrams[j].getFrequency() + searched.getFrequency(); scores.put(profile, new Float(plScore)); if (plScore > topscore) { topscore = plScore; lang = profile.getName(); } } } } logger.debug("document language identified {language='" + lang + "'}"); return lang; }
From source file:org.fhcrc.cpl.toolbox.statistics.BasicStatistics.java
public static double max(List<? extends Number> values) { double maxValue = Float.MIN_VALUE; for (Number value : values) if (value.doubleValue() > maxValue) maxValue = value.doubleValue(); return maxValue; }
From source file:org.compass.core.lucene.engine.highlighter.DefaultLuceneHighlighterFactory.java
protected Formatter createFormatter(String highlighterName, CompassSettings settings) throws SearchEngineException { Formatter formatter;// w w w. ja v a2s . c o m Object obj = settings.getSettingAsObject(LuceneEnvironment.Highlighter.Formatter.TYPE); if (obj instanceof Formatter) { formatter = (Formatter) obj; if (log.isDebugEnabled()) { log.debug("Highlighter [" + highlighterName + "] uses formatter instance [" + formatter + "]"); } } else { String formatterSettings = settings.getSetting(LuceneEnvironment.Highlighter.Formatter.TYPE, LuceneEnvironment.Highlighter.Formatter.SIMPLE); if (log.isDebugEnabled()) { log.debug("Highlighter [" + highlighterName + "] uses formatter [" + formatterSettings + "]"); } if (LuceneEnvironment.Highlighter.Formatter.SIMPLE.equals(formatterSettings)) { String preTag = settings.getSetting(LuceneEnvironment.Highlighter.Formatter.SIMPLE_PRE_HIGHLIGHT, "<b>"); String postTag = settings.getSetting(LuceneEnvironment.Highlighter.Formatter.SIMPLE_POST_HIGHLIGHT, "</b>"); formatter = new SimpleHTMLFormatter(preTag, postTag); if (log.isDebugEnabled()) { log.debug("Highlighter [" + highlighterName + "] uses pre [" + preTag + "] and post [" + postTag + "]"); } } else if (LuceneEnvironment.Highlighter.Formatter.HTML_SPAN_GRADIENT.equals(formatterSettings)) { float maxScore = settings.getSettingAsFloat( LuceneEnvironment.Highlighter.Formatter.HTML_SPAN_GRADIENT_MAX_SCORE, Float.MIN_VALUE); if (maxScore == Float.MIN_VALUE) { throw new SearchEngineException("Highlighter [" + highlighterName + "] uses span formatter and must set the [" + LuceneEnvironment.Highlighter.Formatter.HTML_SPAN_GRADIENT_MAX_SCORE + "] setting"); } String minForegroundColor = settings.getSetting( LuceneEnvironment.Highlighter.Formatter.HTML_SPAN_GRADIENT_MIN_FOREGROUND_COLOR); String maxForegroundColor = settings.getSetting( LuceneEnvironment.Highlighter.Formatter.HTML_SPAN_GRADIENT_MAX_FOREGROUND_COLOR); String minBackgroundColor = settings.getSetting( LuceneEnvironment.Highlighter.Formatter.HTML_SPAN_GRADIENT_MIN_BACKGROUND_COLOR); String maxBackgroundColor = settings.getSetting( LuceneEnvironment.Highlighter.Formatter.HTML_SPAN_GRADIENT_MAX_BACKGROUND_COLOR); try { formatter = new SpanGradientFormatter(maxScore, minForegroundColor, maxForegroundColor, minBackgroundColor, maxBackgroundColor); } catch (IllegalArgumentException e) { throw new SearchEngineException("Highlighter [" + highlighterName + "] using span gradient formatter failed [" + e.getMessage() + "]"); } } else { try { // the formatter is the fully qualified class name formatter = (Formatter) ClassUtils.forName(formatterSettings, settings.getClassLoader()) .newInstance(); } catch (Exception e) { throw new SearchEngineException( "Cannot instantiate Lucene formatter [" + formatterSettings + "] for highlighter [" + highlighterName + "]. Please verify the highlighter formatter setting at [" + LuceneEnvironment.Highlighter.Formatter.TYPE + "]", e); } } } if (formatter instanceof CompassConfigurable) { ((CompassConfigurable) formatter).configure(settings); } return formatter; }
From source file:it.geosolutions.jaiext.range.RangeTest.java
@BeforeClass public static void initialSetup() { arrayB = new byte[] { 0, 1, 5, 50, 100 }; arrayUS = new short[] { 0, 1, 5, 50, 100 }; arrayS = new short[] { -10, 0, 5, 50, 100 }; arrayI = new int[] { -10, 0, 5, 50, 100 }; arrayF = new float[] { -10, 0, 5, 50, 100 }; arrayD = new double[] { -10, 0, 5, 50, 100 }; arrayL = new long[] { -10, 0, 5, 50, 100 }; rangeB2bounds = RangeFactory.create((byte) 2, true, (byte) 60, true); rangeBpoint = RangeFactory.create(arrayB[2], true, arrayB[2], true); rangeU2bounds = RangeFactory.createU((short) 2, true, (short) 60, true); rangeUpoint = RangeFactory.createU(arrayUS[2], true, arrayUS[2], true); rangeS2bounds = RangeFactory.create((short) 1, true, (short) 60, true); rangeSpoint = RangeFactory.create(arrayS[2], true, arrayS[2], true); rangeI2bounds = RangeFactory.create(1, true, 60, true); rangeIpoint = RangeFactory.create(arrayI[2], true, arrayI[2], true); rangeF2bounds = RangeFactory.create(0.5f, true, 60.5f, true, false); rangeFpoint = RangeFactory.create(arrayF[2], true, arrayF[2], true, false); rangeD2bounds = RangeFactory.create(1.5d, true, 60.5d, true, false); rangeDpoint = RangeFactory.create(arrayD[2], true, arrayD[2], true, false); rangeL2bounds = RangeFactory.create(1L, true, 60L, true); rangeLpoint = RangeFactory.create(arrayL[2], true, arrayL[2], true); arrayBtest = new Byte[100]; arrayStest = new Short[100]; arrayItest = new Integer[100]; arrayFtest = new Float[100]; arrayDtest = new Double[100]; // Random value creation for the various Ranges for (int j = 0; j < 100; j++) { double randomValue = Math.random(); arrayBtest[j] = (byte) (randomValue * (Byte.MAX_VALUE - Byte.MIN_VALUE) + Byte.MIN_VALUE); arrayStest[j] = (short) (randomValue * (Short.MAX_VALUE - Short.MIN_VALUE) + Short.MIN_VALUE); arrayItest[j] = (int) (randomValue * (Integer.MAX_VALUE - Integer.MIN_VALUE) + Integer.MIN_VALUE); arrayFtest[j] = (float) (randomValue * (Float.MAX_VALUE - Float.MIN_VALUE) + Float.MIN_VALUE); arrayDtest[j] = (randomValue * (Double.MAX_VALUE - Double.MIN_VALUE) + Double.MIN_VALUE); }/*from w ww .java2s . c om*/ // JAI tools Ranges rangeJTB = org.jaitools.numeric.Range.create((byte) 1, true, (byte) 60, true); rangeJTS = org.jaitools.numeric.Range.create((short) 1, true, (short) 60, true); rangeJTI = org.jaitools.numeric.Range.create(1, true, 60, true); rangeJTF = org.jaitools.numeric.Range.create(0.5f, true, 60.5f, true); rangeJTD = org.jaitools.numeric.Range.create(1.5d, true, 60.5d, true); // 1 point Ranges rangeJTBpoint = org.jaitools.numeric.Range.create((byte) 5, true, (byte) 5, true); rangeJTSpoint = org.jaitools.numeric.Range.create((short) 5, true, (short) 5, true); rangeJTIpoint = org.jaitools.numeric.Range.create(5, true, 5, true); rangeJTFpoint = org.jaitools.numeric.Range.create(5f, true, 5f, true); rangeJTDpoint = org.jaitools.numeric.Range.create(5d, true, 5d, true); // JAI Ranges rangeJAIB = new javax.media.jai.util.Range(Byte.class, (byte) 1, true, (byte) 60, true); rangeJAIS = new javax.media.jai.util.Range(Short.class, (short) 1, true, (short) 60, true); rangeJAII = new javax.media.jai.util.Range(Integer.class, 1, true, 60, true); rangeJAIF = new javax.media.jai.util.Range(Float.class, 0.5f, true, 60.5f, true); rangeJAID = new javax.media.jai.util.Range(Double.class, 1.5d, true, 60.5d, true); // 1 point Ranges rangeJAIBpoint = new javax.media.jai.util.Range(Byte.class, (byte) 5, true, (byte) 5, true); rangeJAISpoint = new javax.media.jai.util.Range(Short.class, (short) 5, true, (short) 5, true); rangeJAIIpoint = new javax.media.jai.util.Range(Integer.class, 5, true, 5, true); rangeJAIFpoint = new javax.media.jai.util.Range(Float.class, 5f, true, 5f, true); rangeJAIDpoint = new javax.media.jai.util.Range(Double.class, 5d, true, 5d, true); // Apache Common Ranges rangeCommonsB = new org.apache.commons.lang.math.IntRange((byte) 1, (byte) 60); rangeCommonsS = new org.apache.commons.lang.math.IntRange((short) 1, (short) 60); rangeCommonsI = new org.apache.commons.lang.math.IntRange(1, 60); rangeCommonsF = new org.apache.commons.lang.math.FloatRange(0.5f, 60.5f); rangeCommonsD = new org.apache.commons.lang.math.DoubleRange(1.5d, 60.5d); // 1 point Ranges rangeCommonsBpoint = new org.apache.commons.lang.math.IntRange(5); rangeCommonsSpoint = new org.apache.commons.lang.math.IntRange(5); rangeCommonsIpoint = new org.apache.commons.lang.math.IntRange(5); rangeCommonsFpoint = new org.apache.commons.lang.math.FloatRange(5f); rangeCommonsDpoint = new org.apache.commons.lang.math.DoubleRange(5d); // // GeoTools Ranges // rangeGeoToolsB = new org.geotools.util.NumberRange<Byte>(Byte.class, (byte) 1, (byte) 60); // rangeGeoToolsS = new org.geotools.util.NumberRange<Short>(Short.class, (short) 1, // (short) 60); // rangeGeoToolsI = new org.geotools.util.NumberRange<Integer>(Integer.class, 1, 60); // rangeGeoToolsF = new org.geotools.util.NumberRange<Float>(Float.class, 0.5f, 60.5f); // rangeGeoToolsD = new org.geotools.util.NumberRange<Double>(Double.class, 1.5d, 60.5d); // // 1 point Ranges // rangeGeoToolsBpoint = new org.geotools.util.NumberRange<Byte>(Byte.class, (byte) 5, // (byte) 5); // rangeGeoToolsSpoint = new org.geotools.util.NumberRange<Short>(Short.class, (short) 5, // (short) 5); // rangeGeoToolsIpoint = new org.geotools.util.NumberRange<Integer>(Integer.class, 5, 5); // rangeGeoToolsFpoint = new org.geotools.util.NumberRange<Float>(Float.class, 5f, 5f); // rangeGeoToolsDpoint = new org.geotools.util.NumberRange<Double>(Double.class, 5d, 5d); // // Guava Ranges // rangeGuavaB = com.google.common.collect.Range.closed((byte) 1, (byte) 60); // rangeGuavaS = com.google.common.collect.Range.closed((short) 1, (short) 60); // rangeGuavaI = com.google.common.collect.Range.closed(1, 60); // rangeGuavaF = com.google.common.collect.Range.closed(0.5f, 60.5f); // rangeGuavaD = com.google.common.collect.Range.closed(1.5d, 60.5d); // // 1 point Ranges // rangeGuavaBpoint = com.google.common.collect.Range.singleton((byte) 5); // rangeGuavaSpoint = com.google.common.collect.Range.singleton((short) 5); // rangeGuavaIpoint = com.google.common.collect.Range.singleton(5); // rangeGuavaFpoint = com.google.common.collect.Range.singleton(5f); // rangeGuavaDpoint = com.google.common.collect.Range.singleton(5d); }