/** * A convenience method that combines all the periods in the specified list to * this list. The result returned is a new PeriodList instance, except where * no periods are specified in the arguments. In such cases this instance is returned. * * Normalisation is also performed automatically after all periods have been added. * * @param periods a list of periods to add * @return a period list instance */ public final PeriodList add(final PeriodList periods) { if (periods != null) { final PeriodList newList = new PeriodList(); newList.addAll(this); newList.addAll(periods); return newList.normalise(); } return this; }
/** * A convenience method that combines all the periods in the specified list to * this list. The result returned is a new PeriodList instance, except where * no periods are specified in the arguments. In such cases this instance is returned. * * Normalisation is also performed automatically after all periods have been added. * * @param periods a list of periods to add * @return a period list instance */ public final PeriodList add(final PeriodList periods) { if (periods != null) { final PeriodList newList = new PeriodList(); newList.addAll(this); newList.addAll(periods); return newList.normalise(); } return this; }
/** * Creates a list of periods representing the time consumed by the specified list of components. * @param components * @return */ private PeriodList getConsumedTime(final ComponentList components, final DateTime rangeStart, final DateTime rangeEnd) { final PeriodList periods = new PeriodList(); // only events consume time.. for (final Iterator i = components.getComponents(Component.VEVENT).iterator(); i.hasNext();) { final Component component = (Component) i.next(); periods.addAll(((VEvent) component).getConsumedTime(rangeStart, rangeEnd, false)); } return periods.normalise(); }
/** * A convenience method that combines all the periods in the specified list to * this list. The result returned is a new PeriodList instance, except where * no periods are specified in the arguments. In such cases this instance is returned. * * Normalisation is also performed automatically after all periods have been added. * * @param periods a list of periods to add * @return a period list instance */ public final PeriodList add(final PeriodList periods) { if (periods != null) { final PeriodList newList = new PeriodList(); newList.addAll(this); for (final Iterator i = periods.iterator(); i.hasNext();) { newList.add((Period) i.next()); } return newList.normalise(); } return this; }
/** * A convenience method that combines all the periods in the specified list to * this list. The result returned is a new PeriodList instance, except where * no periods are specified in the arguments. In such cases this instance is returned. * * Normalisation is also performed automatically after all periods have been added. * * @param periods a list of periods to add * @return a period list instance */ public final PeriodList add(final PeriodList periods) { if (periods != null) { final PeriodList newList = new PeriodList(); newList.addAll(this); for (final Period p : periods) { newList.add(p); } return newList.normalise(); } return this; }
/** * A convenience method that combines all the periods in the specified list to * this list. The result returned is a new PeriodList instance, except where * no periods are specified in the arguments. In such cases this instance is returned. * * Normalisation is also performed automatically after all periods have been added. * * @param periods a list of periods to add * @return a period list instance */ public final PeriodList add(final PeriodList periods) { if (periods != null) { final PeriodList newList = new PeriodList(); newList.addAll(this); for (final Period p : periods) { newList.add(p); } return newList.normalise(); } return this; }
/** * Subtracts the intersection of this list with the specified list of * periods from this list and returns the results as a new period list. If * no intersection is identified this list is returned. * * @param subtractions * a list of periods to subtract from this list * @return a period list */ public final PeriodList subtract(final PeriodList subtractions) { if (subtractions == null || subtractions.isEmpty()) { return this; } PeriodList result = this; PeriodList tmpResult = new PeriodList(); for (final Iterator i = subtractions.iterator(); i.hasNext();) { final Period subtraction = (Period) i.next(); for (final Iterator j = result.iterator(); j.hasNext();) { final Period period = (Period) j.next(); tmpResult.addAll(period.subtract(subtraction)); } result = tmpResult; tmpResult = new PeriodList(); } return result; }
/** * Creates a list of periods representing the time consumed by the specified list of components. * @param components * @return */ private PeriodList getConsumedTime(final ComponentList<CalendarComponent> components, final DateTime rangeStart, final DateTime rangeEnd) { final PeriodList periods = new PeriodList(); // only events consume time.. for (final Component event : components.getComponents(Component.VEVENT)) { periods.addAll(((VEvent) event).getConsumedTime(rangeStart, rangeEnd, false)); } return periods.normalise(); }
/** * Creates a list of periods representing the time consumed by the specified list of components. * @param components * @return */ private PeriodList getConsumedTime(final ComponentList<CalendarComponent> components, final DateTime rangeStart, final DateTime rangeEnd) { final PeriodList periods = new PeriodList(); // only events consume time.. for (final Component event : components.getComponents(Component.VEVENT)) { periods.addAll(((VEvent) event).getConsumedTime(rangeStart, rangeEnd, false)); } return periods.normalise(); }
/** * Creates a list of periods representing the time consumed by the specified list of components. * @param components * @return */ private PeriodList getConsumedTime(final ComponentList<CalendarComponent> components, final DateTime rangeStart, final DateTime rangeEnd) { final PeriodList periods = new PeriodList(); // only events consume time.. for (final Component event : components.getComponents(Component.VEVENT)) { periods.addAll(((VEvent) event).getConsumedTime(rangeStart, rangeEnd, false)); } return periods.normalise(); }
/** * Creates a list of periods representing the time consumed by the specified list of components. * @param components * @return */ private PeriodList getConsumedTime(final ComponentList<CalendarComponent> components, final DateTime rangeStart, final DateTime rangeEnd) { final PeriodList periods = new PeriodList(); // only events consume time.. for (final Component event : components.getComponents(Component.VEVENT)) { periods.addAll(((VEvent) event).getConsumedTime(rangeStart, rangeEnd, false)); } return periods.normalise(); }
/** * Subtracts the intersection of this list with the specified list of * periods from this list and returns the results as a new period list. If * no intersection is identified this list is returned. * * @param subtractions * a list of periods to subtract from this list * @return a period list */ public final PeriodList subtract(final PeriodList subtractions) { if (subtractions == null || subtractions.isEmpty()) { return this; } PeriodList result = this; PeriodList tmpResult = new PeriodList(); for (final Period subtraction : subtractions) { for (final Period period : result) { tmpResult.addAll(period.subtract(subtraction)); } result = tmpResult; tmpResult = new PeriodList(); } return result; }
/** * Subtracts the intersection of this list with the specified list of * periods from this list and returns the results as a new period list. If * no intersection is identified this list is returned. * * @param subtractions * a list of periods to subtract from this list * @return a period list */ public final PeriodList subtract(final PeriodList subtractions) { if (subtractions == null || subtractions.isEmpty()) { return this; } PeriodList result = this; PeriodList tmpResult = new PeriodList(); for (final Period subtraction : subtractions) { for (final Period period : result) { tmpResult.addAll(period.subtract(subtraction)); } result = tmpResult; tmpResult = new PeriodList(); } return result; }
/** * Subtracts the intersection of this list with the specified list of * periods from this list and returns the results as a new period list. If * no intersection is identified this list is returned. * * @param subtractions * a list of periods to subtract from this list * @return a period list */ public final PeriodList subtract(final PeriodList subtractions) { if (subtractions == null || subtractions.isEmpty()) { return this; } PeriodList result = this; PeriodList tmpResult = new PeriodList(); for (final Period subtraction : subtractions) { for (final Period period : result) { tmpResult.addAll(period.subtract(subtraction)); } result = tmpResult; tmpResult = new PeriodList(); } return result; }
/** * Subtracts the intersection of this list with the specified list of * periods from this list and returns the results as a new period list. If * no intersection is identified this list is returned. * * @param subtractions * a list of periods to subtract from this list * @return a period list */ public final PeriodList subtract(final PeriodList subtractions) { if (subtractions == null || subtractions.isEmpty()) { return this; } PeriodList result = this; PeriodList tmpResult = new PeriodList(); for (final Period subtraction : subtractions) { for (final Period period : result) { tmpResult.addAll(period.subtract(subtraction)); } result = tmpResult; tmpResult = new PeriodList(); } return result; }
recurrenceSet.addAll(rDates.stream().filter(p -> p.getParameter(Parameter.VALUE) == Value.PERIOD) .map(p -> p.getPeriods()).flatMap(PeriodList::stream).filter(rdatePeriod -> period.intersects(rdatePeriod)) .collect(Collectors.toList())); recurrenceSet.addAll(rDates.stream().filter(p -> p.getParameter(Parameter.VALUE) == Value.DATE_TIME) .map(p -> p.getDates()).flatMap(DateList::stream).filter(date -> period.includes(date)) .map(rdateTime -> new Period((DateTime) rdateTime, rDuration)).collect(Collectors.toList())); recurrenceSet.addAll(rDates.stream().filter(p -> p.getParameter(Parameter.VALUE) == Value.DATE) .map(p -> p.getDates()).flatMap(DateList::stream).filter(date -> period.includes(date)) .map(rdateDate -> new Period(new DateTime(rdateDate), rDuration)).collect(Collectors.toList())); recurrenceSet.addAll(rRules.stream().map(r -> r.getRecur().getDates(start.getDate(), new Period(startMinusDuration, period.getEnd()), startValue)).flatMap(DateList::stream) .map(rruleDate -> new Period(new DateTime(rruleDate), rDuration)).collect(Collectors.toList()));
recurrenceSet.addAll(rDates.stream().filter(p -> p.getParameter(Parameter.VALUE) == Value.PERIOD) .map(p -> p.getPeriods()).flatMap(PeriodList::stream).filter(rdatePeriod -> period.intersects(rdatePeriod)) .collect(Collectors.toList())); recurrenceSet.addAll(rDates.stream().filter(p -> p.getParameter(Parameter.VALUE) == Value.DATE_TIME) .map(p -> p.getDates()).flatMap(DateList::stream).filter(date -> period.includes(date)) .map(rdateTime -> new Period((DateTime) rdateTime, rDuration)).collect(Collectors.toList())); recurrenceSet.addAll(rDates.stream().filter(p -> p.getParameter(Parameter.VALUE) == Value.DATE) .map(p -> p.getDates()).flatMap(DateList::stream).filter(date -> period.includes(date)) .map(rdateDate -> new Period(new DateTime(rdateDate), rDuration)).collect(Collectors.toList())); recurrenceSet.addAll(rRules.stream().map(r -> r.getRecur().getDates(start.getDate(), new Period(startMinusDuration, period.getEnd()), startValue)).flatMap(DateList::stream) .map(rruleDate -> new Period(new DateTime(rruleDate), rDuration)).collect(Collectors.toList()));
fb.getParameters().getParameter(Parameter.FBTYPE); if (fbt == null || FbType.BUSY.equals(fbt)) { busyPeriods.addAll(fb.getPeriods()); } else if (FbType.BUSY_TENTATIVE.equals(fbt)) { busyTentativePeriods.addAll(fb.getPeriods()); } else if (FbType.BUSY_UNAVAILABLE.equals(fbt)) { busyUnavailablePeriods.addAll(fb.getPeriods());
fb.getParameters().getParameter(Parameter.FBTYPE); if (fbt == null || FbType.BUSY.equals(fbt)) { busyPeriods.addAll(fb.getPeriods()); } else if (FbType.BUSY_TENTATIVE.equals(fbt)) { busyTentativePeriods.addAll(fb.getPeriods()); } else if (FbType.BUSY_UNAVAILABLE.equals(fbt)) { busyUnavailablePeriods.addAll(fb.getPeriods());