List of usage examples for org.joda.time Days getDays
public int getDays()
From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java
License:Open Source License
public ContiguousDaysLine<T> subInterval(LocalDate startInclusive, LocalDate endExclusive) { if (isNotValid() || startInclusive.compareTo(endExclusive) >= 0 || startInclusive.compareTo(getEndExclusive()) >= 0 || endExclusive.compareTo(getStart()) <= 0) { return invalid(); }// w ww. j a v a 2s .c o m LocalDate newStart = max(this.startInclusive, startInclusive); Days days = Days.daysBetween(newStart, min(getEndExclusive(), endExclusive)); ContiguousDaysLine<T> result = new ContiguousDaysLine<T>(newStart, days.getDays()); for (OnDay<T> each : result) { result.set(each.getDay(), this.get(each.getDay())); } return result; }
From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java
License:Open Source License
public T get(LocalDate day) throws IndexOutOfBoundsException { Validate.notNull(day);//ww w . j a va2 s . c o m Days days = Days.daysBetween(startInclusive, day); return values.get(days.getDays()); }
From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java
License:Open Source License
public void set(LocalDate day, T value) throws IndexOutOfBoundsException { Validate.notNull(day);/*from w w w .j a v a 2 s . c o m*/ Days days = Days.daysBetween(startInclusive, day); values.set(days.getDays(), value); }
From source file:org.libreplan.business.planner.entities.Stretch.java
License:Open Source License
protected static BigDecimal daysPercent(Days daysPartial, Days daysTotal) { return percentWorked(daysPartial.getDays(), daysTotal.getDays()); }
From source file:org.libreplan.business.planner.entities.Task.java
License:Open Source License
public Integer getDaysBetweenDates() { Days daysBetween = Days.daysBetween(getStartAsLocalDate(), getIntraDayEndDate().asExclusiveEnd()); return daysBetween.getDays(); }
From source file:org.libreplan.business.planner.entities.TaskMilestone.java
License:Open Source License
public Integer getDaysDuration() { Days daysBetween = Days.daysBetween(toDateTime(getStartDate()), toDateTime(getEndDate())); return daysBetween.getDays(); }
From source file:org.libreplan.business.templates.entities.OrderElementTemplate.java
License:Open Source License
private static boolean isNullOrPositive(Days days) { return days == null || days.getDays() >= 0; }
From source file:org.libreplan.business.templates.entities.OrderElementTemplate.java
License:Open Source License
private static Integer daysToInteger(Days days) { return days != null ? days.getDays() : null; }
From source file:org.libreplan.business.workingday.IntraDayDate.java
License:Open Source License
public int numberOfDaysUntil(IntraDayDate end) { Validate.isTrue(compareTo(end) <= 0); Days daysBetween = Days.daysBetween(getDate(), end.getDate()); if (getEffortDuration().compareTo(end.getEffortDuration()) <= 0) { return daysBetween.getDays(); } else {//from ww w . ja va2 s . c o m return daysBetween.getDays() - 1; } }
From source file:org.libreplan.web.dashboard.DashboardModel.java
License:Open Source License
private void calculateMarginWithDeadLine() { if (this.getRootTask() == null) { throw new RuntimeException("Root task is null"); }// ww w . j a va2s. c o m if (this.currentOrder.getDeadline() == null) { this.marginWithDeadLine = null; return; } TaskGroup rootTask = getRootTask(); LocalDate endDate = TaskElement.maxDate(rootTask.getChildren()).asExclusiveEnd(); Days orderDuration = Days.daysBetween(TaskElement.minDate(rootTask.getChildren()).getDate(), endDate); LocalDate deadLineAsLocalDate = LocalDate.fromDateFields(currentOrder.getDeadline()); Days deadlineOffset = Days.daysBetween(endDate, deadLineAsLocalDate.plusDays(1)); BigDecimal outcome = new BigDecimal(deadlineOffset.getDays(), MathContext.DECIMAL32); this.marginWithDeadLine = orderDuration.getDays() != 0 ? outcome.divide(new BigDecimal(orderDuration.getDays()), 8, BigDecimal.ROUND_HALF_EVEN) : new BigDecimal(Days.daysBetween(rootTask.getStartAsLocalDate(), deadLineAsLocalDate.plusDays(1)) .getDays()); }