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:checkdb.CheckDb.java
private void makeChannelIndexTable() throws SQLException { Pattern ifoSubsysPat = Pattern.compile("(^.+):((.+?)[_-])?"); for (Entry<String, TreeMap<String, ChanStat>> csl : chanstats.entrySet()) { ChanIndexInfo cii = new ChanIndexInfo(); String cname = csl.getKey(); cii.setName(cname);/*from w w w . j a v a 2 s.c om*/ TreeMap<String, ChanStat> serverList = csl.getValue(); int n = serverList.size(); cii.setnServers(n); Matcher ifoSubsys = ifoSubsysPat.matcher(cname); if (ifoSubsys.find()) { cii.setIfo(ifoSubsys.group(1)); String subsys = ifoSubsys.group(3); subsys = subsys == null ? "" : subsys; cii.setSubsys(subsys); } else { cii.setIfo(""); cii.setSubsys(""); } float minRawRate = Float.MAX_VALUE; float maxRawRate = Float.MIN_VALUE; float minRdsRate = Float.MAX_VALUE; float maxRdsRate = Float.MIN_VALUE; boolean hasRaw = false; boolean hasRds = false; boolean hasOnline = false; boolean hasMtrends = false; boolean hasStrends = false; boolean hasTstpnt = false; boolean hasStatic = false; String cisAvail = " "; for (Entry<String, ChanStat> srv : serverList.entrySet()) { ChanStat cs = srv.getValue(); minRawRate = Math.min(minRawRate, cs.getMinRawRate()); maxRawRate = Math.max(maxRawRate, cs.getMaxRawRate()); maxRdsRate = Math.max(maxRdsRate, cs.getMaxRdsRate()); minRdsRate = Math.min(minRdsRate, cs.getMinRdsRate()); hasRaw |= cs.hasRaw(); hasRds |= cs.hasRds(); hasMtrends |= cs.hasMtrends(); hasStrends |= cs.hasStrend(); hasStatic |= cs.hasStatic(); hasOnline |= cs.hasOnline(); String cis = cs.getCisAvail(); if (cis.equalsIgnoreCase("d")) { cisAvail = cis; } else if (!cisAvail.equalsIgnoreCase("d") && cis.equalsIgnoreCase("a")) { cisAvail = cis; } } minRawRate = minRawRate == Float.MAX_VALUE ? 0 : minRawRate; cii.setMinRawRate(minRawRate); maxRawRate = maxRawRate == Float.MIN_VALUE ? 0 : maxRawRate; cii.setMaxRawRate(maxRawRate); minRdsRate = minRdsRate == Float.MAX_VALUE ? 0 : minRdsRate; cii.setMinRdsRate(minRdsRate); maxRdsRate = maxRdsRate == Float.MIN_VALUE ? 0 : maxRdsRate; cii.setMaxRdsRate(maxRdsRate); cii.setCisAvail(cisAvail); cii.setHasMtrends(hasMtrends); cii.setHasRaw(hasRaw); cii.setHasRds(hasRds); cii.setHasStrends(hasStrends); cii.setHasStatic(hasStatic); cii.setHasTestpoint(hasTstpnt); cii.setHasOnline(hasOnline); cidx.insertNewBulk(cii); } cidx.insertNewBulk(null); // flush any remaining }
From source file:com.wikitude.phonegap.WikitudePlugin.java
@Override public boolean execute(final String action, final JSONArray args, final CallbackContext callContext) { /* hide architect-view -> destroy and remove from activity */ if (WikitudePlugin.ACTION_CLOSE.equals(action)) { if (this.architectView != null) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override/*ww w .j a v a 2s. c o m*/ public void run() { removeArchitectView(); } }); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } return true; } /* return success only if view is opened (no matter if visible or not) */ if (WikitudePlugin.ACTION_STATE_ISOPEN.equals(action)) { if (this.architectView != null) { callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } return true; } /* return success only if view is opened (no matter if visible or not) */ if (WikitudePlugin.ACTION_IS_DEVICE_SUPPORTED.equals(action)) { if (ArchitectView.isDeviceSupported(this.cordova.getActivity()) && hasNeonSupport()) { callContext.success(action + ": this device is ARchitect-ready"); } else { callContext.error(action + action + ":Sorry, this device is NOT ARchitect-ready"); } return true; } if (WikitudePlugin.ACTION_CAPTURE_SCREEN.equals(action)) { if (architectView != null) { int captureMode = ArchitectView.CaptureScreenCallback.CAPTURE_MODE_CAM_AND_WEBVIEW; try { captureMode = (args.getBoolean(0)) ? ArchitectView.CaptureScreenCallback.CAPTURE_MODE_CAM_AND_WEBVIEW : ArchitectView.CaptureScreenCallback.CAPTURE_MODE_CAM; } catch (Exception e) { // unexpected error; } architectView.captureScreen(captureMode, new CaptureScreenCallback() { @Override public void onScreenCaptured(Bitmap screenCapture) { try { // final File imageDirectory = cordova.getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES); final File imageDirectory = Environment.getExternalStorageDirectory(); if (imageDirectory == null) { callContext.error("External storage not available"); } final File screenCaptureFile = new File(imageDirectory, System.currentTimeMillis() + ".jpg"); if (screenCaptureFile.exists()) { screenCaptureFile.delete(); } final FileOutputStream out = new FileOutputStream(screenCaptureFile); screenCapture.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); out.close(); cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { final String absoluteCaptureImagePath = screenCaptureFile.getAbsolutePath(); callContext.success(absoluteCaptureImagePath); // in case you want to sent the pic to other applications, uncomment these lines (for future use) // final Intent share = new Intent(Intent.ACTION_SEND); // share.setType("image/jpg"); // share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(screenCaptureFile)); // final String chooserTitle = "Share Snaphot"; // cordova.getActivity().startActivity(Intent.createChooser(share, chooserTitle)); } }); } catch (Exception e) { callContext.error(e.getMessage()); } } }); return true; } } /* life-cycle's RESUME */ if (WikitudePlugin.ACTION_ON_RESUME.equals(action)) { if (this.architectView != null) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { WikitudePlugin.this.architectView.onResume(); callContext.success(action + ": architectView is present"); locationProvider.onResume(); } }); // callContext.success( action + ": architectView is present" ); } else { callContext.error(action + ": architectView is not present"); } return true; } /* life-cycle's PAUSE */ if (WikitudePlugin.ACTION_ON_PAUSE.equals(action)) { if (architectView != null) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { WikitudePlugin.this.architectView.onPause(); locationProvider.onPause(); } }); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } return true; } /* set visibility to "visible", return error if view is null */ if (WikitudePlugin.ACTION_SHOW.equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (architectView != null) { architectView.setVisibility(View.VISIBLE); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } } }); return true; } /* set visibility to "invisible", return error if view is null */ if (WikitudePlugin.ACTION_HIDE.equals(action)) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (architectView != null) { architectView.setVisibility(View.INVISIBLE); callContext.success(action + ": architectView is present"); } else { callContext.error(action + ": architectView is not present"); } } }); return true; } /* define call-back for url-invocations */ if (WikitudePlugin.ACTION_ON_URLINVOKE.equals(action)) { this.urlInvokeCallback = callContext; final PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT, action + ": registered callback"); result.setKeepCallback(true); callContext.sendPluginResult(result); return true; } /* location update */ if (WikitudePlugin.ACTION_SET_LOCATION.equals(action)) { if (this.architectView != null) { try { final double lat = args.getDouble(0); final double lon = args.getDouble(1); float alt = Float.MIN_VALUE; try { alt = (float) args.getDouble(2); } catch (Exception e) { // invalid altitude -> ignore it } final float altitude = alt; Double acc = null; try { acc = args.getDouble(3); } catch (Exception e) { // invalid accuracy -> ignore it } final Double accuracy = acc; if (this.cordova != null && this.cordova.getActivity() != null) { cordova.getActivity().runOnUiThread( // this.cordova.getThreadPool().execute( new Runnable() { @Override public void run() { if (accuracy != null) { WikitudePlugin.this.architectView.setLocation(lat, lon, altitude, accuracy.floatValue()); } else { WikitudePlugin.this.architectView.setLocation(lat, lon, altitude); } } }); } } catch (Exception e) { callContext.error( action + ": exception thrown, " + e != null ? e.getMessage() : "(exception is NULL)"); return true; } callContext.success(action + ": updated location"); return true; } else { /* return error if there is no architect-view active*/ callContext.error(action + ": architectView is not present"); } return true; } if (WikitudePlugin.ACTION_CALL_JAVASCRIPT.equals(action)) { String logMsg = null; try { final String callJS = args.getString(0); logMsg = callJS; this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (architectView != null) { WikitudePlugin.this.architectView.callJavascript(callJS); } else { callContext.error(action + ": architectView is not present"); } } }); } catch (JSONException je) { callContext.error( action + ": exception thrown, " + je != null ? je.getMessage() : "(exception is NULL)"); return true; } callContext.success(action + ": called js, '" + logMsg + "'"); return true; } /* initial set-up, show ArchitectView full-screen in current screen/activity */ if (WikitudePlugin.ACTION_OPEN.equals(action)) { this.openCallback = callContext; PluginResult result = null; try { final String apiKey = args.getString(0); final String filePath = args.getString(1); this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { try { WikitudePlugin.this.addArchitectView(apiKey, filePath); /* call success method once architectView was added successfully */ if (openCallback != null) { PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(false); openCallback.sendPluginResult(result); } } catch (Exception e) { /* in case "addArchitectView" threw an exception -> notify callback method asynchronously */ openCallback.error(e != null ? e.getMessage() : "Exception is 'null'"); } } }); } catch (Exception e) { result = new PluginResult(PluginResult.Status.ERROR, action + ": exception thown, " + e != null ? e.getMessage() : "(exception is NULL)"); result.setKeepCallback(false); callContext.sendPluginResult(result); return true; } /* adding architect-view is done in separate thread, ensure to setKeepCallback so one can call success-method properly later on */ result = new PluginResult(PluginResult.Status.NO_RESULT, action + ": no result required, just registered callback-method"); result.setKeepCallback(true); callContext.sendPluginResult(result); return true; } /* fall-back return value */ callContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, "no such action: " + action)); return false; }
From source file:com.davidmiguel.gobees.recording.RecordingFragment.java
/** * Configure rain chart and the data.//w ww . j a v a 2 s . c om * * @param meteo meteo records. */ private void setupRainChart(List<MeteoRecord> meteo) { // Setup data List<Entry> entries = new ArrayList<>(); // Add as first entry a copy of the first rain record // First relative timestamp is 0 entries.add(new Entry(0, (float) meteo.get(0).getRain())); // Add all rain records float maxRain = Float.MIN_VALUE; for (MeteoRecord meteoRecord : meteo) { // Convert timestamp to seconds and relative to first timestamp long timestamp = meteoRecord.getTimestamp().getTime() / 1000 - referenceTimestamp; float rain = (float) meteoRecord.getRain(); entries.add(new Entry(timestamp, rain)); // Get max and min temperature if (rain > maxRain) { maxRain = rain; } } // Add as last entry a copy of the last rain record entries.add(new Entry(lastTimestamp, (float) meteo.get(meteo.size() - 1).getRain())); // Style char lines (type, color, etc.) RainValueFormatter rainValueFormatter = new RainValueFormatter(RainValueFormatter.Unit.MM); rainChart.setData(new LineData(configureWeatherChart(rainChart, R.string.rain, R.color.colorLineRainChart, R.color.colorFillRainChart, entries, rainValueFormatter, 0, maxRain + 1))); }
From source file:net.ymate.platform.core.lang.TreeObject.java
public TreeObject(Float f) { _object = f != null ? f : Float.MIN_VALUE; _type = TYPE_FLOAT; }
From source file:org.apache.nutch.analysis.lang.LanguageIdentifier.java
/** * Identify language of a content./*from ww w. j ava 2 s.c o m*/ * * @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 String identify(StringBuilder content) { StringBuilder text = content; if ((analyzeLength > 0) && (content.length() > analyzeLength)) { text = new StringBuilder().append(content); text.setLength(analyzeLength); } suspect.analyze(text); Iterator<NGramEntry> iter = suspect.getSorted().iterator(); float topscore = Float.MIN_VALUE; String lang = ""; HashMap<NGramProfile, Float> scores = new HashMap<NGramProfile, Float>(); NGramEntry searched = null; while (iter.hasNext()) { searched = iter.next(); NGramEntry[] ngrams = ngramsIdx.get(searched.getSeq()); if (ngrams != null) { for (int j = 0; j < ngrams.length; j++) { NGramProfile profile = ngrams[j].getProfile(); Float pScore = 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(); if (lang.equals("zh")) { return lang; } } } } } return lang; }
From source file:fr.immotronic.ubikit.pems.enocean.impl.item.IntesisBoxDKRCENO1i1iCDevice.java
private void sendDataTemperature(float setPointTemperature, float ambientTemperature) { if (setPointTemperature != Float.MIN_VALUE) { this.setPointTemperature = setPointTemperature; }/* w w w .j av a 2 s. c om*/ if (ambientTemperature != Float.MIN_VALUE) { this.ambientTemperature = ambientTemperature; } if (controller_10_03 != null) { byte setPoint; if (this.setPointTemperature < 0) setPoint = 0x00; else if (this.setPointTemperature > 40) setPoint = (byte) 0xff; else setPoint = (byte) ((int) (this.setPointTemperature * temperatureMultiplier) & 0xff); byte temp; if (this.ambientTemperature < 0) temp = (byte) 0xff; else if (this.ambientTemperature > 40) temp = 0x00; else temp = (byte) ((int) ((255 - (this.ambientTemperature * temperatureMultiplier))) & 0xff); byte[] bytes = { 0x8, temp, setPoint, 0x0 }; controller_10_03.sendDataTelegram(bytes); } }
From source file:edu.uci.ics.asterix.optimizer.rules.SimilarityCheckRule.java
private ScalarFunctionCallExpression getSimilarityCheckExpr(FunctionIdentifier normFuncIdent, AsterixConstantValue constVal, AbstractFunctionCallExpression funcExpr) throws AlgebricksException { // Remember args from original similarity function to add them to the similarity-check function later. ArrayList<Mutable<ILogicalExpression>> similarityArgs = null; ScalarFunctionCallExpression simCheckFuncExpr = null; // Look for jaccard function call, and GE or GT. if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.SIMILARITY_JACCARD) { IAObject jaccThresh;// w w w. ja v a 2 s.c o m if (normFuncIdent == AlgebricksBuiltinFunctions.GE) { if (constVal.getObject() instanceof AFloat) { jaccThresh = constVal.getObject(); } else { jaccThresh = new AFloat((float) ((ADouble) constVal.getObject()).getDoubleValue()); } } else if (normFuncIdent == AlgebricksBuiltinFunctions.GT) { float threshVal = 0.0f; if (constVal.getObject() instanceof AFloat) { threshVal = ((AFloat) constVal.getObject()).getFloatValue(); } else { threshVal = (float) ((ADouble) constVal.getObject()).getDoubleValue(); } float f = threshVal + Float.MIN_VALUE; if (f > 1.0f) f = 1.0f; jaccThresh = new AFloat(f); } else { return null; } similarityArgs = new ArrayList<Mutable<ILogicalExpression>>(); similarityArgs.addAll(funcExpr.getArguments()); similarityArgs.add(new MutableObject<ILogicalExpression>( new ConstantExpression(new AsterixConstantValue(jaccThresh)))); simCheckFuncExpr = new ScalarFunctionCallExpression( FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.SIMILARITY_JACCARD_CHECK), similarityArgs); } // Look for edit-distance function call, and LE or LT. if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE) { AInt32 aInt = new AInt32(0); try { aInt = (AInt32) ATypeHierarchy.convertNumericTypeObject(constVal.getObject(), ATypeTag.INT32); } catch (AsterixException e) { throw new AlgebricksException(e); } AInt32 edThresh; if (normFuncIdent == AlgebricksBuiltinFunctions.LE) { edThresh = aInt; } else if (normFuncIdent == AlgebricksBuiltinFunctions.LT) { int ed = aInt.getIntegerValue() - 1; if (ed < 0) ed = 0; edThresh = new AInt32(ed); } else { return null; } similarityArgs = new ArrayList<Mutable<ILogicalExpression>>(); similarityArgs.addAll(funcExpr.getArguments()); similarityArgs.add(new MutableObject<ILogicalExpression>( new ConstantExpression(new AsterixConstantValue(edThresh)))); simCheckFuncExpr = new ScalarFunctionCallExpression( FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK), similarityArgs); } // Preserve all annotations. if (simCheckFuncExpr != null) { simCheckFuncExpr.getAnnotations().putAll(funcExpr.getAnnotations()); } return simCheckFuncExpr; }
From source file:org.apache.asterix.optimizer.rules.SimilarityCheckRule.java
private ScalarFunctionCallExpression getSimilarityCheckExpr(FunctionIdentifier normFuncIdent, AsterixConstantValue constVal, AbstractFunctionCallExpression funcExpr) throws AlgebricksException { // Remember args from original similarity function to add them to the similarity-check function later. ArrayList<Mutable<ILogicalExpression>> similarityArgs = null; ScalarFunctionCallExpression simCheckFuncExpr = null; // Look for jaccard function call, and GE or GT. if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.SIMILARITY_JACCARD) { IAObject jaccThresh;/* w ww .j a va 2 s .c o m*/ if (normFuncIdent == AlgebricksBuiltinFunctions.GE) { if (constVal.getObject() instanceof AFloat) { jaccThresh = constVal.getObject(); } else { jaccThresh = new AFloat((float) ((ADouble) constVal.getObject()).getDoubleValue()); } } else if (normFuncIdent == AlgebricksBuiltinFunctions.GT) { float threshVal = 0.0f; if (constVal.getObject() instanceof AFloat) { threshVal = ((AFloat) constVal.getObject()).getFloatValue(); } else { threshVal = (float) ((ADouble) constVal.getObject()).getDoubleValue(); } float f = threshVal + Float.MIN_VALUE; if (f > 1.0f) f = 1.0f; jaccThresh = new AFloat(f); } else { return null; } similarityArgs = new ArrayList<Mutable<ILogicalExpression>>(); similarityArgs.addAll(funcExpr.getArguments()); similarityArgs.add(new MutableObject<ILogicalExpression>( new ConstantExpression(new AsterixConstantValue(jaccThresh)))); simCheckFuncExpr = new ScalarFunctionCallExpression( FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.SIMILARITY_JACCARD_CHECK), similarityArgs); } // Look for edit-distance function call, and LE or LT. if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE) { AInt32 aInt = new AInt32(0); try { aInt = (AInt32) ATypeHierarchy.convertNumericTypeObject(constVal.getObject(), ATypeTag.INT32); } catch (AsterixException e) { throw new AlgebricksException(e); } AInt32 edThresh; if (normFuncIdent == AlgebricksBuiltinFunctions.LE) { edThresh = aInt; } else if (normFuncIdent == AlgebricksBuiltinFunctions.LT) { int ed = aInt.getIntegerValue() - 1; if (ed < 0) ed = 0; edThresh = new AInt32(ed); } else { return null; } similarityArgs = new ArrayList<Mutable<ILogicalExpression>>(); similarityArgs.addAll(funcExpr.getArguments()); similarityArgs.add(new MutableObject<ILogicalExpression>( new ConstantExpression(new AsterixConstantValue(edThresh)))); simCheckFuncExpr = new ScalarFunctionCallExpression( FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK), similarityArgs); } // Preserve all annotations. if (simCheckFuncExpr != null) { simCheckFuncExpr.getAnnotations().putAll(funcExpr.getAnnotations()); } return simCheckFuncExpr; }
From source file:org.qi4j.runtime.value.CollectionTypeTest.java
private Collection<Float> floatCollection() { Collection<Float> value = new ArrayList<Float>(); value.add(-1f);/*from w w w.j ava 2 s . co m*/ value.add(1f); value.add(1f); value.add(0f); value.add(Float.MAX_VALUE); value.add(Float.MIN_VALUE); value.add(null); value.add(0.123456f); value.add(-0.232321f); return value; }
From source file:com.davidmiguel.gobees.recording.RecordingFragment.java
/** * Configure wind chart and the data./*from w ww. j a v a 2 s. co m*/ * * @param meteo meteo records. */ private void setupWindChart(List<MeteoRecord> meteo) { // Setup data List<Entry> entries = new ArrayList<>(); // Add as first entry a copy of the first wind record // First relative timestamp is 0 entries.add(new Entry(0, (float) meteo.get(0).getWindSpeed())); // Add all wind records float maxWind = Float.MIN_VALUE; for (MeteoRecord meteoRecord : meteo) { // Convert timestamp to seconds and relative to first timestamp long timestamp = meteoRecord.getTimestamp().getTime() / 1000 - referenceTimestamp; float wind = (float) meteoRecord.getWindSpeed(); entries.add(new Entry(timestamp, wind)); // Get max and min temperature if (wind > maxWind) { maxWind = wind; } } // Add as last entry a copy of the last wind record entries.add(new Entry(lastTimestamp, (float) meteo.get(meteo.size() - 1).getWindSpeed())); // Style char lines (type, color, etc.) WindValueFormatter windValueFormatter = new WindValueFormatter(WindValueFormatter.Unit.MS); windChart.setData(new LineData(configureWeatherChart(windChart, R.string.wind, R.color.colorLineWindChart, R.color.colorFillWindChart, entries, windValueFormatter, 0, maxWind + 5))); }