public class MCdate
extends java.lang.Object
This class provides the functionality to parse and compose a DICOM value according to the definition of DA value representation.
Instances of this class can be used by multiple threads concurrently.
Constructor and Description |
---|
MCdate(int year,
int month,
int day)
Initializes a new instance of this class with the specified year, month and day.
|
MCdate(java.lang.String dateStr)
Initializes a new instance of this class with a DICOM date string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this date instance to another object.
|
java.lang.String |
getDate()
Retrieves the DICOM date string in the form YYYYMMDD.
|
java.lang.String |
getDay()
Retrieves the day portion of the DICOM date string.
|
java.lang.String |
getMonth()
Retrieves the month portion of the DICOM date string.
|
java.lang.String |
getYear()
Retrieves the year portion of the DICOM date string.
|
java.lang.String |
toString()
Retrieves the date as it would be sent on a DICOM stream.
|
public MCdate(int year, int month, int day)
Using this constructor insures a properly formatted DICOM date string.
year
- The full year of the date.month
- An integer between 1 and 12 representing the month of the date.day
- An integer between 1 and 31 representing the day of the date.MCexception
- If the values provided are illegal.public MCdate(java.lang.String dateStr)
The date string must be in the YYYYMMDD or YYYY.MM.DD format.
If the provided date string is not formated according to the rules for the DA
value representation this method does not throw an exception, however any method of the
constructed object, except toString()
, will throw an exception.
dateStr
- The formatted date string.MCexception
- If the argument is null
.public java.lang.String getDate()
MCexception
- If this date is not representing a properly formated DICOM date.public java.lang.String getDay()
MCexception
- If this date is not representing a properly formated DICOM date.public java.lang.String getMonth()
MCexception
- If this date is not representing a properly formated DICOM date.public java.lang.String getYear()
MCexception
- If this date is not representing a properly formated DICOM date.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare to.MCdate
instance and the string
representation of both objects are equal.