net.fortuna.ical4j.model.property.Duration类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中net.fortuna.ical4j.model.property.Duration类的一些代码示例,展示了Duration类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Duration类的具体详情如下:
包路径:net.fortuna.ical4j.model.property.Duration
类名称:Duration

Duration介绍

[英]$Id$

Created: [Apr 6, 2004]

Defines a DURATION iCalendar component property.

3.3.6.  Duration 
Value Name:  DURATION 
Purpose:  This value type is used to identify properties that contain 
a duration of time. 
Format Definition:  This value type is defined by the following 
notation: 
dur-value  = (["+"] / "-") "P" (dur-date / dur-time / dur-week) 
dur-date   = dur-day [dur-time] 
dur-time   = "T" (dur-hour / dur-minute / dur-second) 
dur-week   = 1*DIGIT "W" 
dur-hour   = 1*DIGIT "H" [dur-minute] 
dur-minute = 1*DIGIT "M" [dur-second] 
dur-second = 1*DIGIT "S" 
dur-day    = 1*DIGIT "D" 
Description:  If the property permits, multiple "duration" values are 
specified by a COMMA-separated list of values.  The format is 
based on the [ISO.8601.2004] complete representation basic format 
with designators for the duration of time.  The format can 
represent nominal durations (weeks and days) and accurate 
durations (hours, minutes, and seconds).  Note that unlike 
[ISO.8601.2004], this value type doesn't support the "Y" and "M" 
designators to specify durations in terms of years and months. 
The duration of a week or a day depends on its position in the 
calendar.  In the case of discontinuities in the time scale, such 
as the change from standard time to daylight time and back, the 
computation of the exact duration requires the subtraction or 
addition of the change of duration of the discontinuity.  Leap 
seconds MUST NOT be considered when computing an exact duration. 
When computing an exact duration, the greatest order time 
components MUST be added first, that is, the number of days MUST 
be added first, followed by the number of hours, number of 
minutes, and number of seconds. 
Negative durations are typically used to schedule an alarm to 
trigger before an associated time (see Section 3.8.6.3). 
No additional content value encoding (i.e., BACKSLASH character 
encoding, see Section 3.3.11) are defined for this value type. 
Example:  A duration of 15 days, 5 hours, and 20 seconds would be: 
P15DT5H0M20S 
A duration of 7 weeks would be: 
P7W

[中]$Id$
创建:[2004年4月6日]
定义持续时间iCalendar组件属性。

3.3.6.  Duration 
Value Name:  DURATION 
Purpose:  This value type is used to identify properties that contain 
a duration of time. 
Format Definition:  This value type is defined by the following 
notation: 
dur-value  = (["+"] / "-") "P" (dur-date / dur-time / dur-week) 
dur-date   = dur-day [dur-time] 
dur-time   = "T" (dur-hour / dur-minute / dur-second) 
dur-week   = 1*DIGIT "W" 
dur-hour   = 1*DIGIT "H" [dur-minute] 
dur-minute = 1*DIGIT "M" [dur-second] 
dur-second = 1*DIGIT "S" 
dur-day    = 1*DIGIT "D" 
Description:  If the property permits, multiple "duration" values are 
specified by a COMMA-separated list of values.  The format is 
based on the [ISO.8601.2004] complete representation basic format 
with designators for the duration of time.  The format can 
represent nominal durations (weeks and days) and accurate 
durations (hours, minutes, and seconds).  Note that unlike 
[ISO.8601.2004], this value type doesn't support the "Y" and "M" 
designators to specify durations in terms of years and months. 
The duration of a week or a day depends on its position in the 
calendar.  In the case of discontinuities in the time scale, such 
as the change from standard time to daylight time and back, the 
computation of the exact duration requires the subtraction or 
addition of the change of duration of the discontinuity.  Leap 
seconds MUST NOT be considered when computing an exact duration. 
When computing an exact duration, the greatest order time 
components MUST be added first, that is, the number of days MUST 
be added first, followed by the number of hours, number of 
minutes, and number of seconds. 
Negative durations are typically used to schedule an alarm to 
trigger before an associated time (see Section 3.8.6.3). 
No additional content value encoding (i.e., BACKSLASH character 
encoding, see Section 3.3.11) are defined for this value type. 
Example:  A duration of 15 days, 5 hours, and 20 seconds would be: 
P15DT5H0M20S 
A duration of 7 weeks would be: 
P7W

代码示例

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

