-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarTrafficLightModel.java
More file actions
48 lines (41 loc) · 1.03 KB
/
Copy pathCarTrafficLightModel.java
File metadata and controls
48 lines (41 loc) · 1.03 KB
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
41
42
43
44
45
46
47
48
package bs7trafficlight;
public class CarTrafficLightModel {
/** set to true if the red light should be on */
private boolean redOn = false;
/** set to true if the yellow light should be on */
private boolean yellowOn = false;
/** set to true if the green light should be on */
private boolean greenOn = false;
/**
* Setter of all three lights
* @param red True if the red light should be on
* @param yellow True if the yellow light should be on
* @param green True if the green light should be on
*/
public void setLights(boolean red, boolean yellow, boolean green) {
redOn = red;
yellowOn = yellow;
greenOn = green;
}
/**
* Getter of the red light.
* @return True if the light should be on.
*/
public boolean isRedOn() {
return redOn;
}
/**
* Getter of the yellow light.
* @return True if the light should be on.
*/
public boolean isYellowOn() {
return yellowOn;
}
/**
* Getter of the green light.
* @return True if the light should be on.
*/
public boolean isGreenOn() {
return greenOn;
}
}