caltool.schedule
Class Time

java.lang.Object
  extended by java.util.Observable
      extended by mvp.Model
          extended by caltool.schedule.Time
All Implemented Interfaces:
java.io.Serializable

public class Time
extends mvp.Model

A Time consists of an hour, minute, and AM or PM indicator. A time value is expressed using a 12-hour or 24-hour clock style. The clock style is set as an option by the user. If the clock style is 24-hour, the AmOrPm indicator is nil.

See Also:
Serialized Form

Field Summary
protected  AmOrPm amOrPm
          Standard suffix used in 12-hour time value
protected  int hour
          The hour component of a time value, between 1 and 12 or 0 and 24 based on the clock style in use
protected  int minute
          The minute component of a time value, between 0 and 59
 
Fields inherited from class mvp.Model
view
 
Constructor Summary
Time()
          Construct an empty time value.
Time(java.lang.String time)
          Construct a time from the given string.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Define equality for this as componentwise equality.
 int hashCode()
          Define the hash code for this as the sum of the components.
 boolean isEmpty()
          Return true if his is an empty time.
 java.lang.String toString()
          Return the string representation of this.
 
Methods inherited from class mvp.Model
dump, exit, getView, setView
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hour

protected int hour
The hour component of a time value, between 1 and 12 or 0 and 24 based on the clock style in use


minute

protected int minute
The minute component of a time value, between 0 and 59


amOrPm

protected AmOrPm amOrPm
Standard suffix used in 12-hour time value

Constructor Detail

Time

public Time()
Construct an empty time value.


Time

public Time(java.lang.String time)
Construct a time from the given string. Set the valid field to false if the given string does not parse to a valid time. Note that the invalid state representation is used instead of throwing an exception because some users may want to delay the processing of invalid dates, and hence may not be interested in handling an exception.

Method Detail

isEmpty

public boolean isEmpty()
Return true if his is an empty time.


toString

public java.lang.String toString()
Return the string representation of this.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Define equality for this as componentwise equality.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Define the hash code for this as the sum of the components. This hash code is used in turn by ItemKey.hashCode.

Overrides:
hashCode in class java.lang.Object