org.exolab.castor.types
Class Duration
java.lang.Object
org.exolab.castor.types.Duration
- java.io.Serializable
public class Duration
extends java.lang.Object
implements java.io.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.
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:08:55 $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.
|
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()
|
short | 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(short 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, short 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
|
Duration
public Duration()
default constructor
Duration
public Duration(String duration)
throws ParseException
Constructs a duration from a string
duration
- the string representation of the duration to create
Duration
public Duration(long l)
This constructor fills in the duration fields according to the
value of the long by calling setValue.
l
- the long value of the Duration
equal
public boolean equal(Duration duration)
Returns true if the instance of TimeDuration has the same fields
of the parameter
- true if equal, false if not
equals
public boolean equals(Object object)
Override the java.lang.equals method
getDay
public short getDay()
getHour
public short getHour()
getMilli
public short getMilli()
getMinute
public short getMinute()
getMonth
public short getMonth()
getSeconds
public short getSeconds()
getYear
public short getYear()
hashCode
public int hashCode()
Overrides the java.lang.Object#hashcode method.
isGreater
public 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()
- true if the present instance is the greatest, false if not
isNegative
public boolean isNegative()
parse
public static Object parse(String str)
throws ParseException
parse a String and convert it into a java.lang.Object
str
- the string to parse
- the java.lang.Object represented by the string
parseDuration
public static Duration parseDuration(String str)
throws ParseException
Parse the given string and return a time duration
which represents this string.
- a TimeDuration instance which represent the string
setDay
public void setDay(short day)
setHour
public void setHour(short hour)
setMilli
public void setMilli(short milli)
setMinute
public void setMinute(short minute)
setMonth
public void setMonth(short month)
setNegative
public void setNegative()
setSeconds
public void setSeconds(short second)
setValue
public void setValue(short year,
short month,
short day,
short hour,
short minute,
short second,
short millisecond)
Fill in the fields of the duration with the given values
year
- the year valuemonth
- the month valueday
- the day valuehour
- the hour valueminute
- the minute valuesecond
- the second value
setYear
public void setYear(short year)
toLong
public long toLong()
Convert a duration into a long
This long represents the duration in milliseconds.
- a long representing the duration
toString
public String toString()
- a string representing the duration
Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com