java.lang.Object
net.fortuna.ical4j.model.Dur
- All Implemented Interfaces:
Serializable,Comparable<Dur>
Deprecated.
$Id$
Created on 20/06/2005
Represents a duration of time in iCalendar. Note that according to RFC2445 durations represented in weeks are
mutually exclusive of other duration fields.
4.3.6 Duration
Value Name: DURATION
Purpose: This value type is used to identify properties that contain
a duration of time.
Formal Definition: The 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"
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDur(int weeks) Deprecated.Constructs a new duration from the specified weeks.Dur(int days, int hours, int minutes, int seconds) Deprecated.Constructs a new duration from the specified arguments.Deprecated.Constructs a new duration instance from a string representation.Deprecated.Constructs a new duration representing the time between the two specified dates. -
Method Summary
Modifier and TypeMethodDescriptionfinal DurDeprecated.Add two durations.final intDeprecated.Compares this duration with another, acording to their length.booleanDeprecated.final intgetDays()Deprecated.final intgetHours()Deprecated.final intDeprecated.final intDeprecated.final DateDeprecated.Returns a date representing the end of this duration from the specified start date.final intgetWeeks()Deprecated.inthashCode()Deprecated.final booleanDeprecated.final Durnegate()Deprecated.Provides a negation of this instance.final StringtoString()Deprecated.
-
Constructor Details
-
Dur
Deprecated.Constructs a new duration instance from a string representation.- Parameters:
value- a string representation of a duration
-
Dur
public Dur(int weeks) Deprecated.Constructs a new duration from the specified weeks.- Parameters:
weeks- a duration in weeks.
-
Dur
public Dur(int days, int hours, int minutes, int seconds) Deprecated.Constructs a new duration from the specified arguments.- Parameters:
days- duration in dayshours- duration in hoursminutes- duration in minutesseconds- duration in seconds
-
Dur
Deprecated.Constructs a new duration representing the time between the two specified dates. The end date may precede the start date in order to represent a negative duration.- Parameters:
date1- the first date of the durationdate2- the second date of the duration
-
-
Method Details
-
getTime
Deprecated.Returns a date representing the end of this duration from the specified start date.- Parameters:
start- the date to start the duration- Returns:
- the end of the duration as a date
-
negate
Deprecated.Provides a negation of this instance.- Returns:
- a Dur instance that represents a negation of this instance
-
add
Deprecated.Add two durations. Durations may only be added if they are both positive or both negative durations.- Parameters:
duration- the duration to add to this duration- Returns:
- a new instance representing the sum of the two durations.
-
toString
Deprecated. -
compareTo
Deprecated.Compares this duration with another, acording to their length.- Specified by:
compareToin interfaceComparable<Dur>- Parameters:
arg0- another duration instance- Returns:
- a postive value if this duration is longer, zero if the duration lengths are equal, otherwise a negative value
-
equals
Deprecated. -
hashCode
public int hashCode()Deprecated. -
getDays
public final int getDays()Deprecated.- Returns:
- Returns the days.
-
getHours
public final int getHours()Deprecated.- Returns:
- Returns the hours.
-
getMinutes
public final int getMinutes()Deprecated.- Returns:
- Returns the minutes.
-
isNegative
public final boolean isNegative()Deprecated.- Returns:
- Returns the negative.
-
getSeconds
public final int getSeconds()Deprecated.- Returns:
- Returns the seconds.
-
getWeeks
public final int getWeeks()Deprecated.- Returns:
- Returns the weeks.
-
TemporalAmountimplementations such asDurationandPeriodin Java 8.