1 package edu.uci.iotproject.analysis;
3 import java.time.Instant;
6 * Models a user's action, such as toggling the smart plug on/off at a given time.
8 * @author Janus Varmarken
10 public class UserAction {
13 * The specific type of action the user performed.
15 private final Type mType;
18 * The time the action took place.
20 private final Instant mTimestamp;
22 public UserAction(Type typeOfAction, Instant timeOfAction) {
24 mTimestamp = timeOfAction;
28 * Get the specific type of action performed by the user.
29 * @return the specific type of action performed by the user.
31 public Type getType() {
36 * Get the time at which the user performed this action.
37 * @return the time at which the user performed this action.
39 public Instant getTimestamp() {
44 * Enum for indicating what type of action the user performed.
52 public boolean equals(Object obj) {
56 if (obj instanceof UserAction) {
57 UserAction that = (UserAction) obj;
58 return this.mType == that.mType && this.mTimestamp.equals(that.mTimestamp);
65 public int hashCode() {
68 hashCode = prime * hashCode + mType.hashCode();
69 hashCode = prime * hashCode + mTimestamp.hashCode();
74 public String toString() {
75 return String.format("[ %s @ %s ]", mType.name(), mTimestamp.toString());