|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nitido.nimx.nuggets.wcap.Duration
public class Duration
Duration class convert different time format into int fields of the week, day, hour, min, and sec. The time input are specified as parameters to the special purpose constructors. The time units can be retrieved directly from the public fields once the object has been instantiated successfully.
The first special purpose constructor takes in an ISO 8601 duration format String and break it down into the different time units. (e.g. P1DT2H30M = 1 day, 2 hours and 30 minutes ) NOTE: According to RFC 2445, calendar server doesn't need to support the year and month field of the ISO 8601 duration string. Therefore, this class does not provide these two fields.
The second special purpose constructor takes in the start and end Date objects and compute the duration fields based on the differences of thes two objects.
Field Summary | |
---|---|
int |
day
The number of days in the duration. |
int |
hour
The number of hours in the duration. |
boolean |
isPositive
The boolean flag to indicate if the duration is a regular positive duration. |
int |
min
The number of minutes in the duration. |
int |
sec
The number of seconds in the duration. |
int |
week
The number of weeks in the duration. |
Constructor Summary | |
---|---|
Duration(boolean isPositive,
int week,
int day,
int hour,
int min,
int sec)
Default constructor. |
|
Duration(java.util.Date startTime,
java.util.Date endTime)
DateTime difference constructor. |
|
Duration(int hour,
int min)
Convenience constructor. |
|
Duration(int week,
int day,
int hour,
int min,
int sec)
Event/ToDo specific duration constructor. |
|
Duration(java.lang.String durString)
ISO String constructor. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object inObj)
Override the default java.lang.Object's equal command. |
java.util.Date |
toEndTime(java.util.Date startTime)
Return an end Date object based on the startTime parameter. |
java.lang.String |
toString()
Return an ISO 8601 duration format representation of the duration time information. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean isPositive
It can be false if the duration is specifying the end time is "before" the start time (i.e. when it is a negative duration). The default value is true.
public int week
A valid value must be a postive integer. 0 or negative number means this field is not set.
public int day
A valid value must be a postive integer. 0 or negative number means this field is not set.
public int hour
A valid value must be a postive integer. 0 or negative number means this field is not set.
public int min
A valid value must be a postive integer. 0 or negative number means this field is not set.
public int sec
A valid value must be a postive integer. 0 or negative number means this field is not set.
Constructor Detail |
---|
public Duration(boolean isPositive, int week, int day, int hour, int min, int sec)
isPositive
- The boolean flag to indicate if the duration is a regular positive
duration. A positive duration indicates the end time is "after" the
start time.
This value can be false if the duration is specifying the end time is
"before" the start time (i.e. when it is a negative duration).
The default value is true.week
- The number of weeks in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.day
- The number of days in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.hour
- The number of hours in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.min
- The number of minutes in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.sec
- The number of seconds in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.public Duration(int week, int day, int hour, int min, int sec)
week
- The number of weeks in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.day
- The number of days in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.hour
- The number of hours in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.min
- The number of minutes in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.sec
- The number of seconds in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.public Duration(int hour, int min)
hour
- The number of hours in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.min
- The number of minutess in the duration.
A valid value must be a postive integer.
0 or negative number means this field is not set.public Duration(java.lang.String durString) throws InvalidParameterException
durString
- This parameter should be in the duration format
InvalidParameterException
public Duration(java.util.Date startTime, java.util.Date endTime)
startTime
- The starting Date object.endTime
- The ending Date object.Method Detail |
---|
public java.util.Date toEndTime(java.util.Date startTime)
startTime
- The start Date object.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object inObj)
equals
in class java.lang.Object
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.