Java Code Examples for org.joda.time.LocalDate#equals()
The following examples show how to use
org.joda.time.LocalDate#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalDatePeriodCountCalculator.java From objectlabkit with Apache License 2.0 | 6 votes |
private int diff360EIsda(final LocalDate start, final LocalDate end) { if (start.equals(end)) { return 0; } int dayStart = start.getDayOfMonth(); int dayEnd = end.getDayOfMonth(); if (start.dayOfMonth().getMaximumValue() == dayStart) { dayStart = CalculatorConstants.MONTH_30_DAYS; } if (end.getMonthOfYear() != 2 && end.dayOfMonth().getMaximumValue() == dayEnd) { dayEnd = CalculatorConstants.MONTH_30_DAYS; } return (end.getYear() - start.getYear()) * CalculatorConstants.YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * CalculatorConstants.MONTH_30_DAYS + dayEnd - dayStart; }
Example 2
Source File: SearchWrittenEvaluationsByDate.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
public ActionForward search(ActionMapping mapping, HttpServletRequest request, final LocalDate day, final LocalTime begin, final LocalTime end, DynaActionForm dynaActionForm) throws Exception { Integer totalOfStudents = 0; final Set<WrittenEvaluation> writtenEvaluations = new HashSet<WrittenEvaluation>(); for (final ExecutionCourse executionCourse : getExecutionCoursesActiveIn(day)) { for (final Evaluation evaluation : executionCourse.getAssociatedEvaluationsSet()) { if (evaluation instanceof WrittenEvaluation) { final WrittenEvaluation writtenEvaluation = (WrittenEvaluation) evaluation; final LocalDate evaluationDate = writtenEvaluation.getDayDateYearMonthDay().toLocalDate(); if (evaluationDate != null && evaluationDate.equals(day) && isEvalBetweenDates(writtenEvaluation, begin, end)) { if (!writtenEvaluations.contains(writtenEvaluation)) { totalOfStudents += writtenEvaluation.getCountStudentsEnroledAttendingExecutionCourses(); } writtenEvaluations.add(writtenEvaluation); } } } } request.setAttribute( "availableRoomIndicationMsg", BundleUtil.getString(Bundle.RESOURCE_ALLOCATION, "info.total.students.vs.available.seats", totalOfStudents.toString(), SpaceUtils.countAllAvailableSeatsForExams().toString())); request.setAttribute("writtenEvaluations", writtenEvaluations); return mapping.findForward("show"); }
Example 3
Source File: TaxRateRepository.java From estatio with Apache License 2.0 | 6 votes |
@Programmatic public TaxRate newRate( final Tax tax, final LocalDate startDate, final BigDecimal percentage) { TaxRate currentRate = tax.taxRateFor(startDate); TaxRate rate; if (currentRate == null || !startDate.equals(currentRate.getStartDate())) { rate = repositoryService.instantiate(TaxRate.class); rate.setTax(tax); rate.setStartDate(startDate); if(repositoryService.isPersistent(tax)) { repositoryService.persist(rate); } } else { rate = currentRate; } rate.setPercentage(percentage); if (currentRate != null) { TaxRate currentNextRate = currentRate.getNext(); currentRate.modifyNext(rate); rate.modifyNext(currentNextRate); } return rate; }
Example 4
Source File: LocalDateIMMDateCalculator.java From objectlabkit with Apache License 2.0 | 5 votes |
/** * Checks if a given date is an official IMM Date (3rd Wednesdays of * March/June/Sept/Dec. * * @param date * @return true if that date is an IMM date. */ @Override public boolean isIMMDate(final LocalDate date) { boolean same = false; final List<LocalDate> dates = getIMMDates(date.minusDays(1), date, QUARTERLY); if (!dates.isEmpty()) { same = date.equals(dates.get(0)); } return same; }
Example 5
Source File: PhdGratuityPaymentPeriod.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
public boolean contains(LocalDate date) { LocalDate start = new LocalDate(date.getYear(), getMonthStart(), getDayStart()); LocalDate end = new LocalDate(date.getYear(), getMonthEnd(), getDayEnd()); if ((date.equals(start) || date.isAfter(start)) && (date.equals(end) || date.isBefore(end))) { return true; } else { return false; } }
Example 6
Source File: LeaseItem.java From estatio with Apache License 2.0 | 5 votes |
@Programmatic public LeaseTerm findTerm(final LocalDate startDate) { for (LeaseTerm term : getTerms()) { if (startDate.equals(term.getStartDate())) { return term; } } return null; }
Example 7
Source File: WidgetProvider.java From Simple-Dilbert with Apache License 2.0 | 4 votes |
@Override public void onReceive(@NotNull Context context, @NotNull Intent intent) { String action = intent.getAction(); if (intent.getExtras() == null) return; final int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1); final DilbertPreferences preferences = new DilbertPreferences(context); if (action == null || appWidgetId == -1) { super.onReceive(context, intent); return; } if (currentToast != null) currentToast.cancel(); switch (action) { case INTENT_PREVIOUS: preferences.saveDateForWidgetId(appWidgetId, preferences .getDateForWidgetId(appWidgetId).minusDays(1)); break; case INTENT_NEXT: preferences.saveDateForWidgetId(appWidgetId, preferences .getDateForWidgetId(appWidgetId).plusDays(1)); break; case INTENT_LATEST: preferences.saveDateForWidgetId(appWidgetId, LocalDate.now()); break; case INTENT_RANDOM: preferences.saveDateForWidgetId(appWidgetId, DilbertPreferences.getRandomDate()); break; case INTENT_REFRESH: preferences .removeCache(preferences.getDateForWidgetId(appWidgetId)); break; case INTENT_DISPLAY: preferences.saveCurrentDate(preferences .getDateForWidgetId(appWidgetId)); Intent display = new Intent(context, DilbertFragmentActivity.class); display.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(display); break; case AppWidgetManager.ACTION_APPWIDGET_UPDATE: LocalDate current = preferences.getDateForWidgetId(appWidgetId); if (current.equals(LocalDate.now() .minusDays(1))) { preferences.saveDateForWidgetId(appWidgetId, LocalDate.now()); } break; } updateAppWidget(context, AppWidgetManager.getInstance(context), appWidgetId); if (currentToast != null) currentToast.show(); super.onReceive(context, intent); }