|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscheduler.db.Time
public class Time
A time object consisting of a minute and an hour.
Nested Class Summary | |
---|---|
class |
Time.InvalidInputException
Invalid input exception thrown in the set methods. |
Field Summary | |
---|---|
protected int |
hour
Integer representing hour |
protected int |
minute
Integer representing minute |
Constructor Summary | |
---|---|
Time(int hour,
int minute)
A constructor for the Time object |
Method Summary | |
---|---|
void |
addHalf()
Adds a half-hour to a given time. |
int |
compareTo(Time t)
For comparing times |
boolean |
equals(java.lang.Object t)
Tests if the time is equal |
int |
getHour()
Returns the hour |
int |
getMinute()
Gets the minutes in a specific time |
int |
hashCode()
Needed for hashes of times. |
static boolean |
isWithin(Time start1,
Time end1,
Time start2,
Time end2)
Checks if a time interval is fits into another. |
boolean |
setHour(int hour)
Sets the hour field |
boolean |
setMinute(int minute)
Sets the minutes field |
java.lang.String |
standardString()
|
java.lang.String |
toString()
return the time in this format "HH:MM" |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int hour
protected int minute
Constructor Detail |
---|
public Time(int hour, int minute)
Method Detail |
---|
public int getHour()
public int getMinute()
pre: post: // // The minute field is an integer greater than 0 // and less than 60 // (minute >= 0 && minute < 60)
public boolean setMinute(int minute)
pre: // // The minute field is an integer greater than 0 // and less than 60 // (minute >= 0 && minute < 60) post: // // The minute field is equal to the parameter // (this.minute == minute)
minute
- The minute integer to set.
public boolean setHour(int hour)
pre: // // The minute field is an integer greater than 0 // and less than 60 // (hour >= 0 && hour < 24) post: // // The hour field is equal to the parameter // (this.hour == hour)
hour
- The hour integer to set.
public boolean equals(java.lang.Object t)
equals
in class java.lang.Object
t
- A time object to compare to.public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(Time t)
compareTo
in interface java.lang.Comparable<Time>
t
- The compare to compare to thispublic static boolean isWithin(Time start1, Time end1, Time start2, Time end2)
start1
- start of the would be sub-intervalend1
- end of the would be sub-intervalstart2
- start of the intervalend2
- end of the interval
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String standardString()
public void addHalf()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |