List of usage examples for java.lang Integer MIN_VALUE
int MIN_VALUE
To view the source code for java.lang Integer MIN_VALUE.
Click Source Link
From source file:au.org.ala.delta.model.image.Image.java
public void moveToBottom(ImageOverlay overlay) { move(overlay, Integer.MIN_VALUE); }
From source file:ac.elements.parser.SimpleDBConverter.java
/** * Encodes real integer value into a string by offsetting and zero-padding * number up to the specified number of digits. Use this encoding method if * the data range set includes both positive and negative values. * //ww w .j a v a 2 s . com * com.xerox.amazonws.sdb.DataUtils * * @param number * int to be encoded * @return string representation of the int */ private static String encodeInt(int number) { int maxNumDigits = BigInteger.valueOf(Integer.MAX_VALUE).subtract(BigInteger.valueOf(Integer.MIN_VALUE)) .toString(RADIX).length(); long offsetValue = Integer.MIN_VALUE; BigInteger offsetNumber = BigInteger.valueOf(number).subtract(BigInteger.valueOf(offsetValue)); String longString = offsetNumber.toString(RADIX); int numZeroes = maxNumDigits - longString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); } strBuffer.append(longString); return strBuffer.toString(); }
From source file:LongVector.java
/** * Deletes the component at the specified index. Each component in this * vector with an index greater or equal to the specified index is shifted * downward to have an index one smaller than the value it had previously. * // w ww .j a va2s . c o m * @param i * index of where to remove */ public final void removeElementAt(int i) { if (i > _size) System.arraycopy(_data, i + 1, _data, i, _size); else _data[i] = java.lang.Integer.MIN_VALUE; _size--; }
From source file:com.ning.metrics.collector.processing.counter.RollUpCounterProcessor.java
private Map<String, RolledUpCounter> streamAndProcessDailyCounterData(final String namespace, final DateTime toDateTime) { return dbi.withHandle(new HandleCallback<Map<String, RolledUpCounter>>() { @Override// w ww . j a v a 2 s . co m public Map<String, RolledUpCounter> withHandle(Handle handle) throws Exception { final String queryStr = "select metrics from metrics_buffer where `namespace` = :namespace" + " and `timestamp` <= :toDateTime"; Query<Map<String, Object>> query = handle.createQuery(queryStr).bind("namespace", namespace) .setFetchSize(Integer.MIN_VALUE); query.bind("toDateTime", DatabaseCounterStorage.DAILY_METRICS_DATE_FORMAT.print(toDateTime)); Map<String, RolledUpCounter> rolledUpCounterMap = new ConcurrentHashMap<String, RolledUpCounter>(); ResultIterator<CounterEventData> streamingIterator = null; try { streamingIterator = query.map(new CounterEventDataMapper(mapper)).iterator(); if (Objects.equal(null, streamingIterator)) { return rolledUpCounterMap; } while (streamingIterator.hasNext()) { processCounterEventData(namespace, rolledUpCounterMap, streamingIterator.next()); } } catch (Exception e) { log.error(String.format( "Exception occurred while streaming and rolling up daily counter for app id: %s", namespace), e); } finally { if (streamingIterator != null) { streamingIterator.close(); } } return rolledUpCounterMap; } }); }
From source file:tcc.iesgo.activity.ClientMapActivity.java
public void showMap(Location location) throws JSONException { if (location == null) location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); //ltimo local registrado minLatitude = Integer.MAX_VALUE; maxLatitude = Integer.MIN_VALUE; minLongitude = Integer.MAX_VALUE; maxLongitude = Integer.MIN_VALUE; //Rotina p/ atualizar os objetos do mapa Overlay obj = mapOverlays.get(0); //Posio atual do usurio mapOverlays.clear(); //Limpa Overlays do mapa mapOverlays.add(obj); //Adiciona o usuario no mapa mapView.invalidate(); //Atualiza o mapa //Fim rotina/* ww w . jav a2 s .c o m*/ //GeoPoint da posio atual do usurio geoActual = new GeoPoint((int) (location.getLatitude() * 1E6), (int) (location.getLongitude() * 1E6)); String taxis = getTaxis(location); //Json int length = getJsonResult(taxis, "id").length; String[] ids = new String[length]; ids = getJsonResult(taxis, "id"); String[] distances = new String[length]; distances = getJsonResult(taxis, "distance"); String[] latitudes = new String[length]; latitudes = getJsonResult(taxis, "latitude"); String[] longitudes = new String[length]; longitudes = getJsonResult(taxis, "longitude"); String[] names = new String[length]; names = getJsonResult(taxis, "name"); String[] vehicles = new String[length]; vehicles = getJsonResult(taxis, "vehicle"); String[] plaques = new String[length]; plaques = getJsonResult(taxis, "plaque"); String[] licenses = new String[length]; licenses = getJsonResult(taxis, "license"); String[] langs = new String[length]; langs = getJsonResult(taxis, "lang"); DecimalFormat conv = new DecimalFormat("0.00"); for (int i = 0; i < length; i++) { String[] languages = langs[i].split(","); String lang = ""; for (int j = 0; j < languages.length; j++) { if (languages[j].equals("pt")) { lang += "Portugus"; } else if (languages[j].equals("en")) { lang += ", Ingls"; } else if (languages[j].equals("es")) { lang += ", Espanhol"; } } double lat = Double.parseDouble(latitudes[i]); double lng = Double.parseDouble(longitudes[i]); //GeoPoint da posio atual do taxista geoTaxi = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6)); overlayitem = new OverlayItem(geoTaxi, "RG: " + ids[i] + " - " + names[i], "Descrio:\nDistncia: " + conv.format(Double.parseDouble(distances[i]) / 1000) + " km\nVeculo: " + vehicles[i] + "\nPlaca: " + plaques[i] + "\nLicena n: " + licenses[i] + "\nIdiomas Conhecidos: " + lang + "\n"); itemizedOverlay = new CustomItemizedOverlay(dTaxi, getParent(), mapView); itemizedOverlay.addOverlay(overlayitem); mapOverlays.add(itemizedOverlay); } //Localizao atual do usurio myLocationOverlay = new MyCustomLocationOverlay(ClientMapActivity.this, mapView); //Habilita o ponto azul de localizacao na tela myLocationOverlay.enableMyLocation(); //Habilita atualizacoes do sensor myLocationOverlay.enableCompass(); //Adiciona o overlay no mapa mapOverlays.add(myLocationOverlay); //Rotina p/ forar que todos os objetos encontrados apaream no mapa maxLatitude = Math.max(geoActual.getLatitudeE6(), maxLatitude); minLatitude = Math.min(geoActual.getLatitudeE6(), minLatitude); maxLongitude = Math.max(geoActual.getLongitudeE6(), maxLongitude); minLongitude = Math.min(geoActual.getLongitudeE6(), minLongitude); maxLatitude = Math.max(geoTaxi.getLatitudeE6(), maxLatitude); minLatitude = Math.min(geoTaxi.getLatitudeE6(), minLatitude); maxLongitude = Math.max(geoTaxi.getLongitudeE6(), maxLongitude); minLongitude = Math.min(geoTaxi.getLongitudeE6(), minLongitude); mc.animateTo(new GeoPoint((maxLatitude + minLatitude) / 2, (maxLongitude + minLongitude) / 2)); mc.zoomToSpan(Math.abs(maxLatitude - minLatitude), Math.abs(maxLongitude - minLongitude)); Integer zoomlevel = mapView.getZoomLevel(); Integer zoomlevel2 = zoomlevel - 1; mc.setZoom(zoomlevel2); //Fim rotina try { updateClientLocation(location); //Atualiza a posio do cliente } catch (Exception e) { Toast.makeText(ClientMapActivity.this, getString(R.string.login_error_connection), Toast.LENGTH_SHORT) .show(); } mapInfo.setText("O txi mais prximo de voc est a: " + conv.format(Double.parseDouble(distances[0]) / 1000) + " km"); }
From source file:com.od.jtimeseries.ui.visualizer.chart.creator.EfficientXYLineAndShapeRenderer.java
/** * Draws the item (first pass). This method draws the lines * connecting the items./*from www. java 2s.co m*/ * * @param g2 the graphics device. * @param state the renderer state. * @param dataArea the area within which the data is being drawn. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the domain axis. * @param rangeAxis the range axis. * @param dataset the dataset. * @param pass the pass. * @param series the series index (zero-based). * @param item the item index (zero-based). */ protected void drawPrimaryLine(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset, int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) { if (item == 0) { return; } // get the data point... double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); if (Double.isNaN(y1) || Double.isNaN(x1)) { return; } double x0 = dataset.getXValue(series, item - 1); double y0 = dataset.getYValue(series, item - 1); if (Double.isNaN(y0) || Double.isNaN(x0)) { return; } RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation); double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation); double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation); double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation); // only draw if we have good values if (Double.isNaN(transX0) || Double.isNaN(transY0) || Double.isNaN(transX1) || Double.isNaN(transY1)) { return; } int transX0Int = (int) transX0; int transX1Int = (int) transX1; //make sure we store the max and min y for this x boolean isSameX = transX0Int == transX1Int; if (isSameX) { minY = Math.min(transY0, minY); minY = Math.min(transY1, minY); maxY = Math.max(transY0, maxY); maxY = Math.max(transY1, maxY); storedLine = true; } //if we have moved x, or this the last item in the series, draw if (!isSameX || isLastItem(dataset, series, item)) { Stroke s = getItemStroke(series, item); Paint p = getItemPaint(series, item); if (storedLine) { drawLine(state, g2, plot, transX0Int, minY, transX0Int, maxY, s, p); linesDrawn++; } drawLine(state, g2, plot, transX0Int, transY0, transX1Int, transY1, s, p); linesDrawn++; storedLine = false; minY = Integer.MAX_VALUE; maxY = Integer.MIN_VALUE; } // if ( isLastItem(dataset, series, item)) { // System.out.println("Lines drawn " + linesDrawn + "/" + dataset.getItemCount(series)); // } }
From source file:android.support.test.espresso.web.model.ModelCodecTest.java
public void testEncodeDecode_map() { Map<String, Object> adhoc = Maps.newHashMap(); adhoc.put("yellow", 1234); adhoc.put("bar", "frog"); adhoc.put("int_max", Integer.MAX_VALUE); adhoc.put("int_min", Integer.MIN_VALUE); adhoc.put("double_min", Double.MIN_VALUE); adhoc.put("double_max", Double.MAX_VALUE); adhoc.put("sudz", Lists.newArrayList("goodbye")); assertEquals(adhoc, ModelCodec.decode(ModelCodec.encode(adhoc))); }
From source file:com.baidu.rigel.biplatform.tesseract.dataquery.service.impl.SqlDataQueryServiceImpl.java
/** * ?SQL??resultRecord list/*from ww w. j a va2 s . c om*/ * @param sqlQuery * @param dataSource * @param limitStart * @param limitEnd * @return */ private SearchIndexResultSet querySqlList(SqlQuery sqlQuery, DataSource dataSource, long limitStart, long limitEnd) { long current = System.currentTimeMillis(); if (sqlQuery == null || dataSource == null || limitEnd < 0) { throw new IllegalArgumentException(); } sqlQuery.setLimitMap(limitStart, limitEnd); this.initJdbcTemplate(dataSource); Meta meta = new Meta(sqlQuery.getSelectList().toArray(new String[0])); SearchIndexResultSet resultSet = new SearchIndexResultSet(meta, 1000000); jdbcTemplate.query(new PreparedStatementCreator() { @Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement pstmt = con.prepareStatement(sqlQuery.toSql(), ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); if (con.getMetaData().getDriverName().toLowerCase().contains("mysql")) { pstmt.setFetchSize(Integer.MIN_VALUE); } return pstmt; } }, new RowCallbackHandler() { @Override public void processRow(ResultSet rs) throws SQLException { List<Object> fieldValues = new ArrayList<Object>(); String groupBy = ""; for (String select : sqlQuery.getSelectList()) { fieldValues.add(rs.getObject(select)); if (sqlQuery.getGroupBy() != null && sqlQuery.getGroupBy().contains(select)) { groupBy += rs.getString(select) + ","; } } SearchIndexResultRecord record = new SearchIndexResultRecord( fieldValues.toArray(new Serializable[0]), groupBy); resultSet.addRecord(record); } }); LOGGER.info(String.format(LogInfoConstants.INFO_PATTERN_FUNCTION_END, "querySqlList", "[sqlQuery:" + sqlQuery.toSql() + "][dataSource:" + dataSource + "][limitStart:" + limitStart + "][limitEnd:" + limitEnd + "] cost" + (System.currentTimeMillis() - current + "ms!"))); return resultSet; }
From source file:com.jillesvangurp.geo.GeoGeometry.java
/** * @param multiPolygon 4d multipolygon array * @return bounding box that contains the multiPolygon as a double array of * [minLat,maxLat,minLon,maxLon} *//*from w w w .j a va 2 s . c o m*/ public static double[] boundingBox(double[][][][] multiPolygon) { double minLat = Integer.MAX_VALUE; double minLon = Integer.MAX_VALUE; double maxLat = Integer.MIN_VALUE; double maxLon = Integer.MIN_VALUE; for (int i = 0; i < multiPolygon.length; i++) { for (int j = 0; j < multiPolygon[i].length; j++) { for (int k = 0; k < multiPolygon[i][j].length; k++) { minLat = min(minLat, multiPolygon[i][j][k][1]); minLon = min(minLon, multiPolygon[i][j][k][0]); maxLat = max(maxLat, multiPolygon[i][j][k][1]); maxLon = max(maxLon, multiPolygon[i][j][k][0]); } } } return new double[] { minLat, maxLat, minLon, maxLon }; }
From source file:de.tudarmstadt.ukp.experiments.argumentation.convincingness.graph.VisualizationTest.java
/** * Computes max. transitivity score for the given node (as described in the paper) * <p/>/*from www . jav a2s .c om*/ * It uses Bellman-Ford algorithm to compute the shortest and longest paths * * @param graph graph (must be DAG) * @return statistics */ private static int computeMaxTransitivityScore(Graph graph, Node sourceNode) { if (sourceNode.getOutDegree() == 0) { return 0; } // find all out-degree > 1 nodes Set<Node> targetNodes = new HashSet<>(); for (Node n : graph) { if (n.getInDegree() > 1) { targetNodes.add(n); } } FileSourceDGS source = new FileSourceDGS(); source.addSink(graph); DescriptiveStatistics result = new DescriptiveStatistics(); // set positive weight first for (Edge e : graph.getEdgeSet()) { e.setAttribute(WEIGHT, 1.0); } BellmanFord bfShortest = new BellmanFord(WEIGHT, sourceNode.getId()); bfShortest.init(graph); bfShortest.compute(); // now negative weight for longest-path for (Edge e : graph.getEdgeSet()) { e.setAttribute(WEIGHT, -1.0); } BellmanFord bfLongest = new BellmanFord(WEIGHT, sourceNode.getId()); bfLongest.init(graph); bfLongest.compute(); int maxTransitivityScore = Integer.MIN_VALUE; for (Node targetNode : targetNodes) { Path shortestPath = bfShortest.getShortestPath(targetNode); Path longestPath = bfLongest.getShortestPath(targetNode); int shortestPathLength = shortestPath.getEdgeCount(); int longestPathLength = longestPath.getEdgeCount(); if (shortestPathLength == 1 && longestPathLength > 1) { // update statistics maxTransitivityScore = Math.max(maxTransitivityScore, longestPathLength); } } // none found maxTransitivityScore = Math.max(maxTransitivityScore, 0); return maxTransitivityScore; }