electric.util.time
Class Duration

java.lang.Object
  extended byelectric.util.time.Duration

public class Duration
extends java.lang.Object

todo: introduce a parse routine for a long todo: introduce a constructor for 2 date objects


Constructor Summary
Duration()
          Default no-arg constructor
Duration(boolean negative, int years, int months, int days, int hours, int minutes, double seconds)
           
Duration(java.lang.String duration)
          This method takes a string that represents an xsd:duration and parses it.
 
Method Summary
 boolean equals(java.lang.Object object)
          This converts years to months, and days down to seconds into seconds and compares these values.
 int getDays()
           
 int getHours()
           
 int getMinutes()
           
 int getMonths()
           
 double getSeconds()
           
 int getYears()
           
 int hashCode()
           
 boolean isNegative()
           
 void parseDate(java.lang.String date)
          This method parses the date portion of a duration.
 void parseTime(java.lang.String time)
          This method parses the time portion of a duration.
 void setDays(int days)
           
 void setHours(int hours)
           
 void setMinutes(int minutes)
           
 void setMonths(int months)
           
 void setNegative(boolean negative)
           
 void setSeconds(int seconds)
           
 void setYears(int years)
           
 java.lang.String toString()
          This returns the xml representation of an xsd:duration object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Duration

public Duration()
Default no-arg constructor


Duration

public Duration(boolean negative,
                int years,
                int months,
                int days,
                int hours,
                int minutes,
                double seconds)
Parameters:
negative -
years -
months -
days -
hours -
minutes -
seconds -

Duration

public Duration(java.lang.String duration)
         throws SchemaException
This method takes a string that represents an xsd:duration and parses it.

Parameters:
duration -
Throws:
SchemaException - if the string doesn't parse correctly.
Method Detail

toString

public java.lang.String toString()
This returns the xml representation of an xsd:duration object.


equals

public boolean equals(java.lang.Object object)
This converts years to months, and days down to seconds into seconds and compares these values. It is possible for 2 xsd:duration to be possibly equal (depending on start date). In other words, "31 days" could be equal to "1 month", but it all depends on when the duration starts. We ignore this possibility.

Parameters:
object -

hashCode

public int hashCode()

parseTime

public void parseTime(java.lang.String time)
This method parses the time portion of a duration.

Parameters:
time -

parseDate

public void parseDate(java.lang.String date)
This method parses the date portion of a duration.

Parameters:
date -

isNegative

public boolean isNegative()

setNegative

public void setNegative(boolean negative)
Parameters:
negative -

getYears

public int getYears()

setYears

public void setYears(int years)
Parameters:
years -

getMonths

public int getMonths()

setMonths

public void setMonths(int months)
Parameters:
months -

getDays

public int getDays()

setDays

public void setDays(int days)
Parameters:
days -

getHours

public int getHours()

setHours

public void setHours(int hours)
Parameters:
hours -

getMinutes

public int getMinutes()

setMinutes

public void setMinutes(int minutes)
Parameters:
minutes -

getSeconds

public double getSeconds()

setSeconds

public void setSeconds(int seconds)
Parameters:
seconds -


copyright© 2001-2004 by webMethods All Rights Reserved.