• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PeriodList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.fortuna.ical4j.model.PeriodList的典型用法代码示例。如果您正苦于以下问题:Java PeriodList类的具体用法?Java PeriodList怎么用?Java PeriodList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PeriodList类属于net.fortuna.ical4j.model包,在下文中一共展示了PeriodList类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getEventsInPeriod

import net.fortuna.ical4j.model.PeriodList; //导入依赖的package包/类
public static List<Event> getEventsInPeriod(final Calendar cal, final Period period) {
    final Filter filter = new Filter(new Rule[] {new PeriodRule(period)}, Filter.MATCH_ALL);
    final List<Component> filtered = (List<Component>) filter.filter(cal.getComponents());
    final List<Event> ret = new ArrayList<>();
    for (final Component comp : filtered) {
        if  (!(comp instanceof VEvent)) {
            continue;
        }
        final PeriodList recurrenceSet = comp.calculateRecurrenceSet(period);
        for (final Object p : recurrenceSet) {
            ret.add(new Event(
                    getValueIfExists(comp, Property.SUMMARY),
                    getValueIfExists(comp, Property.URL),
                    (Period) p));
        }
    }
    Collections.sort(ret);
    return ret;
}
 
开发者ID:Meet-Hub-Hannover,项目名称:mailer,代码行数:20,代码来源:Event.java


示例2: freeBusyQuery

import net.fortuna.ical4j.model.PeriodList; //导入依赖的package包/类
/**
 * VFreeBusy query.
 * @param user The user.
 * @param period The period.
 * @return VFreeBusy. 
 */
