edu.cmu.aura.service.xml.xmlschema
Class TimeDuration

java.lang.Object
  |
  +--edu.cmu.aura.service.xml.xmlschema.TimeDuration

public class TimeDuration
extends java.lang.Object

TimeDuration is an XMLSchema primitive type that represents a length of time.


Constructor Summary
TimeDuration(long millis)
          Create a new TimeDuration from Java time in millis.
TimeDuration(java.lang.String durationDef)
          Create a new TimeDuration from a serialized definition.
 
Method Summary
 long convertToMillis()
           
 double convertToSeconds()
          Get the value of this duration in seconds.
 int getDays()
          Get the days field of this duration.
 int getHours()
          Get the hours field of this duration.
 int getMinutes()
          Get the minutes field of this duration.
 int getMonths()
          Get the months field of this duration.
 double getSeconds()
          Get the seconds field of this duration.
 int getYears()
          Get the years field of this duration.
 boolean isNegative()
          Determine if this duration is negative.
 java.lang.String toString()
          Return a serialized version of this time duration.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeDuration

public TimeDuration(java.lang.String durationDef)
             throws DataFormatException
Create a new TimeDuration from a serialized definition.
Parameters:
durationDef - the time duration definition.

TimeDuration

public TimeDuration(long millis)
Create a new TimeDuration from Java time in millis.
Parameters:
millis - the time in millis
Method Detail

isNegative

public boolean isNegative()
Determine if this duration is negative.
Returns:
true if negative false otherwise.

getSeconds

public double getSeconds()
Get the seconds field of this duration.
Returns:
the seconds field of this duration.

getMinutes

public int getMinutes()
Get the minutes field of this duration.
Returns:
the minutes field of this duration.

getHours

public int getHours()
Get the hours field of this duration.
Returns:
the hours field of this duration.

getDays

public int getDays()
Get the days field of this duration.
Returns:
the days field of this duration.

getMonths

public int getMonths()
Get the months field of this duration.
Returns:
the months field of this duration.

getYears

public int getYears()
Get the years field of this duration.
Returns:
the years field of this duration.

convertToSeconds

public double convertToSeconds()
Get the value of this duration in seconds.
Returns:
the length of this duration in seconds.

convertToMillis

public long convertToMillis()

toString

public java.lang.String toString()
Return a serialized version of this time duration. This conforms to the XMLSchema specification.
Overrides:
toString in class java.lang.Object
Returns:
a serialized version of this TimeDuration.