reservations
Class Time

java.lang.Object
  |
  +--reservations.Time
All Implemented Interfaces:
java.lang.Comparable

public class Time
extends java.lang.Object
implements java.lang.Comparable

A utility class to encapsulate time of day comparisons.


Constructor Summary
Time(java.util.Date d)
          Constructs a new Time object using the hour, minute, and second values of the specified Date
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this Time object with the specified object.
 boolean equals(java.lang.Object o)
          Compares this time to the specified object.
 int hashCode()
          Returns a hash code for this Time.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Time

public Time(java.util.Date d)
Constructs a new Time object using the hour, minute, and second values of the specified Date

Method Detail

compareTo

public int compareTo(java.lang.Object o)
Compares this Time object with the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Returns:
a negative integer, zero, or a positive integer as this Time is less than, equal to, or greater than the specified Time. Comparison of two Time objects considers only their hour, minute, and second values.
Throws:
java.lang.ClassCastException - if the object being compared to is not an instance of Time (or a subclass.)

hashCode

public int hashCode()
Returns a hash code for this Time. Time objects with identical hour, minute, and second values will have identical values for hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Compares this time to the specified object. Thge result is true if and only if the argument is not null and is a Time object that represents the same hour/minute/second as this object.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object