public VFreeBusy freeBusyQuery(User user, Period period) {
    PeriodList busyPeriods = new PeriodList();
    PeriodList busyTentativePeriods = new PeriodList();
    PeriodList busyUnavailablePeriods = new PeriodList();
    
    HomeCollectionItem home = contentDao.getRootItem(user);
    for(Item item: home.getChildren()) {
        if(! (item instanceof CollectionItem)) {
            continue;
        }
        
        CollectionItem collection = (CollectionItem) item;
        if(StampUtils.getCalendarCollectionStamp(collection)==null ||
                collection.isExcludeFreeBusyRollup()) {
            continue;
        }
        
        doFreeBusyQuery(busyPeriods, busyTentativePeriods, busyUnavailablePeriods,
                collection, period);  
    }

    return createVFreeBusy(busyPeriods, busyTentativePeriods,
            busyUnavailablePeriods, period);
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:31,代码来源:StandardCalendarQueryProcessor.java


示例3: doFreeBusyQuery

import net.fortuna.ical4j.model.PeriodList; //导入依赖的package包/类
/**
 * Adds The FreeBusy query.
 * @param busyPeriods The period list.
 * @param busyTentativePeriods The period list.
 * @param busyUnavailablePeriods The busy unavailable periods periods.
 * @param collection The collecton item.
 * @param period The period.
 */
protected void doFreeBusyQuery(PeriodList busyPeriods,
        PeriodList busyTentativePeriods, PeriodList busyUnavailablePeriods,
        CollectionItem collection, Period period) {

    CalendarCollectionStamp ccs = StampUtils.getCalendarCollectionStamp(collection);
    if(ccs==null) {
        return;
    }
    
    HashSet<ContentItem> results = new HashSet<ContentItem>();
    TimeZone tz = ccs.getTimezone();
    
    // For the time being, use CalendarFilters to get relevant
    // items.
    CalendarFilter[] filters = createQueryFilters(collection, period);
    for(CalendarFilter filter: filters) {
        results.addAll(calendarDao.findCalendarItems(collection, filter));
    }
    
    for(ContentItem content: results) {
        Calendar calendar = entityConverter.convertContent(content);
        if(calendar==null) {
            continue;
        }
        // Add busy details from the calendar data
        addBusyPeriods(calendar, tz, period, busyPeriods,
                busyTentativePeriods, busyUnavailablePeriods);
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:38,代码来源:StandardCalendarQueryProcessor.java


示例4: addRelevantPeriods

import net.fortuna.ical4j.model.PeriodList; //导入依赖的package包/类
/**
 * Add all periods that intersect a given period to the result PeriodList.
 */
private void addRelevantPeriods(PeriodList results, PeriodList periods,
        Period range) {

    for (Iterator<Period> it = periods.iterator(); it.hasNext();) {
        Period p = it.next();
        if (p.intersects(range))
            results.add(p);
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:13,代码来源:StandardCalendarQueryProcessor.java


示例5: evaulateVFreeBusyTimeRange

import net.fortuna.ical4j.model.PeriodList; //导入依赖的package包/类
/**
 * Evaluates VFreeBusy time range.
 * @param freeBusy freebusy.
 * @param filter The filter.
 * @return The result.
 */
private boolean evaulateVFreeBusyTimeRange(VFreeBusy freeBusy, TimeRangeFilter filter) {
    DtStart start = freeBusy.getStartDate();
    DtEnd end = freeBusy.getEndDate();
     
    if (start != null && end != null) {
        InstanceList instances = new InstanceList();
        if (filter.getTimezone() != null) {
            instances.setTimezone(new TimeZone(filter.getTimezone()));
        }
        instances.addComponent(freeBusy, filter.getPeriod().getStart(),
                filter.getPeriod().getEnd());
        return instances.size() > 0;
    }
    
    PropertyList<FreeBusy> props = freeBusy.getProperties(Property.FREEBUSY);
    if(props.size()==0) {
        return false;
    }
    
    for (FreeBusy fb : props) {            
        PeriodList periods = fb.getPeriods();
        Iterator<Period> periodIt = periods.iterator();
        while(periodIt.hasNext()) {
            Period period = periodIt.next();
            if(filter.getPeriod().getStart().before(period.getEnd()) &&
               filter.getPeriod().getEnd().after(period.getStart())) {
                return true;
            }
        }
    }
    
    return false;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:40,代码来源:CalendarFilterEvaluater.java


示例6: information

import net.fortuna.ical4j.model.PeriodList; //导入依赖的package包/类
/**
    A VFREEBUSY component overlaps a given time range if the condition
    for the corresponding component state specified in the table below
    is satisfied.  The conditions depend on the presence in the
    VFREEBUSY component of the DTSTART and DTEND properties, and any
    FREEBUSY properties in the absence of DTSTART and DTEND.  Any
    DURATION property is ignored, as it has a special meaning when
    used in a VFREEBUSY component.

    When only FREEBUSY properties are used, each period in each
    FREEBUSY property is compared against the time range, irrespective
    of the type of free busy information (free, busy, busy-tentative,
    busy-unavailable) represented by the property.


    +------------------------------------------------------+
    | VFREEBUSY has both the DTSTART and DTEND properties? |
    |   +--------------------------------------------------+
    |   | VFREEBUSY has the FREEBUSY property?             |
    |   |   +----------------------------------------------+
    |   |   | Condition to evaluate                        |
    +---+---+----------------------------------------------+
    | Y | * | (start <= DTEND) AND (end > DTSTART)         |
    +---+---+----------------------------------------------+
    | N | Y | (start <  freebusy-period-end) AND           |
    |   |   | (end   >  freebusy-period-start)             |
    +---+---+----------------------------------------------+
    | N | N | FALSE                                        |
    +---+---+----------------------------------------------+
 *
 * @param freeBusy comoponent to test
 * @param period period to test against
 * @param tz timezone to use for floating times
 * @return true if component overlaps specified range, false otherwise
 */
public static boolean overlapsPeriod(VFreeBusy freeBusy, Period period, TimeZone tz){
    
    DtStart start = freeBusy.getStartDate();
    DtEnd end = freeBusy.getEndDate();
     
    if (start != null && end != null) {
        InstanceList instances = new InstanceList();
        instances.setTimezone(tz);
        instances.addComponent(freeBusy, period.getStart(),period.getEnd());
        return instances.size() > 0;
    }
    
    PropertyList<FreeBusy> props = freeBusy.getProperties(Property.FREEBUSY);
    if (props.size()==0) {
        return false;
    }
    
    for (FreeBusy fb: props) {            
        PeriodList periods = fb.getPeriods();
        Iterator<Period> periodIt = periods.iterator();
        while(periodIt.hasNext()) {
            Period fbPeriod = periodIt.next();
            if(fbPeriod.intersects(period)) {
                return true;
            }
        }
    }
    
    return false;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:66,代码来源:FreeBusyUtils.java


示例7: testAddBusyPeriodsRecurringAllDay

import net.fortuna.ical4j.model.PeriodList; //导入依赖的package包/类
/**
 * Test the add of busy periods recurring all day.
 * @throws Exception - if something is wrong this exception is thrown.
 */
@Test
public void testAddBusyPeriodsRecurringAllDay() throws Exception {
    PeriodList busyPeriods = new PeriodList();
    PeriodList busyTentativePeriods = new PeriodList();
    PeriodList busyUnavailablePeriods = new PeriodList();
    
    // the range
    DateTime start = new DateTime("20070103T090000Z");
    DateTime end = new DateTime("20070117T090000Z");
    
    Period fbRange = new Period(start, end);
    
    Calendar calendar = CalendarUtils.parseCalendar(testHelper.getBytes("allday_weekly_recurring.ics"));
    
    // test several timezones
    TimeZone tz = TIMEZONE_REGISTRY.getTimeZone("America/Chicago");
    
    queryProcessor.addBusyPeriods(calendar, tz, fbRange, busyPeriods, busyTentativePeriods, busyUnavailablePeriods);
    
    Assert.assertEquals("20070108T060000Z/20070109T060000Z,20070115T060000Z/20070116T060000Z", busyPeriods.toString());
    
    busyPeriods.clear();
    
    tz = TIMEZONE_REGISTRY.getTimeZone("America/Los_Angeles");
    queryProcessor.addBusyPeriods(calendar, tz, fbRange, busyPeriods, busyTentativePeriods, busyUnavailablePeriods);
    
    Assert.assertEquals("20070108T080000Z/20070109T080000Z,20070115T080000Z/20070116T080000Z", busyPeriods.toString());
    
    busyPeriods.clear();
    
    tz = TIMEZONE_REGISTRY.getTimeZone("Australia/Sydney");
    queryProcessor.addBusyPeriods(calendar, tz, fbRange, busyPeriods, busyTentativePeriods, busyUnavailablePeriods);
    
    Assert.assertEquals("20070107T130000Z/20070108T130000Z,20070114T130000Z/20070115T130000Z", busyPeriods.toString());
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:40,代码来源:StandardCalendarQueryProcessorTest.java



注:本文中的net.fortuna.ical4j.model.PeriodList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BeanELResolver类代码示例发布时间:2022-05-22
下一篇:
Java VKUploadAlbumPhotoRequest类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap