public class MCtime
extends java.lang.Object
This class provides the functionality to parse and compose a DICOM value according to the definition of TM value representation.
Instances of this class can be used by multiple threads concurrently.
Constructor and Description |
---|
MCtime(int hours)
Initializes a new time object for the specified hours.
|
MCtime(int hours,
int minutes)
Initializes a new time object for the specified number of hours and minutes.
|
MCtime(int hours,
int minutes,
int seconds)
Initializes a new time object for the specified number of hours, minutes and seconds.
|
MCtime(int hours,
int minutes,
int seconds,
double frac)
Initializes a new time object for the specified number of hours, minutes, seconds and fractions of seconds.
|
MCtime(java.lang.String timeStr)
Initializes a new time object based on a DICOM encoded time value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getFraction()
Gets the fraction of seconds portion of this DICOM time value.
|
java.lang.String |
getHours()
Gets the hours portion of this DICOM time value.
|
java.lang.String |
getMinutes()
Gets the minutes portion of this DICOM time value.
|
java.lang.String |
getSeconds()
Gets the seconds portion of this DICOM time value.
|
java.lang.String |
toString()
Gets the encoded representation of this DICOM time value.
|
public MCtime(int hours)
Using this constructor insures a properly formatted DICOM time string.
hours
- The number of hours of the time in the range 0 to 23 where 0 means midnight.MCexception
- If the argument is invalid.public MCtime(int hours, int minutes)
Using this constructor insures a properly formatted DICOM time string.
hours
- The number of hours of the time in the range 0 to 23 where 0 means midnight.minutes
- The number of minutes in the range 0 to 59.MCexception
- If an argument is invalid.public MCtime(int hours, int minutes, int seconds)
Using this constructor insures a properly formatted DICOM time string.
hours
- The number of hours of the time in the range 0 to 23 where 0 means midnight.minutes
- The number of minutes in the range 0 to 59.seconds
- The number of seconds in the range 0 to 59.MCexception
- If an argument is invalid.public MCtime(int hours, int minutes, int seconds, double frac)
Using this constructor insures a properly formatted DICOM time string.
hours
- The number of hours of the time in the range 0 to 23 where 0 means midnight.minutes
- The number of minutes in the range 0 to 59.seconds
- The number of seconds in the range 0 to 59.frac
- The fractional part of a second in the range 0.0 to 0.999999.MCexception
- If an argument is invalid.public MCtime(java.lang.String timeStr)
If the provided time string is not formated according to the rules for the TM value representation
this method does not throw an exception, however any method of the constructed object, except
toString()
, will throw an exception.
timeStr
- The formatted DICOM time value.MCexception
- If the argument is null
.public java.lang.String getFraction()
An empty string is returned if the time string is not at least 8 characters in length (or 10 characters if old hh:mm:ss.ff format is used).
MCexception
- If this time contains an invalid DICOM time.public java.lang.String getHours()
MCexception
- If this time contains an invalid DICOM time.public java.lang.String getMinutes()
MCexception
- If this time contains an invalid DICOM time.public java.lang.String getSeconds()
MCexception
- If this time contains an invalid DICOM time.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object