public boolean checkMoment(Date date) { if (calendar != null) { Period period = new Period(new DateTime(date), new Dur(0, 0, 0, 0)); Predicate<CalendarComponent> periodRule = new PeriodRule<>(period); Filter<CalendarComponent> filter = new Filter<>(new Predicate[] {periodRule}, Filter.MATCH_ANY); Collection<CalendarComponent> events = filter.filter(calendar.getComponents(CalendarComponent.VEVENT)); if (events != null && !events.isEmpty()) { return true; } } return false; }
/** * Creates a deep copy of the specified calendar. * @param c the calendar to copy * @throws IOException where an error occurs reading calendar data * @throws ParseException where calendar parsing fails * @throws URISyntaxException where an invalid URI string is encountered */ public Calendar(Calendar c) throws ParseException, IOException, URISyntaxException { this(new PropertyList<Property>(c.getProperties()), new ComponentList<CalendarComponent>(c.getComponents())); }
/** * @param bs the state */ public ContentHandlerImpl(final BuildState bs) { this.bs = bs; componentFactory = ComponentFactoryImpl.getInstance(); propertyFactory = new PropertyFactoryRegistry(); parameterFactory = new ParameterFactoryRegistry(); }
/** * Set the timezone to use when converting floating times to * UTC. Only used if isUTC is set to true. * * @param timezone The timezone. */ public void setTimezone(TimeZone timezone) { if(timezone != null ){ this.timezone = TimeZoneRegistryFactory.getInstance().createRegistry().getTimeZone(timezone.getID()); } }
@Override public Component transform(Component object) { PropertyList<Property> props = object.getProperties(); Organizer oldOrganizer = props.getProperty(Property.ORGANIZER); if (oldOrganizer != null) { props.remove(oldOrganizer); } props.add(organizer); return object; } }
/** * Test deep copy of properties. */ public void testCopy() throws IOException, URISyntaxException, ParseException { Property copy = property.copy(); assertEquals(property, copy); copy.getParameters().add(Value.BOOLEAN); assertFalse(property.equals(copy)); assertFalse(copy.equals(property)); }
/** * Constructs a new calendar builder using the specified calendar parser. * * @param parser a calendar parser used to parse calendar files */ public CalendarBuilder(final CalendarParser parser) { this(parser, new PropertyFactoryRegistry(), new ParameterFactoryRegistry(), TimeZoneRegistryFactory.getInstance().createRegistry()); }
/** * Convenience method for retrieving a named property. * @param name name of the property to retrieve * @return the first matching property in the property list with the specified name */ public final <T extends Property> T getProperty(final String name) { return getProperties().getProperty(name); }
/** * */ public void testGetEndIsUtc() { assertEquals(expectedIsUtc, period.getEnd().isUtc()); }
/** * */ public void testGetDatesTimeZone() { DateList dates = recur.getDates(periodStart, periodEnd, value); dates.forEach(date -> { assertEquals(expectedTimeZone, ((DateTime) date).getTimeZone()); }); }
/** * */ public void testGetEndTimeZone() { assertEquals(expectedTimezone, period.getEnd().getTimeZone()); }
/** * */ public void testGetDatesNotEmpty() { assertFalse(recur.getDates(periodStart, periodEnd, value).isEmpty()); }
/** * Assert toString() produces identical address list string value. * @throws URISyntaxException */ public void testToString() throws URISyntaxException { AddressList addresses = new AddressList(value); assertEquals(value, addresses.toString()); }
public void testCalculateRecurrenceSet() { PeriodList periods = component.calculateRecurrenceSet(period); assertEquals("Wrong number of periods", expectedPeriods.size(), periods.size()); assertEquals(expectedPeriods, periods); }
/** * */ public void testGetEnd() { assertEquals(expectedDate, period.getEnd()); }
/** * */ public void testSize() { assertEquals(expectedSize, dateList.size()); }
/** * Creates a deep copy of the specified calendar. * @param c the calendar to copy * @throws IOException where an error occurs reading calendar data * @throws ParseException where calendar parsing fails * @throws URISyntaxException where an invalid URI string is encountered */ public Calendar(Calendar c) throws ParseException, IOException, URISyntaxException { this(new PropertyList(c.getProperties()), new ComponentList<CalendarComponent>(c.getComponents())); }
/** * Creates a deep copy of the specified calendar. * @param c the calendar to copy * @throws IOException where an error occurs reading calendar data * @throws ParseException where calendar parsing fails * @throws URISyntaxException where an invalid URI string is encountered */ public Calendar(Calendar c) throws ParseException, IOException, URISyntaxException { this(new PropertyList<Property>(c.getProperties()), new ComponentList<CalendarComponent>(c.getComponents())); }