List of usage examples for org.joda.time Days daysBetween
public static Days daysBetween(ReadablePartial start, ReadablePartial end)
Days
representing the number of whole days between the two specified partial datetimes. From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java
License:Open Source License
public static <T> ContiguousDaysLine<T> create(LocalDate fromInclusive, LocalDate endExclusive) { if (fromInclusive.isAfter(endExclusive)) { throw new IllegalArgumentException( "fromInclusive (" + fromInclusive + ") is after endExclusive (" + endExclusive + ")"); }// w ww.j a v a 2s . c o m Days daysBetween = Days.daysBetween(fromInclusive, endExclusive); return new ContiguousDaysLine<T>(fromInclusive, daysBetween.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(); }/*from w w w . j a v a2s . 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);// www . ja v a2s . co 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 www . j a v a2s.c o m Days days = Days.daysBetween(startInclusive, day); values.set(days.getDays(), value); }
From source file:org.libreplan.business.planner.entities.AggregateOfResourceAllocations.java
License:Open Source License
public Integer getDaysDuration() { return Days.daysBetween(getStartAsLocalDate(), getEndAsLocalDate()).getDays(); }
From source file:org.libreplan.business.planner.entities.Stretch.java
License:Open Source License
public static LocalDate getDateByLengthProportion(ResourceAllocation<?> allocation, BigDecimal lengthProportion) { int allocationDuration = Days .daysBetween(allocation.getStartDate(), allocation.getIntraDayEndDate().asExclusiveEnd()).getDays(); int days = lengthProportion.multiply(BigDecimal.valueOf(allocationDuration)) .setScale(0, RoundingMode.HALF_UP).intValue(); return allocation.getStartDate().plusDays(days); }
From source file:org.libreplan.business.planner.entities.Stretch.java
License:Open Source License
public static BigDecimal getLengthProportionByDate(ResourceAllocation<?> allocation, LocalDate date) { int allocationDuration = Days .daysBetween(allocation.getStartDate(), allocation.getIntraDayEndDate().asExclusiveEnd()).getDays(); int days = Days.daysBetween(allocation.getStartDate(), date).getDays(); return daysProportion(days, allocationDuration); }
From source file:org.libreplan.business.planner.entities.StretchesFunctionTypeEnum.java
License:Open Source License
private static int[] extractAccumulated(UnivariateFunction accumulatedFunction, LocalDate startInclusive, LocalDate endExclusive) { int[] result = new int[Days.daysBetween(startInclusive, endExclusive).getDays()]; for (int i = 0; i < result.length; i++) { result[i] = evaluate(accumulatedFunction, i + 1); }/* ww w .jav a 2 s . co m*/ return result; }
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(); }