List of usage examples for java.lang Long hashCode
@Override public int hashCode()
From source file:Main.java
public static void main(String[] args) { Long l = new Long(1234567890); int retval = l.hashCode(); System.out.println("Value = " + retval); }
From source file:com.vmware.aurora.global.Configuration.java
/** * Generate the instance ID from the stored moref to the CMS VM. * /*from www . jav a 2 s. c om*/ * @return Bootstrap instance ID. */ private static String getBootstrapInstanceId() { String cmsVmIdText = Configuration.getString("vim.cms_moref"); int pos = cmsVmIdText.lastIndexOf('-'); if (pos == -1) { logger.error("Unrecognized CMS VM moref Id: " + cmsVmIdText); throw CommonException.INTERNAL(); } Long cmsVmId = Long.parseLong(cmsVmIdText.substring(pos + 1)); return Integer.toHexString(cmsVmId.hashCode()); // enforce maximum of 8 digits }
From source file:org.agatom.springatom.data.hades.model.NAbstractPersistable.java
@Override public int hashCode() { if (hash == null) { final Long id = this.getId(); hash = id == null ? System.identityHashCode(this) : id.hashCode(); }// w w w. j av a2s .com return hash.hashCode(); }
From source file:com.springinpractice.ch11.model.AbstractCI.java
@Override public int hashCode() { Long id = getId(); return (id == null ? 0 : id.hashCode()); }
From source file:org.eclipse.jubula.client.core.model.ComponentNamePO.java
/** * {@inheritDoc}//from ww w .jav a 2 s .c o m */ public int hashCode() { Long hbmParentProjectId = getHbmParentProjectId(); String hbmGuid = getHbmGuid(); if (hbmParentProjectId == null || hbmGuid == null) { return super.hashCode(); } return hbmParentProjectId.hashCode() + hbmGuid.hashCode(); }
From source file:ubic.gemma.core.analysis.sequence.ArrayDesignMapResultServiceImpl.java
/** * count the number of distinct blat hits * * @param blatResultCount map of csid to blat result hashes. *///ww w . j av a2 s . c o m private void countBlatHits(Object[] row, Map<Long, Set<Integer>> blatResultCount, Long csId, CompositeSequenceMapValueObject vo) { Long chromId = ((BigInteger) row[14]).longValue(); Long targetStart = ((BigInteger) row[15]).longValue(); Long targetEnd = ((BigInteger) row[16]).longValue(); String targetStarts = (String) row[17]; Long queryId = ((BigInteger) row[18]).longValue(); int hash = 1; int prime = 31; hash = prime * hash + chromId.hashCode(); hash = prime * hash + targetStart.hashCode(); hash = prime * hash + targetEnd.hashCode(); hash = prime * hash + targetStarts.hashCode(); hash = prime * hash + queryId.hashCode(); EntityUtils.populateMapSet(blatResultCount, csId, hash); if (vo.getNumBlatHits() == null) { vo.setNumBlatHits(1); } else { vo.setNumBlatHits(blatResultCount.get(csId).size()); } }
From source file:nu.firetech.android.pactrack.backend.ParcelUpdater.java
private void updateParcel(Bundle parcel, ParcelDbAdapter dbAdapter, NotificationManager notMgr) { Long rowId = parcel.getLong(ParcelDbAdapter.KEY_ROWID); String parcelId = parcel.getString(ParcelDbAdapter.KEY_PARCEL); Parcel parcelData = ParcelJsonParser.fetch(parcelId); mDbAdapter.updateParcelData(rowId, parcelData); if (parcelData.getParcel() != null) { parcelId = parcelData.getParcel(); }/*from w w w.ja va 2 s. c om*/ int newEvents = 0; StringBuilder eventList = new StringBuilder(); for (ParcelEvent eventData : parcelData.getEvents()) { //loop through events if (mDbAdapter.addEvent(rowId, eventData)) { //if event was new if (newEvents > 0) { eventList.append("\n"); } eventList.append(eventData.toString()); newEvents++; } } if (newEvents > 0 && !mCtx.showsNews()) { Preferences prefs = Preferences.getPreferences(mAndroidCtx); //TODO Join existing notifications in some clever way... if (prefs.getNotificationEnabled()) { String parcelName = parcel.getString(ParcelDbAdapter.KEY_NAME); if (parcelName == null) { parcelName = mAndroidCtx.getString(R.string.generic_parcel_name, parcelId); } Intent intent = new Intent(mAndroidCtx, MainActivity.class).putExtra(ParcelDbAdapter.KEY_ROWID, rowId); PendingIntent contentIntent = PendingIntent.getActivity(mAndroidCtx, rowId.hashCode(), intent, 0); int stringId = (newEvents > 1 ? R.string.notification_ticker : R.string.notification_ticker_one); NotificationCompat.Builder n = new NotificationCompat.Builder(mAndroidCtx) .setSmallIcon(R.drawable.notification) .setTicker(mAndroidCtx.getString(stringId, parcelName)).setWhen(System.currentTimeMillis()) .setContentTitle(parcelName) .setContentText(newEvents == 1 ? eventList.toString() : mAndroidCtx.getString(R.string.notification_message, newEvents)) .setContentIntent(contentIntent).setSound(prefs.getNotificationSound()) .extend(new NotificationCompat.WearableExtender().setBackground(BitmapFactory .decodeResource(mAndroidCtx.getResources(), R.drawable.wearable_background))); if (newEvents > 1) { n.setStyle(new NotificationCompat.BigTextStyle().bigText(eventList.toString())); } if (prefs.getNotificationLight()) { n.setLights(prefs.getNotificationColor(), prefs.getNotificationOntime(), prefs.getNotificationOfftime()); } if (prefs.getNotificationVibrate()) { n.setDefaults(Notification.DEFAULT_VIBRATE); } notMgr.notify(rowId.hashCode(), n.build()); } } }