当前位置: 首页>>代码示例>>Java>>正文


Java Date.after方法代码示例

本文整理汇总了Java中net.fortuna.ical4j.model.Date.after方法的典型用法代码示例。如果您正苦于以下问题:Java Date.after方法的具体用法?Java Date.after怎么用?Java Date.after使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.fortuna.ical4j.model.Date的用法示例。


在下文中一共展示了Date.after方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import net.fortuna.ical4j.model.Date; //导入方法依赖的package包/类
/**
 * Evaluates property.
 * @param property The proeprty.
 * @param filter The time range filter.
 * @return The result.
 */
private boolean evaluate(Property property, TimeRangeFilter filter) {
    if(!(property instanceof DateProperty) ) {
        return false;
    }
    
    DateProperty dateProp = (DateProperty) property;
    Date date = dateProp.getDate();
    
    return date.before(filter.getPeriod().getEnd()) &&
           date.after(filter.getPeriod().getStart()) ||
           date.equals(filter.getPeriod().getStart()) ;
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:19,代码来源:CalendarFilterEvaluater.java

示例2: adjustStartRangeIfNecessary

import net.fortuna.ical4j.model.Date; //导入方法依赖的package包/类
/**
 * Adjust startRange to account for instances that begin before the given
 * startRange, but end after. For example if you have a daily recurring event
 * at 8am lasting for an hour and your startRange is 8:01am, then you
 * want to adjust the range back an hour to catch the instance that is
 * already occurring.
 *
 * @param startRange The date in range we want to adjust.
 * @param start      The date of the event.
 * @param dur        The duration.
 * @return The adjusted start Range date.
 */
private Date adjustStartRangeIfNecessary(Date startRange, Date start, Dur dur) {

    // If start is a Date, then we need to convert startRange to
    // a Date using the timezone present
    if (!(start instanceof DateTime) && timezone != null && startRange instanceof DateTime) {
        return ICalendarUtils.normalizeUTCDateTimeToDate(
                (DateTime) startRange, timezone);
    }

    // Otherwise start is a DateTime

    // If startRange is not the event start, no adjustment necessary
    if (!startRange.after(start)) {
        return startRange;
    }

    // Need to adjust startRange back one duration to account for instances
    // that occur before the startRange, but end after the startRange
    Dur negatedDur = dur.negate();

    Calendar cal = Dates.getCalendarInstance(startRange);
    cal.setTime(negatedDur.getTime(startRange));

    // Return new startRange only if it is before the original startRange 
    if (cal.getTime().before(startRange)) {
        return org.unitedinternet.cosmo.calendar.util.Dates.getInstance(cal.getTime(), startRange);
    }

    return startRange;
}
 
开发者ID:ksokol,项目名称:carldav,代码行数:43,代码来源:InstanceList.java

示例3: setCalendarAttributes

import net.fortuna.ical4j.model.Date; //导入方法依赖的package包/类
/**
 * Sets calendar attributes.
 * @param note The note item.
 * @param event The event.
 */
private void setCalendarAttributes(NoteItem note, VEvent event) {
    
    // UID (only set if master)
    if(event.getUid()!=null && note.getModifies()==null) {
        note.setIcalUid(event.getUid().getValue());
    }
    
    // for now displayName is limited to 1024 chars
    if (event.getSummary() != null) {
        note.setDisplayName(StringUtils.substring(event.getSummary()
                .getValue(), 0, 1024));
    }

    if (event.getDescription() != null) {
        note.setBody(event.getDescription().getValue());
    }

    // look for DTSTAMP
    if(event.getDateStamp()!=null) {
        note.setClientModifiedDate(event.getDateStamp().getDate());
    }
    
    // look for absolute VALARM
    VAlarm va = ICalendarUtils.getDisplayAlarm(event);
    if (va != null && va.getTrigger()!=null) {
        Trigger trigger = va.getTrigger();
        Date reminderTime = trigger.getDateTime();
        if (reminderTime != null) {
            note.setReminderTime(reminderTime);
        }
    }

    // calculate triage status based on start date
    java.util.Date now =java.util.Calendar.getInstance().getTime();
    Date eventStartDate = event.getStartDate() != null && event.getStartDate().getDate() != null 
    		? event.getStartDate().getDate()
    		:new Date();
    boolean later = eventStartDate.after(now);
    int code = later ? TriageStatus.CODE_LATER : TriageStatus.CODE_DONE;
    
    TriageStatus triageStatus = note.getTriageStatus();
    
    // initialize TriageStatus if not present
    if (triageStatus == null) {
        triageStatus = TriageStatusUtil.initialize(entityFactory
                .createTriageStatus());
        note.setTriageStatus(triageStatus);
    }

    triageStatus.setCode(code);
    
    // check for X-OSAF-STARRED
    if ("TRUE".equals(ICalendarUtils.getXProperty(X_OSAF_STARRED, event))) {
        TaskStamp ts = StampUtils.getTaskStamp(note);
        if (ts == null) {
            note.addStamp(entityFactory.createTaskStamp());
        }
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:65,代码来源:EntityConverter.java


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