com.opencloud.slee.resources.mm7
Class MM7Duration

java.lang.Object
  extended by com.opencloud.slee.resources.mm7.MM7Duration
All Implemented Interfaces:
java.io.Serializable

public class MM7Duration
extends java.lang.Object
implements java.io.Serializable

Mapping of the XML Schema "duration" type, as used in MM7. The precision of a duration type is theoretically unlimited, but this type limits the smallest unit to milliseconds and allows at most Integer.MAX_VALUE of each unit. MM7Duration instances are immutable.

See Also:
Serialized Form

Constructor Summary
MM7Duration(int years, int months, int days, int hours, int minutes, int seconds, int milliseconds, boolean negative)
          Construct a new MM7Duration object
 
Method Summary
 void addTo(java.util.Calendar cal)
          Add this duration to an existing Calendar object.
 boolean equals(java.lang.Object o)
           
 int getDays()
           
 int getHours()
           
 int getMilliseconds()
           
 int getMinutes()
           
 int getMonths()
           
 int getSeconds()
           
 int getYears()
           
 int hashCode()
           
 boolean isNegative()
           
 java.lang.String toString()
          Returns a string representation of a duration value, as specified by XML Schema (i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MM7Duration

public MM7Duration(int years,
                   int months,
                   int days,
                   int hours,
                   int minutes,
                   int seconds,
                   int milliseconds,
                   boolean negative)
Construct a new MM7Duration object

Parameters:
years - the number of years (>=0) in the duration
months - the number of months (>=0) in the duration
days - the number of days (>=0) in the duration
hours - the number of hours (>=0) in the duration
minutes - the number of minutes (>=0) in the duration
seconds - the number of seconds (>=0) in the duration
milliseconds - the number of milliseconds (>=0) in the duration
negative - true if this duration indicates a negative duration
Throws:
java.lang.IllegalArgumentException - if any parameter is negative
Method Detail

getYears

public int getYears()

getMonths

public int getMonths()

getDays

public int getDays()

getHours

public int getHours()

getMinutes

public int getMinutes()

getSeconds

public int getSeconds()

getMilliseconds

public int getMilliseconds()

isNegative

public boolean isNegative()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns a string representation of a duration value, as specified by XML Schema (i.e. ISO 8601 form)

Overrides:
toString in class java.lang.Object

addTo

public void addTo(java.util.Calendar cal)
Add this duration to an existing Calendar object.

Parameters:
cal - the calendar to update