-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTime.java
More file actions
40 lines (40 loc) · 928 Bytes
/
Copy pathTime.java
File metadata and controls
40 lines (40 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package lab4;
import java.util.Objects;
public class Time {
private Months month;
private Day timeOfDay;
public Time (Months month) {
this.month = month;
timeOfDay = Day.SOMETIME;
}
public Time (Months month, Day timeOfDay) {
this.month = month;
this.timeOfDay = timeOfDay;
}
public String getMonth() {
return month.getMonth();
}
public String getTime() {
return timeOfDay.getTimeOfDay() + " (месяц: " + month.getMonth() + ")";
}
public String getTimeOfDay() {
return timeOfDay.getTimeOfDay();
}
public int hashCode() {
int r = Objects.hashCode(getTime());
return r;
}
public boolean equals(Object time1) {
if (time1 == this) {
return true;
}
if (time1 == null || getClass() != time1.getClass()) {
return false;
}
Time time2 = (Time) time1;
return getTime() == time2.getTime();
}
public String toString() {
return getTime();
}
}