|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectmonthlyCalendar.Time
public class Time
This class represents time using hours and minutes (seconds are not represented). The internal representation of the class is up to you. One possible representation is to represent time as the number of minutes from midnight.
| Constructor Summary | |
|---|---|
Time(int hour,
int minutes,
java.lang.String amPm)
Initializes the object using specified parameter values. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a duplicate (deep copy) of the object. |
int |
compareTo(Time time)
Compares two time objects. |
boolean |
equals(java.lang.Object obj)
Compares two time objects. |
int |
hashCode()
Returns a hash code for the object based on the string representation for the object. |
static Time |
increaseByMinutes(Time time,
int minutes)
Returns a new time object corresponding to the time we will have after increasing the time parameter by the specified number of minutes. |
java.lang.String |
toString()
Returns a string using the format "hour:minutes am" or "hour:minutes pm". |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Time(int hour,
int minutes,
java.lang.String amPm)
hour - value between 1 and 12, both inclusiveminutes - value between 0 and 59, both inclusiveamPm - either "am" or "pm"
java.lang.IllegalArgumentException - Thrown for invalid hour, minutes, or amPm value. Validity for hour is
verified first, followed by the minutes' validity and the am/pm
value's validity. The thrown exception must use one of the following
messages: "Invalid hour value", "Invalid minutes value", or
"Invalid am/pm value".| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.Object clone()
clone in class java.lang.Objectpublic int compareTo(Time time)
compareTo in interface java.lang.Comparable<Time>
public static Time increaseByMinutes(Time time,
int minutes)
time - minutes - delta to apply to time parameter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||