uk.ac.ic.doc.automed.wrappers
Class AutoMedTime

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedType
      extended by uk.ac.ic.doc.automed.wrappers.AutoMedTime

public class AutoMedTime
extends AutoMedType

Provides generic representation of time values in GMT.

Author:
Peter McBrien (pjm@doc.ic.ac.uk)

Field Summary
static int DAY
          Granularity of one day
static int HOUR
          Granularity of one hour
static int MINUTE
          Granularity of one minute
static int SECOND
          Granularity of one minute
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedType
BOOLEAN, FLOAT, INTEGER, NULL_STR, STRING, TIME, TUPLE
 
Constructor Summary
AutoMedTime()
          Create a new AutoMedTime that is a null value
AutoMedTime(java.util.Date value, int granularity)
          Create a new AutoMedTime
AutoMedTime(long time, int granularity)
          Create a new AutoMedTime, measured as the number of milliseconds since 1st January 1970, 00:00:00 GMT
 
Method Summary
 java.util.Date dateValue()
           
 double doubleValue()
          Return the number of milliseconds since 1970 as a double
 boolean equals(AutoMedType v)
          Test two AutoMedTypes for equality, performing conversions as appropriate.
 int getType()
          Return the Type (INTEGER, TUPLE, ...) of this AutoMedType
 java.lang.String toString()
          Return a string representation of this AutoMedTime using ISO format.
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedType
isLiteral, isNull, isNumeric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SECOND

public static final int SECOND
Granularity of one minute

See Also:
Constant Field Values

MINUTE

public static final int MINUTE
Granularity of one minute

See Also:
Constant Field Values

HOUR

public static final int HOUR
Granularity of one hour

See Also:
Constant Field Values

DAY

public static final int DAY
Granularity of one day

See Also:
Constant Field Values
Constructor Detail

AutoMedTime

public AutoMedTime(long time,
                   int granularity)
Create a new AutoMedTime, measured as the number of milliseconds since 1st January 1970, 00:00:00 GMT


AutoMedTime

public AutoMedTime(java.util.Date value,
                   int granularity)
Create a new AutoMedTime


AutoMedTime

public AutoMedTime()
Create a new AutoMedTime that is a null value

Method Detail

dateValue

public java.util.Date dateValue()

toString

public java.lang.String toString()
Return a string representation of this AutoMedTime using ISO format. If the granularity is DAY or coarser then the format will be like {d '1970-01-01'} otherwise if will be like {ts '1970-01-10 12:00'}

Specified by:
toString in class AutoMedType

doubleValue

public double doubleValue()
Return the number of milliseconds since 1970 as a double

Specified by:
doubleValue in class AutoMedType

equals

public boolean equals(AutoMedType v)
Description copied from class: AutoMedType
Test two AutoMedTypes for equality, performing conversions as appropriate. Note that, unlike SQL but like Java, two null types will return true when compared.

Specified by:
equals in class AutoMedType

getType

public final int getType()
Description copied from class: AutoMedType
Return the Type (INTEGER, TUPLE, ...) of this AutoMedType

Specified by:
getType in class AutoMedType