List of usage examples for java.util Date equals
public boolean equals(Object obj)
From source file:com.money.manager.ex.sync.SyncManager.java
public boolean isRemoteFileModified(CloudMetaData remoteFile) { String dateString = getDatabases().getCurrent().remoteLastChangedDate; if (TextUtils.isEmpty(dateString)) { // no remote file-change information found! throw new RuntimeException(getContext().getString(R.string.no_remote_change_date)); }//from ww w .j av a 2 s . c o m Date cachedLastModified = MmxDate.fromIso8601(dateString).toDate(); Date remoteLastModified = getModificationDateFrom(remoteFile); return !remoteLastModified.equals(cachedLastModified); }
From source file:com.autentia.intra.jsf.schedule.renderer.ActivityScheduleEntryRenderer.java
protected void renderCompactContent(FacesContext context, ResponseWriter writer, HtmlSchedule schedule, ScheduleDay day, ScheduleEntry entry, boolean selected) throws IOException { StringBuffer text = new StringBuffer(); Date startTime = entry.getStartTime(); if (day.getDayStart().after(entry.getStartTime())) { startTime = day.getDayStart();//w w w . ja v a 2 s . co m } Date endTime = entry.getEndTime(); if (day.getDayEnd().before(entry.getEndTime())) { endTime = day.getDayEnd(); } if (!entry.isAllDay()) { DateFormat format = DateFormat.getTimeInstance(DateFormat.SHORT); text.append(format.format(startTime)); if (!startTime.equals(endTime)) { text.append("-"); text.append(format.format(endTime)); } text.append(": "); } text.append(StringUtils.abbreviate(entry.getTitle(), 20)); if (((ActivityScheduleEntry) entry).isBillable()) { writer.startElement(HTML.SPAN_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entryBillable"), null); } writer.writeText(text.toString(), null); if (((ActivityScheduleEntry) entry).isBillable()) { writer.endElement(HTML.SPAN_ELEM); } }
From source file:dess15proj5.fau.cs.osr_amos.mobiletimerecording.ui.SelectedProjectFragment.java
/** * This method is called in the android lifecycle when the application is resumed. * * methodtype command method/*from ww w. java 2s .c o m*/ */ @Override public void onResume() { super.onResume(); addSessionsToAdapter(); SharedPreferences sharedPref = getActivity().getSharedPreferences("selectedProject", Context.MODE_PRIVATE); boolean isRecording = sharedPref.getBoolean("isRecording", false); if (isRecording) { long sessionId = sharedPref.getLong("sessionId", 0L); try { SessionsDAO sessionsDAO = DataAccessObjectFactory.getInstance().createSessionsDAO(getActivity()); session = sessionsDAO.load(sessionId); Date startTime = session.getStartTime(); Date stopTime = session.getStopTime(); if (startTime.equals(stopTime)) { startStopBtn.setImageDrawable( ContextCompat.getDrawable(getActivity(), R.drawable.ic_stop_white_24dp)); long elapsedRealTimeOffset = System.currentTimeMillis() - SystemClock.elapsedRealtime(); Long difference = startTime.getTime() - elapsedRealTimeOffset; timer.start(); timer.setBase(difference); } } catch (CursorIndexOutOfBoundsException e) { Toast.makeText(getActivity(), "Could not load session due to database errors!", Toast.LENGTH_LONG) .show(); } catch (SQLException e) { Toast.makeText(getActivity(), "Could not load session due to database errors!", Toast.LENGTH_LONG) .show(); } } }
From source file:de.innovationgate.wgpublisher.design.sync.DesignSyncManager.java
public void waitForNextSync() { Date lastRun = _lastRun; while (lastRun.equals(_lastRun)) { try {/*from w w w . j av a 2 s. co m*/ Thread.sleep(100); } catch (InterruptedException e) { } } }
From source file:org.pwsafe.passwordsafeswt.dialog.EditDialog.java
private void addDateChooser(final Composite compositeFields) { final Button open = new Button(compositeFields, SWT.PUSH); final FormData fd_dtPasswordExpire = new FormData(); fd_dtPasswordExpire.left = new FormAttachment(txtPasswordExpire, 10, SWT.RIGHT); fd_dtPasswordExpire.top = new FormAttachment(txtPasswordExpire, 0, SWT.TOP); fd_dtPasswordExpire.bottom = new FormAttachment(txtPasswordExpire, 0, SWT.BOTTOM); open.setLayoutData(fd_dtPasswordExpire); open.setText(Messages.getString("EditDialog.Calendar")); //$NON-NLS-1$ open.addSelectionListener(new SelectionAdapter() { @Override//from ww w . j ava2s .co m public void widgetSelected(final SelectionEvent e) { final DateDialog dialog = new DateDialog(shell); dialog.setDate(entryToEdit.getExpires()); final Date result = dialog.open(); if (result != null && !result.equals(entryToEdit.getExpires())) { txtPasswordExpire.setText(format(result)); setDirty(true); } } }); }
From source file:jp.co.ctc_g.jfw.core.util.Dates.java
/** * 2???????????????.//from ww w .ja v a 2 s.c o m * @param fromDate1 * @param toDate1 * @param fromDate2 2 * @param toDate2 2 * @return true:??????false:??????? */ public static boolean isDateOverlap(Date fromDate1, Date toDate1, Date fromDate2, Date toDate2) { fromDate1 = truncate(fromDate1, Dates.DAY); toDate1 = truncate(toDate1, Dates.DAY); fromDate2 = truncate(fromDate2, Dates.DAY); toDate2 = truncate(toDate2, Dates.DAY); if ((fromDate1.equals(fromDate2) || toDate1.equals(toDate2) || // ???????? fromDate1.equals(toDate2) || toDate1.equals(fromDate2)) || (fromDate1.before(fromDate2) && toDate1.after(fromDate2)) || // ????????? (fromDate2.before(fromDate1) && toDate2.after(fromDate1))) // ????????? return true; return false; }
From source file:com.liferay.portal.model.AddressModel.java
public void setModifiedDate(Date modifiedDate) { if (((modifiedDate == null) && (_modifiedDate != null)) || ((modifiedDate != null) && (_modifiedDate == null)) || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate.equals(_modifiedDate))) { _modifiedDate = modifiedDate;/* w w w. java2 s . c o m*/ setModified(true); } }
From source file:org.eclipse.mylyn.reviews.connector.AbstractEmfConnector.java
@Override public boolean hasTaskChanged(TaskRepository repository, ITask task, TaskData taskData) { ITaskMapping taskMapping = getTaskMapping(taskData); if (taskData.isPartial() && task.getModificationDate() != null) { return false; }/*from w ww. jav a2 s .c o m*/ Date repositoryDate = taskMapping.getModificationDate(); Date localDate = task.getModificationDate(); boolean hasChanged = repositoryDate != null && repositoryDate.equals(localDate); return hasChanged; }
From source file:org.obm.push.backend.obm22.mail.EmailCacheStorage.java
private Set<Long> loadMailFromIMAP(BackendSession bs, StoreClient imapStore, Date lastUpdate) { long time = System.currentTimeMillis(); Set<Long> mails = new HashSet<Long>(); try {//from w w w .j av a 2s . c o m // imapStore.uidSearch return messages whose internal date // (disregarding time and timezone) // is within or later than the specified date. Collection<Long> uids = imapStore.uidSearch(new SearchQuery(lastUpdate)); if (lastUpdate != null && !lastUpdate.equals(new Date(0))) { InternalDate[] tabID = imapStore.uidFetchInternalDate(uids); for (InternalDate id : tabID) { if (id.after(lastUpdate)) { mails.add(Long.valueOf(id.getUid())); } } } else { for (long uid : uids) { mails.add(Long.valueOf(uid)); } } } catch (Throwable e) { logger.error(e.getMessage(), e); } if (logger.isDebugEnabled()) { time = System.currentTimeMillis() - time; logger.debug(debugName + " loadMailFromIMAP() in " + time + "ms."); } logger.info(mails.size() + " mails arrived since " + lastUpdate); return mails; }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for checking whether the date is the previous month * /* w ww . j a v a2 s . co m*/ * @param prevMonthDate * @param today * @return * @throws ParseException */ public static boolean isPreviousMonth(Date prevMonthDate, Date today) throws ParseException { Date tempPrevMonthDate = DateTimeUtil.getFirstDayOfMonth(prevMonthDate); Date tempDate = DateTimeUtil.addMonthsToDate(today, -1); tempDate = DateTimeUtil.getFirstDayOfMonth(tempDate); return tempPrevMonthDate.equals(tempDate); }