-
Notifications
You must be signed in to change notification settings - Fork 0
/
WaterOn.java
43 lines (38 loc) · 981 Bytes
/
WaterOn.java
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
/**
* Program: WaterOn.java
* Student ID: #3145381
* Description: WaterOn Event, turns water on
* @author Chad Cromwell
* @date December 20 2015
*/
import java.util.concurrent.*;
/**
* <b>WaterOn Class</b> - Creates WaterOn Event.
*/
public class WaterOn extends Event {
/**
* <b>WaterOn Constructor</b>
* Creates WaterOn Event and SystemState Tuple.
*
* @param delayTime The delay time for the event.
*/
public WaterOn(long delayTime) {
super(delayTime); //Call parent constructor (Event(delayTime)) and create a new WaterOn Event
GreenhouseControls.addTuple(new SystemState<String, String>("Water", "On")); //Create and add SystemState Tuple to HashMap
}
/**
* <b>action() Method</b>
* Prints WaterOn Event, which calls toString override below.
*/
public void action() {
System.out.println(this);
}
/**
* <b>toString() Method</b> - Override.
* returns "Greenhouse water is on".
* @return String
*/
public String toString() {
return "Water is on";
}
}