org.exolab.castor.types
public class Duration extends Object implements Serializable
This class is the representation of XML Schema datatype: duration.
This representation does not support the decimal fraction for the lowest order item.
The order relation provided by this implementation does not follow the guidelines of XML Schema Specification that defines only a partial order.
For more information see X3C XML Schema Specification.
Version: $Revision: 1.3 $ $Date: 2005/03/05 13:41:56 $
Constructor Summary | |
---|---|
Duration()
default constructor | |
Duration(String duration)
Constructs a duration from a string | |
Duration(long l) This constructor fills in the duration fields according to the value of the long by calling setValue. |
Method Summary | |
---|---|
boolean | equal(Duration duration)
Returns true if the instance of TimeDuration has the same fields
of the parameter |
boolean | equals(Object object)
Override the java.lang.equals method |
short | getDay() |
short | getHour() |
long | getMilli() |
short | getMinute() |
short | getMonth() |
short | getSeconds() |
short | getYear() |
int | hashCode()
Overrides the java.lang.Object#hashcode method. |
boolean | isGreater(Duration duration) Returns true if the present instance of TimeDuration is greater than the parameter Note This definition does not follow the XML SCHEMA RECOMMENDATION 05022001 the following total order relation is used : givent t1,t2 timeDuration types t1>t2 iff t1.toLong()>t2.toLong() |
boolean | isNegative() |
static Object | parse(String str)
parse a String and convert it into a java.lang.Object |
static Duration | parseDuration(String str) Parse the given string and return a time duration which represents this string. |
void | setDay(short day) |
void | setHour(short hour) |
void | setMilli(long milli) |
void | setMinute(short minute) |
void | setMonth(short month) |
void | setNegative() |
void | setSeconds(short second) |
void | setValue(short year, short month, short day, short hour, short minute, short second, long millisecond)
Fill in the fields of the duration with the given values |
void | setYear(short year) |
long | toLong() Convert a duration into a long This long represents the duration in milliseconds. |
String | toString() Convert a duration into a String conforming to ISO8601 and XML Schema specs |
Parameters: duration the string representation of the duration to create
This constructor fills in the duration fields according to the value of the long by calling setValue.
Parameters: l the long value of the Duration
See Also: Duration
Parameters: duration the time duration to compare
Returns: true if equal, false if not
See Also: Duration
Returns true if the present instance of TimeDuration is greater than the parameter
Note This definition does not follow the XML SCHEMA RECOMMENDATION 05022001 the following total order relation is used : givent t1,t2 timeDuration types t1>t2 iff t1.toLong()>t2.toLong()
Parameters: duration the time duration to compare with the present instance
Returns: true if the present instance is the greatest, false if not
Parameters: str the string to parse
Returns: the java.lang.Object represented by the string
Throws: ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)
Parse the given string and return a time duration which represents this string.
Parameters: str the string to parse
Returns: a TimeDuration instance which represent the string
Throws: ParseException thrown when the string is not valid
Parameters: year the year value month the month value day the day value hour the hour value minute the minute value second the second value
Convert a duration into a long This long represents the duration in milliseconds.
Returns: a long representing the duration
Convert a duration into a String conforming to ISO8601 and XML Schema specs
Returns: a string representing the duration