本文整理汇总了Java中net.fortuna.ical4j.model.property.Duration.getDuration方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.getDuration方法的具体用法?Java Duration.getDuration怎么用?Java Duration.getDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.fortuna.ical4j.model.property.Duration
的用法示例。
在下文中一共展示了Duration.getDuration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDuration
import net.fortuna.ical4j.model.property.Duration; //导入方法依赖的package包/类
/**
* Get the duration for an event. If the DURATION property
* exist, use that. Else, calculate duration from DTSTART and
* DTEND.
* @param event The event.
* @return duration for event
*/
public static Dur getDuration(VEvent event) {
Duration duration = (Duration)
event.getProperties().getProperty(Property.DURATION);
if (duration != null) {
return duration.getDuration();
}
DtStart dtstart = event.getStartDate();
if (dtstart == null) {
return null;
}
DtEnd dtend = (DtEnd) event.getProperties().getProperty(Property.DTEND);
if (dtend == null) {
return null;
}
return new Duration(dtstart.getDate(), dtend.getDate()).getDuration();
}
示例2: fromDuration
import net.fortuna.ical4j.model.property.Duration; //导入方法依赖的package包/类
protected static Double fromDuration(PropertyList propertyList) {
Duration iCalObj = (Duration) propertyList.getProperty(Duration.DURATION);
if (iCalObj == null) {
return null;
}
Dur dur = iCalObj.getDuration();
TimeDuration td = new TimeDuration(0, 0, (dur.getWeeks() * 7) + dur.getDays(), dur.getHours(), dur.getMinutes(), dur.getSeconds(), 0);
return new Double(TimeDuration.toLong(td));
}
示例3: getDisplayAlarmDuration
import net.fortuna.ical4j.model.property.Duration; //导入方法依赖的package包/类
public Dur getDisplayAlarmDuration() {
VAlarm alarm = getDisplayAlarm();
if(alarm==null) {
return null;
}
Duration dur = (Duration) alarm.getProperties().getProperty(Property.DURATION);
if(dur!=null) {
return dur.getDuration();
}
else {
return null;
}
}
示例4: getDisplayAlarmDuration
import net.fortuna.ical4j.model.property.Duration; //导入方法依赖的package包/类
/**
* Gets display alarm duration.
* @return The duration.
*/
public Dur getDisplayAlarmDuration() {
VAlarm alarm = getDisplayAlarm();
if (alarm == null) {
return null;
}
Duration dur = (Duration) alarm.getProperties().getProperty(Property.DURATION);
if (dur != null) {
return dur.getDuration();
}
else {
return null;
}
}