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:com.mozilla.simplepush.simplepushdemoapp.MainActivity.java
private String getRegistrationId(Context context) { final SharedPreferences prefs = getGcmPreferences(context); String registrationId = prefs.getString(PROPERTY_REG_ID, ""); if (registrationId == null || registrationId.isEmpty()) { Log.i(TAG, "Registration not found."); return ""; }/*from w w w. ja v a2 s . com*/ int registeredVersion = prefs.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE); int currentVersion = getAppVersion(context); if (registeredVersion != currentVersion) { Log.i(TAG, "App version changed."); return ""; } return registrationId; }
From source file:com.github.veqryn.net.Cidr4.java
/** * Constructor that takes the low and high integer values of the CIDR range. * Where Integer.MIN_VALUE = 0.0.0.0/* w w w . j av a 2s. c o m*/ * and 0 = 128.0.0.0 * and Integer.MAX_VALUE = 255.255.255.255 * * @param lowIp Low value of CIDR range * @param highIp High value of CIDR range * @param binary false if using a sortable packed integer, * where Integer.MIN_VALUE = 0.0.0.0 * and 0 = 128.0.0.0 * and Integer.MAX_VALUE = 255.255.255.255<br> * true if using a binary integer, * where Integer.MIN_VALUE = 128.0.0.0 * and 0 = 0.0.0.0 * and Integer.MAX_VALUE = 127.255.255.255 * and -1 = 255.255.255.255 */ protected Cidr4(final int lowIp, final int highIp, final boolean binary) { int network = binary ? lowIp : lowIp ^ Integer.MIN_VALUE; final int broadcast = binary ? highIp : highIp ^ Integer.MIN_VALUE; // if low and high do not actually match with the netmask that would contains them // we must manually figure out and re-apply the netmask // example: 192.168.211.245--192.168.211.247 should become 192.168.211.244--192.168.211.247 final int netmask = getDifferenceNetmask(network, broadcast); network = getLowestBinaryWithNetmask(network, netmask); this.low = network ^ Integer.MIN_VALUE; this.high = getHighestBinaryWithNetmask(network, netmask) ^ Integer.MIN_VALUE; if (this.low > this.high) { throw new IllegalArgumentException("Low IP value must be <= High IP value"); } }
From source file:com.sun.faces.demotest.cardemo.TestCarDemo.java
protected int getNumberNearLabel(String label, HtmlPage page) { List cells;// ww w .j a va2 s . c om Iterator iter = null; HtmlTableDataCell cell = null; String yourPrice = null; int result = Integer.MIN_VALUE; cells = getAllElementsOfGivenClass(page, null, HtmlTableDataCell.class); iter = cells.iterator(); yourPrice = resources.getString(label).trim(); // look in the current or next cell for the price data. while (iter.hasNext()) { cell = (HtmlTableDataCell) iter.next(); if (-1 != cell.asText().indexOf(yourPrice)) { if (Integer.MIN_VALUE != (result = extractNumberFromText(cell.asText().trim()))) { return result; } // try the next cell cell = (HtmlTableDataCell) iter.next(); if (Integer.MIN_VALUE != (result = extractNumberFromText(cell.asText().trim()))) { return result; } } } return Integer.MIN_VALUE; }
From source file:fr.immotronic.ubikit.pems.enocean.impl.item.data.EEPA512xxDataImpl.java
public void setCounterValue(int channel, ValueType dataType, float value, Date date) { if (channel < 0 || channel > 15) return;// w w w . ja va 2 s . co m if (channels[channel] == null) channels[channel] = new Channel(Integer.MIN_VALUE, null, Integer.MIN_VALUE, null); if (dataType == ValueType.CUMULATIVE) channels[channel].setCumulativeValue(value, date); else if (dataType == ValueType.CURRENT) channels[channel].setCurrentValue(value, date); this.date = date; }
From source file:edu.ku.brc.specify.toycode.mexconabio.BuildFromRecovery.java
/** * //from w w w . ja v a2 s.c o m */ public void process() throws SQLException { buildTags = new BuildTags(); buildTags.setDbConn(dbConn); buildTags.setDbConn2(dbConn); buildTags.initialPrepareStatements(); BasicSQLUtils.setDBConnection(dbConn); IdMapperMgr idMapperMgr = IdMapperMgr.getInstance(); idMapperMgr.setDBs(srcDBConn2, dbConn); geoStmt1 = dbConn.prepareStatement( "SELECT GeographyID FROM geography WHERE RankID = ? AND ParentID = ? AND LOWER(Abbrev) = ?"); geoStmt2 = dbConn .prepareStatement("SELECT GeographyID FROM geography WHERE RankID = ? AND LOWER(Abbrev) = ?"); agentStmt = dbConn .prepareStatement("SELECT AgentID FROM agent WHERE LOWER(FirstName) = ? AND LOWER(LastName) = ?"); tagStmt = dbConn.prepareStatement( "SELECT CollectionObjectID FROM collectionobject WHERE CollectionID = 4 AND LOWER(FieldNumber) = ?"); BasicSQLUtils.update(srcDBConn, "UPDATE recovery SET r_date = null WHERE r_date = '0000-00-00'"); boolean doTags = true; if (doTags) { int divId = 2; int dspId = 3; int colId = 32768; String sql = "SELECT tagid, " + "r_city, r_state, r_zip, r_country, r_date, r_lat, r_long, " + "reporter_first, reporter_last, reporter_city, reporter_state, reporter_country, reporter_zip, " + "dir, dist, gender, " + "t_first, t_middle, t_last, t_city, t_state, t_country, t_postalcode, t_org, t_lat, t_long, t_date FROM recovery ORDER BY recovid ASC"; Statement stmt = srcDBConn.createStatement(); stmt.setFetchSize(Integer.MIN_VALUE); log.debug("Querying for Tags..."); ResultSet rs = stmt.executeQuery(sql); int cnt = 0; log.debug("Done querying for Tags..."); Calendar cal = Calendar.getInstance(); Timestamp ts = new Timestamp(cal.getTime().getTime()); String common = "TimestampCreated, Version, CreatedByAgentID"; String coStr = String.format( "INSERT INTO collectionobject (CatalogNumber, FieldNumber, Text1, Text2, Remarks, CollectionID, CollectionMemberId, CollectingEventID, %s) VALUES(?,?,?,?,?,?,?,?,?,?,?)", common); String ceStr = String.format( "INSERT INTO collectingevent (StartDate, DisciplineID, LocalityID, %s) VALUES(?,?,?,?,?,?)", common); String lcStr = String.format( "INSERT INTO locality (Latitude1, Longitude1, SrcLatLongUnit, Lat1text, Long1text, LatLongType, DisciplineID, LocalityName, GeographyID, %s) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)", common); String clStr = String.format( "INSERT INTO collector (OrderNumber, IsPrimary, CollectingEventID, DivisionID, AgentID, %s) VALUES(?,?,?,?,?,?,?,?)", common); String rlStr = String.format( "INSERT INTO collectionrelationship (collectionRelTypeID, LeftSideCollectionID, RightSideCollectionID, %s) VALUES(?,?,?,?,?,?)", common); String agStr = String .format("INSERT INTO agent (AgentType, FirstName, LastName, %s) VALUES(?,?,?,?,?,?)", common); String adStr = String.format( "INSERT INTO address (City, State, PostalCode, Country, AgentID, %s) VALUES(?,?,?,?, ?,?,?,?)", common); String lcUpdateStr = "UPDATE locality SET Latitude1=?, Longitude1=?, SrcLatLongUnit=?, Lat1text=?, Long1text=?, LatLongType=? WHERE LocalityID = ?"; String lcStr2 = "SELECT LocalityID FROM locality WHERE LocalityName LIKE ? AND LocalityName LIKE ?"; PreparedStatement coStmt = dbConn.prepareStatement(coStr); PreparedStatement ceStmt = dbConn.prepareStatement(ceStr); PreparedStatement lcStmt = dbConn.prepareStatement(lcStr); PreparedStatement clStmt = dbConn.prepareStatement(clStr); PreparedStatement rlStmt = dbConn.prepareStatement(rlStr); PreparedStatement agStmt = dbConn.prepareStatement(agStr); PreparedStatement adStmt = dbConn.prepareStatement(adStr); PreparedStatement lcUpStmt = dbConn.prepareStatement(lcUpdateStr); PreparedStatement lcStmt2 = dbConn.prepareStatement(lcStr2); int recNum = 1; while (rs.next()) { String tag = rs.getString(1); String city = rs.getString(2); String state = rs.getString(3); String zip = rs.getString(4); String country = rs.getString(5); Date date = rs.getDate(6); double lat = rs.getDouble(7); boolean isLatNull = rs.wasNull(); double lon = rs.getDouble(8); boolean isLonNull = rs.wasNull(); String dir = rs.getString(9); String dist = rs.getString(10); String gender = rs.getString(11); String rep_first = rs.getString(12); String rep_last = rs.getString(13); String rep_city = rs.getString(14); String rep_state = rs.getString(15); String rep_country = rs.getString(16); String rep_zip = rs.getString(17); String t_first = rs.getString(18); //String t_middle = rs.getString(19); String t_last = rs.getString(20); String t_city = rs.getString(21); String t_state = rs.getString(22); String t_country = rs.getString(23); String t_zip = rs.getString(24); //String t_org = rs.getString(25); double t_lat = rs.getDouble(26); boolean isTLatNull = rs.wasNull(); double t_lon = rs.getDouble(27); boolean isTLonNull = rs.wasNull(); //String oldState = state; city = condense(rep_city, t_city, city); state = condense(rep_state, state, t_state); country = condense(rep_country, country, t_country); zip = condense(rep_zip, zip, t_zip); rep_first = condense(rep_first, t_first); rep_last = condense(rep_last, t_last); /*boolean debug = ((rep_state != null && rep_state.equals("IA")) || (t_state != null && t_state.equals("IA")) || (oldState != null && oldState.equals("IA"))); if (debug && (state == null || !state.equals("IA"))) { System.out.println("ouch"); }*/ if (rep_first != null && rep_first.length() > 50) { rep_first = rep_first.substring(0, 50); } lat = isLatNull && !isTLatNull ? t_lat : lat; lon = isLonNull && !isTLonNull ? t_lon : lon; try { // (Latitude1, Longitude1, SrcLatLongUnit, Lat1text, Long1text, LatLongType, DisciplineID, MaxElevation, LocalityName, GeographyID Integer geoId = buildTags.getGeography(country, state, null); // Latitude varies between -90 and 90, and Longitude between -180 and 180. if (lat < -90.0 || lat > 90.0) { lcStmt.setObject(1, null); lcStmt.setObject(4, null); } else { lcStmt.setDouble(1, lat); lcStmt.setString(4, Double.toString(lat)); lcUpStmt.setDouble(1, lat); lcUpStmt.setString(4, Double.toString(lat)); } if (lon < -180.0 || lon > 180.0) { lcStmt.setObject(2, null); lcStmt.setObject(5, null); } else { lcStmt.setDouble(2, lon); lcStmt.setString(5, Double.toString(lon)); lcUpStmt.setDouble(2, lon); lcUpStmt.setString(5, Double.toString(lon)); } String locName = null; String fullName = null; Integer locId = null; geoId = buildTags.getGeography(country, state, null); if (geoId != null) { fullName = geoFullNameHash.get(geoId); if (fullName == null) { fullName = BasicSQLUtils .querySingleObj("SELECT FullName FROM geography WHERE GeographyID = " + geoId); geoFullNameHash.put(geoId, fullName); } if (StringUtils.isNotEmpty(city)) { locName = city + ", " + fullName; } else { locName = fullName; } locId = localityHash.get(locName); if (locId == null) { lcStmt2.setString(1, "%" + city); lcStmt2.setString(2, country + "%"); ResultSet lcRS = lcStmt2.executeQuery(); if (lcRS.next()) { locId = lcRS.getInt(1); if (!lcRS.wasNull()) { localityHash.put(locName, locId); } } lcRS.close(); } } else { //unknown++; fullName = "Unknown"; locName = buildTags.buildLocalityName(city, fullName); geoId = 27507; // Unknown locId = localityHash.get(locName); //log.error("Couldn't find matching geography["+country+", "+state+", "+county+"]"); } if (locId == null) { lcStmt.setByte(3, (byte) 0); lcStmt.setString(6, "Point"); lcStmt.setInt(7, dspId); lcStmt.setString(8, getLocalityName(country, state, null, city)); lcStmt.setObject(9, geoId); lcStmt.setTimestamp(10, ts); lcStmt.setInt(11, 1); lcStmt.setInt(12, 1); lcStmt.executeUpdate(); locId = BasicSQLUtils.getInsertedId(lcStmt); } else if (!isLatNull && !isLonNull) { int count = BasicSQLUtils.getCountAsInt( "SELECT COUNT(*) FROM locality WHERE Latitude1 IS NULL AND Longitude1 IS NULL AND LocalityID = " + locId); if (count == 1) { lcUpStmt.setByte(3, (byte) 0); lcUpStmt.setString(6, "Point"); lcUpStmt.setInt(7, locId); lcUpStmt.executeUpdate(); } } // (StartDate, Method, DisciplineID, LocalityID ceStmt.setDate(1, date); ceStmt.setInt(2, dspId); ceStmt.setInt(3, locId); ceStmt.setTimestamp(4, ts); ceStmt.setInt(5, 1); ceStmt.setInt(6, 1); ceStmt.executeUpdate(); Integer ceId = BasicSQLUtils.getInsertedId(ceStmt); //(CatalogNumber, FieldNumber, Text1, Remarks, CollectionID, CollectionMemberId coStmt.setString(1, String.format("%09d", recNum++)); coStmt.setString(2, tag); coStmt.setString(3, gender); coStmt.setString(4, dir); coStmt.setString(5, dist); coStmt.setInt(6, colId); coStmt.setInt(7, colId); coStmt.setInt(8, ceId); coStmt.setTimestamp(9, ts); coStmt.setInt(10, 1); coStmt.setInt(11, 1); coStmt.executeUpdate(); //Integer coId = BasicSQLUtils.getInsertedId(coStmt); Integer agentId = getAgentId(agentStmt, rep_first, rep_last); if (agentId == null) { agStmt.setInt(1, 0); agStmt.setString(2, rep_first); agStmt.setString(3, rep_last); agStmt.setTimestamp(4, ts); agStmt.setInt(5, 1); agStmt.setInt(6, 1); agStmt.executeUpdate(); agentId = BasicSQLUtils.getInsertedId(agStmt); if (agentId != null) { adStmt.setString(1, rep_city); adStmt.setString(2, rep_state); adStmt.setString(3, rep_zip); adStmt.setString(4, rep_country); adStmt.setInt(5, agentId); adStmt.setTimestamp(6, ts); adStmt.setInt(7, 1); adStmt.setInt(8, 1); adStmt.executeUpdate(); } else { log.error("agentId is null after being created: " + rep_first + ", " + rep_last); } } // OrderIndex, IsPrimary, CollectingEventID, DivisionID, AgentID clStmt.setInt(1, 0); clStmt.setBoolean(2, true); clStmt.setInt(3, ceId); clStmt.setInt(4, divId); clStmt.setInt(5, agentId); clStmt.setTimestamp(6, ts); clStmt.setInt(7, 1); clStmt.setInt(8, 1); clStmt.executeUpdate(); } catch (Exception ex) { log.debug(recNum + " tag[" + tag + "]"); ex.printStackTrace(); } cnt++; if (cnt % 100 == 0) { System.out.println("Col Obj: " + cnt); } } coStmt.close(); ceStmt.close(); lcStmt.close(); clStmt.close(); rlStmt.close(); agStmt.close(); adStmt.close(); lcUpStmt.close(); buildTags.cleanup(); } }
From source file:com.netbase.insightapi.clientlib.InsightAPIQuery.java
/** * Sets the query to be restricted to a specific published date range. The * operation removes any existing published date range. If d1 is * Integer.MIN_VALUE, nothing else is done. If d2 is Integer.MAX_VALUE, the * endpoint of the range is not set./*from www . j av a2 s. c om*/ * * @param d1 * @param d2 */ public void setPublishedTimestampRange(int d1, int d2) { removeParameters(PUBLISHED_TIMESTAMP); if (d1 == Integer.MIN_VALUE) return; setParameter(PUBLISHED_TIMESTAMP, d1); if (d2 != Integer.MAX_VALUE) addParameter(PUBLISHED_TIMESTAMP, d2); setRealtime(new java.util.Date(timestampToLongTime(d1))); }
From source file:org.eclipse.swt.examples.browser.demos.Pawns.java
static void evalBest(byte[] g, byte type, int depth, /* out [0] best move, [1] minimax */int[] result) { byte[] tmp = new byte[64]; byte opponentType = type == WHITE ? BLACK : WHITE; result[0] = -1;//from w w w . j av a2 s . c o m result[1] = Integer.MIN_VALUE; for (int i = 0; i < 64; i++) { if (g[i] == EMPTY) { System.arraycopy(g, 0, tmp, 0, 64); play(tmp, i, type); int score = eval(tmp); if (depth > 1) { int[] tmpResult = new int[2]; evalBest(tmp, opponentType, depth - 1, tmpResult); score = tmpResult[1]; } if ((type == WHITE && score > result[1]) || (type == BLACK && score < result[1]) || result[0] == -1) { result[0] = i; result[1] = score; } } } }
From source file:IntVector.java
/** * Searches for the first occurence of the given argument, * beginning the search at index, and testing for equality * using the equals method.//from www.ja va 2 s. c om * * @param elem object to look for * @param index Index of where to begin search * @return the index of the first occurrence of the object * argument in this vector at position index or later in the * vector; returns -1 if the object is not found. */ public final int indexOf(int elem, int index) { for (int i = index; i < m_firstFree; i++) { if (m_map[i] == elem) return i; } return java.lang.Integer.MIN_VALUE; }
From source file:com.wabacus.config.Config.java
public void initConfigLoad() { this.report_template_defaultbean = null; this.dataexport_template_defaultbean = null; this.lstGlobalPageInterceptors = null; this.ulstGlobalCss = null; if (mAutoDetectedDataImportBeans != null) { mAutoDetectedDataImportBeans.clear(); }// w w w . j av a 2s . com if (this.mDataSources != null) { for (Entry<String, AbsDataSource> entryDsTmp : mDataSources.entrySet()) { entryDsTmp.getValue().closePool(); } this.mDataSources = null; } dataexport_plainexcel_sheetsize = Integer.MIN_VALUE; this.mReportDatasetValueProviders = null; this.mCommonDatasetValueProviders = null; }
From source file:QPEncoderStream.java
/** * Convert the bytes within the specified range of the given byte * array into a signed integer in the given radix . The range extends * from <code>start</code> till, but not including <code>end</code>. <p> * * Based on java.lang.Integer.parseInt() *///from w w w .j ava 2s . c o m public static int parseInt(byte[] b, int start, int end, int radix) throws NumberFormatException { if (b == null) throw new NumberFormatException("null"); int result = 0; boolean negative = false; int i = start; int limit; int multmin; int digit; if (end > start) { if (b[i] == '-') { negative = true; limit = Integer.MIN_VALUE; i++; } else { limit = -Integer.MAX_VALUE; } multmin = limit / radix; if (i < end) { digit = Character.digit((char) b[i++], radix); if (digit < 0) { throw new NumberFormatException("illegal number: " + toString(b, start, end)); } else { result = -digit; } } while (i < end) { // Accumulating negatively avoids surprises near MAX_VALUE digit = Character.digit((char) b[i++], radix); if (digit < 0) { throw new NumberFormatException("illegal number"); } if (result < multmin) { throw new NumberFormatException("illegal number"); } result *= radix; if (result < limit + digit) { throw new NumberFormatException("illegal number"); } result -= digit; } } else { throw new NumberFormatException("illegal number"); } if (negative) { if (i > start + 1) { return result; } else { /* Only got "-" */ throw new NumberFormatException("illegal number"); } } else { return -result; } }