Public Member Functions | Static Public Member Functions

org.exolab.castor.types.Duration Class Reference

List of all members.

Public Member Functions

 Duration ()
 Duration (String duration) throws ParseException
 Duration (long l)
void setYear (short year)
void setMonth (short month)
void setDay (short day)
void setHour (short hour)
void setMinute (short minute)
void setSeconds (short second)
void setMilli (long milli)
void setNegative ()
void setValue (short year, short month, short day, short hour, short minute, short second, long millisecond)
short getYear ()
short getMonth ()
short getDay ()
short getHour ()
short getMinute ()
short getSeconds ()
long getMilli ()
boolean isNegative ()
long toLong ()
String toString ()
int hashCode ()
boolean equals (Object object)
boolean equal (Duration duration)
boolean isGreater (Duration duration)

Static Public Member Functions

static Object parse (String str) throws ParseException
static Duration parseDuration (String str) throws ParseException

Detailed Description

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.

Author:
Arnaud Blandin
Version:
Revision:
1.2
Date:
2004/11/11 17:22:39

Constructor & Destructor Documentation

org.exolab.castor.types.Duration.Duration (  ) 

default constructor

Referenced by org.exolab.castor.types.Duration.parseDuration().

org.exolab.castor.types.Duration.Duration ( String  duration  )  throws ParseException

Constructs a duration from a string

Parameters:
duration the string representation of the duration to create
org.exolab.castor.types.Duration.Duration ( long  l  ) 

This constructor fills in the duration fields according to the value of the long by calling setValue.

See also:
setValue
Parameters:
l the long value of the Duration
Returns:
A duration which represents the long

References org.exolab.castor.types.Duration.setNegative(), and org.exolab.castor.types.Duration.setValue().


Member Function Documentation

boolean org.exolab.castor.types.Duration.equal ( Duration  duration  ) 
boolean org.exolab.castor.types.Duration.equals ( Object  object  ) 

Override the java.lang.equals method

See also:
equal

References org.exolab.castor.types.Duration.equal().

short org.exolab.castor.types.Duration.getDay (  ) 
short org.exolab.castor.types.Duration.getHour (  ) 
long org.exolab.castor.types.Duration.getMilli (  ) 
short org.exolab.castor.types.Duration.getMinute (  ) 
short org.exolab.castor.types.Duration.getMonth (  ) 
short org.exolab.castor.types.Duration.getSeconds (  ) 
short org.exolab.castor.types.Duration.getYear (  ) 
int org.exolab.castor.types.Duration.hashCode (  ) 

Overrides the java.lang.Object.hashcode method.

boolean org.exolab.castor.types.Duration.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()

Parameters:
timeD the time duration to compare with the present instance
Returns:
true if the present instance is the greatest, false if not

References org.exolab.castor.types.Duration.toLong().

Referenced by org.exolab.castor.xml.validators.DurationValidator.validate().

boolean org.exolab.castor.types.Duration.isNegative (  ) 
static Object org.exolab.castor.types.Duration.parse ( String  str  )  throws ParseException [static]

parse a String and convert it into a java.lang.Object

Parameters:
str the string to parse
Returns:
the java.lang.Object represented by the string
Exceptions:
ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)

References org.exolab.castor.types.Duration.parseDuration().

static Duration org.exolab.castor.types.Duration.parseDuration ( String  str  )  throws ParseException [static]

Parse the given string and return a time duration which represents this string.

Parameters:
String str the string to parse
Returns:
a TimeDuration instance which represent the string
Exceptions:
ParseException thrown when the string is not valid

References org.exolab.castor.types.Duration.Duration().

Referenced by org.exolab.castor.types.Duration.parse(), and org.exolab.castor.xml.validators.DurationValidator.validate().

void org.exolab.castor.types.Duration.setDay ( short  day  ) 
void org.exolab.castor.types.Duration.setHour ( short  hour  ) 
void org.exolab.castor.types.Duration.setMilli ( long  milli  ) 
void org.exolab.castor.types.Duration.setMinute ( short  minute  ) 
void org.exolab.castor.types.Duration.setMonth ( short  month  ) 
void org.exolab.castor.types.Duration.setNegative (  ) 
void org.exolab.castor.types.Duration.setSeconds ( short  second  ) 
void org.exolab.castor.types.Duration.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

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

References org.exolab.castor.types.Duration.setDay(), org.exolab.castor.types.Duration.setHour(), org.exolab.castor.types.Duration.setMilli(), org.exolab.castor.types.Duration.setMinute(), org.exolab.castor.types.Duration.setMonth(), org.exolab.castor.types.Duration.setSeconds(), and org.exolab.castor.types.Duration.setYear().

Referenced by org.exolab.castor.types.Duration.Duration().

void org.exolab.castor.types.Duration.setYear ( short  year  ) 
long org.exolab.castor.types.Duration.toLong (  ) 

Convert a duration into a long This long represents the duration in milliseconds.

Returns:
a long representing the duration

References org.exolab.castor.types.Duration.isNegative().

Referenced by org.exolab.castor.types.Duration.isGreater(), org.exolab.castor.types.Duration.toString(), and org.exolab.castor.builder.types.XSDuration.validationCode().

String org.exolab.castor.types.Duration.toString (  ) 

Convert a duration into a String conforming to ISO8601 and XML Schema specs

Returns:
a string representing the duration

References org.exolab.castor.types.Duration.toLong().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties