com.biocomfort.TO
Class DateTimeTO

java.lang.Object
  extended by com.biocomfort.TO.DateTimeTO
All Implemented Interfaces:
TO, java.io.Serializable, java.lang.Cloneable

public class DateTimeTO
extends java.lang.Object
implements TO, java.io.Serializable, java.lang.Cloneable

The DateTimeTO is a data class to store the date time information of a medical device. It is part of the class MedicalDeviceTO but initially not instantiated. To store the date time information for a medical device create a new instance of this class and assign it to the MedicalDeviceTO object.

This class also include some helper methods to manipulate the date time for the default time zone and local.

See Also:
MedicalDeviceTO.setDateTime(DateTimeTO), MedicalDeviceTO.getDateTime(), Serialized Form

Constructor Summary
DateTimeTO()
          Constructs a DateTimeTO object with initializing it so that it represents the time at which it was allocated, measured to the nearest millisecond.
DateTimeTO(java.util.Date dateTime)
          Constructs a DateTimeTO object with specifying the date and time by the given Date object.
DateTimeTO(int year, int month, int day, int hourOfDay, int minute, int second)
          Constructs a DateTimeTO object with initializing it so that it represents the instant at the start of the second specified by the year, month, day, hourOfDay, minute, and second arguments, for the default time zone and local.
 
Method Summary
 java.lang.Object clone()
          Returns a deep clone of this DateTimeTO object.
 java.util.Date getDateTime()
          Returns a Date object representing the time value of this data object.
 int getDay()
          Returns the day of the month represented by this DateTimeTO object.
 int getHourOfDay()
          Returns the hour of day represented by this DateTimeTO object.
 int getMinute()
          Returns the number of minutes past the hour represented by this date time object, as interpreted in the local time zone.
 int getMonth()
          Returns a number representing the month that contains or begins with the instant in time represented by this DateTimeTO object, as interpreted for the default time zone and local.
 int getSecond()
          Returns the number of seconds past the minute represented by this date time object.
 int getYear()
          Returns a number representing the year that contains or begins with the instant in time represented by this DateTimeTO object, as interpreted for the default time zone and local.
 void setDateTime(java.util.Date dateTime)
          Sets this DateTimeTO's date and time to the given Date.
 void setDateTime(int year, int month, int day, int hourOfDay, int minute, int second)
          Sets the date and time so that it represents the instant at the start of the second specified by the year, month, day, hourOfDay, minute, and second arguments, for the default time zone and local.
 java.lang.String toString()
          Converts this DateTimeTO object to a String of the form: DateTimeTO (dateTime: dow mon dd hh:mm:ss zzz yyyy) See java.util.Date.toString() for more details.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateTimeTO

public DateTimeTO()
Constructs a DateTimeTO object with initializing it so that it represents the time at which it was allocated, measured to the nearest millisecond.


DateTimeTO

public DateTimeTO(java.util.Date dateTime)
Constructs a DateTimeTO object with specifying the date and time by the given Date object.

Parameters:
dateTime - the date time

DateTimeTO

public DateTimeTO(int year,
                  int month,
                  int day,
                  int hourOfDay,
                  int minute,
                  int second)
Constructs a DateTimeTO object with initializing it so that it represents the instant at the start of the second specified by the year, month, day, hourOfDay, minute, and second arguments, for the default time zone and local.

Parameters:
year - the year
month - the month between 1-12
day - the day of month between 1-31
hourOfDay - the hour of a day between 0-23
minute - the minutes between 0-59
second - the seconds between 0-59
Method Detail

getDateTime

public java.util.Date getDateTime()
Returns a Date object representing the time value of this data object.

Returns:
a Date representing the time value

setDateTime

public void setDateTime(java.util.Date dateTime)
Sets this DateTimeTO's date and time to the given Date.

Parameters:
dateTime - the given Date

setDateTime

public void setDateTime(int year,
                        int month,
                        int day,
                        int hourOfDay,
                        int minute,
                        int second)
Sets the date and time so that it represents the instant at the start of the second specified by the year, month, day, hourOfDay, minute, and second arguments, for the default time zone and local.

Parameters:
year - the year
month - the month between 1-12
day - the day of month between 1-31
hourOfDay - the hour of a day between 0-23
minute - the minutes between 0-59
second - the seconds between 0-59

getYear

public int getYear()
Returns a number representing the year that contains or begins with the instant in time represented by this DateTimeTO object, as interpreted for the default time zone and local.

Returns:
the year represented by this date time object

getMonth

public int getMonth()
Returns a number representing the month that contains or begins with the instant in time represented by this DateTimeTO object, as interpreted for the default time zone and local. The value returned is between 1 and 12, with the value 1 representing January.

Returns:
the month represented by this date time object between 1-12

getDay

public int getDay()
Returns the day of the month represented by this DateTimeTO object. The value returned is between 1 and 31 representing the day of the month that contains or begins with the instant in time represented by this date time object, as interpreted in the local time zone.

Returns:
the day of month represented by this date time object between 1-31

getHourOfDay

public int getHourOfDay()
Returns the hour of day represented by this DateTimeTO object. The returned value is a number (0 through 23) representing the hour within the day that contains or begins with the instant in time represented by this DateTimeTO object, as interpreted in the local time zone.

Returns:
the hour of day represented by this date time object between 0-23

getMinute

public int getMinute()
Returns the number of minutes past the hour represented by this date time object, as interpreted in the local time zone. The value returned is between 0 and 59.

Returns:
the minutes represented by this date time object between 0-59

getSecond

public int getSecond()
Returns the number of seconds past the minute represented by this date time object. The value returned is between 0 and 59.

Returns:
the seconds represented by this date time object between 0-59

toString

public java.lang.String toString()
Converts this DateTimeTO object to a String of the form:
 DateTimeTO (dateTime: dow mon dd hh:mm:ss zzz yyyy)
 
See java.util.Date.toString() for more details.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this date time object
See Also:
Date.toString()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a deep clone of this DateTimeTO object.

Overrides:
clone in class java.lang.Object
Returns:
a deep clone of this instance
Throws:
java.lang.CloneNotSupportedException