final Dur dur = new Duration(null, duration).getDuration();
triggerDate = dur.getTime(previousTrigger);
return triggerDate;

代码示例来源:origin: org.mnode.ical4j/ical4j

/**
 * @param aList    a list of parameters for this component
 * @param duration a duration value
 */
public Duration(final ParameterList aList, final TemporalAmount duration) {
  super(DURATION, aList, new Factory());
  setDuration(duration);
}

代码示例来源:origin: PrivacyApps/calendar-import-export

private static Duration createDuration(String value) {
  Duration d = new Duration();
  d.setValue(value);
  return d;
}

代码示例来源:origin: org.bedework/bw-ical4j-cl

public Property createProperty(final String name,
    final ParameterList parameters, final String value)
    throws IOException, URISyntaxException, ParseException {
  return new Duration(parameters, value);
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

/** Return a value based on this value plus a duration.
 *
 * @param val
 * @return BwDateTime
 * @throws CalFacadeException
 */
public BwDateTime addDuration(final BwDuration val) throws CalFacadeException {
 return addDuration(val.makeDuration().getDuration());
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

public void setDisplayAlarmDuration(Dur dur) {
  VAlarm alarm = getDisplayAlarm();
  if(alarm==null) {
    return;
  }
  
  Duration duration = (Duration) alarm.getProperties().getProperty(
      Property.DURATION);
  if (dur == null) {
    if (duration != null) {
      alarm.getProperties().remove(duration);
    }
    return;
  }
  if (duration == null) {
    duration = new Duration();
    alarm.getProperties().add(duration);
  }
  
  duration.setDuration(dur);
}

代码示例来源:origin: ical4j/ical4j

/**
 * @param aList  a list of parameters for this component
 * @param aValue a value string for this component
 */
public Duration(final ParameterList aList, final String aValue) {
  super(DURATION, aList, new Factory());
  setValue(aValue);
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-ical

String durVal = duration.getValue();
if (!durVal.equals(ev.getDuration())) {
 chg.changed(PropertyInfoIndex.DURATION, ev.getDuration(), durVal);
Dur dur = duration.getDuration();

代码示例来源:origin: ical4j/ical4j

public Property createProperty() {
    return new Duration();
  }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

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;
  }
}

代码示例来源:origin: 1and1/cosmo

public void setDisplayAlarmDuration(Dur dur) {
  VAlarm alarm = getDisplayAlarm();
  if(alarm==null) {
    return;
  }
  
  Duration duration = (Duration) alarm.getProperties().getProperty(
      Property.DURATION);
  if (dur == null) {
    if (duration != null) {
      alarm.getProperties().remove(duration);
    }
    return;
  }
  if (duration == null) {
    duration = new Duration();
    alarm.getProperties().add(duration);
  }
  
  duration.setDuration(dur);
}

代码示例来源:origin: org.bedework.ical4j/ical4j

/**
 * @param aList  a list of parameters for this component
 * @param aValue a value string for this component
 */
public Duration(final ParameterList aList, final String aValue) {
  super(DURATION, aList, PropertyFactoryImpl.getInstance());
  setValue(aValue);
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * 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();
}

代码示例来源:origin: org.mnode.ical4j/ical4j

public Property createProperty(final ParameterList parameters, final String value)
    throws IOException, URISyntaxException, ParseException {
  return new Duration(parameters, value);
}

代码示例来源:origin: 1and1/cosmo

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;
  }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

duration.setDuration(dur);
  event.getProperties().remove(dtend);
duration = new Duration(dur);
event.getProperties().add(duration);

代码示例来源:origin: net.oneandone.ical4j/ical4j

/**
 * @param aList    a list of parameters for this component
 * @param duration a duration value
 */
public Duration(final ParameterList aList, final Dur duration) {
  super(DURATION, aList, PropertyFactoryImpl.getInstance());
  setDuration(duration);
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

/**
 * @param aList  a list of parameters for this component
 * @param aValue a value string for this component
 */
public Duration(final ParameterList aList, final String aValue) {
  super(DURATION, aList, PropertyFactoryImpl.getInstance());
  setValue(aValue);
}

代码示例来源:origin: 1and1/cosmo

/**
 * 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();
}

代码示例来源:origin: ical4j/ical4j

public Property createProperty(final ParameterList parameters, final String value)
    throws IOException, URISyntaxException, ParseException {
  return new Duration(parameters, value);
}

相关文章

微信公众号

最新文章

更多