com.waveset.util
Class Util.TimePeriod

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.util.Util.TimePeriod
All Implemented Interfaces:
java.lang.Cloneable, javax.naming.Referenceable, XmlObject
Enclosing class:
Util

public static class Util.TimePeriod
extends AbstractXmlObject
implements java.lang.Cloneable

Used to represent a time period, such as number of days, weeks or months, relative to an arbitrary day.


Field Summary
static java.lang.String ELEMENT
          Name of the serialized XML element.
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace, code_id
 
Constructor Summary
Util.TimePeriod()
          Build a default time period, zero days.
Util.TimePeriod(org.w3c.dom.Element e)
          Construct a time period by parsing its DOM representation.
Util.TimePeriod(Util.TimeUnit unit, int count)
          Build a time unit specifying the unit and count.
 
Method Summary
 java.util.Date add(java.util.Date start)
          Add the time period to a date, and return the relative date.
 java.lang.Object clone()
          Clone the TimePeriod.
 Util.TimePeriod copy()
          A more convenient clone.
 int getCount()
          Get the time unit count.
 java.lang.String getElementName()
          Return the element name.
 Util.TimeUnit getUnit()
          Get the time unit.
 void setCount(int c)
          Set the time unit count.
 void setUnit(Util.TimeUnit u)
          Set the time unit.
 java.util.Date subtract(java.util.Date start)
          Subtract the time period from a date, and return the relative date.
 Util.TimePeriod subtract(Util.TimePeriod p)
          Subtract the specified time period from this time period and return a time period jsl - can't we use the Calendar class for much of this?
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize the time period to an XML buffer.
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT

public static final java.lang.String ELEMENT
Name of the serialized XML element.

See Also:
Constant Field Values
Constructor Detail

Util.TimePeriod

public Util.TimePeriod()
Build a default time period, zero days.


Util.TimePeriod

public Util.TimePeriod(Util.TimeUnit unit,
                       int count)
Build a time unit specifying the unit and count.


Util.TimePeriod

public Util.TimePeriod(org.w3c.dom.Element e)
Construct a time period by parsing its DOM representation.

Method Detail

getElementName

public java.lang.String getElementName()
Description copied from class: AbstractXmlObject
Return the element name.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone the TimePeriod.

Throws:
java.lang.CloneNotSupportedException

copy

public Util.TimePeriod copy()
A more convenient clone.


getUnit

public Util.TimeUnit getUnit()
Get the time unit.


setUnit

public void setUnit(Util.TimeUnit u)
Set the time unit.


getCount

public int getCount()
Get the time unit count.


setCount

public void setCount(int c)
Set the time unit count.


add

public java.util.Date add(java.util.Date start)
Add the time period to a date, and return the relative date.


subtract

public java.util.Date subtract(java.util.Date start)
Subtract the time period from a date, and return the relative date.


subtract

public Util.TimePeriod subtract(Util.TimePeriod p)
Subtract the specified time period from this time period and return a time period jsl - can't we use the Calendar class for much of this?


toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Serialize the time period to an XML buffer.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject