]> git.basschouten.com Git - openhab-addons.git/blob
b62b067670cf13864bea1642250192c795f44185
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.nest.internal.wwn.dto;
14
15 import java.util.Date;
16
17 /**
18  * Used to set and update the WWN ETA values.
19  *
20  * @author David Bennett - Initial contribution
21  * @author Wouter Born - Extract ETA object from Structure
22  * @author Wouter Born - Add equals, hashCode, toString methods
23  */
24 public class WWNETA {
25
26     private String tripId;
27     private Date estimatedArrivalWindowBegin;
28     private Date estimatedArrivalWindowEnd;
29
30     public String getTripId() {
31         return tripId;
32     }
33
34     public void setTripId(String tripId) {
35         this.tripId = tripId;
36     }
37
38     public Date getEstimatedArrivalWindowBegin() {
39         return estimatedArrivalWindowBegin;
40     }
41
42     public void setEstimatedArrivalWindowBegin(Date estimatedArrivalWindowBegin) {
43         this.estimatedArrivalWindowBegin = estimatedArrivalWindowBegin;
44     }
45
46     public Date getEstimatedArrivalWindowEnd() {
47         return estimatedArrivalWindowEnd;
48     }
49
50     public void setEstimatedArrivalWindowEnd(Date estimatedArrivalWindowEnd) {
51         this.estimatedArrivalWindowEnd = estimatedArrivalWindowEnd;
52     }
53
54     @Override
55     public boolean equals(Object obj) {
56         if (this == obj) {
57             return true;
58         }
59         if (obj == null) {
60             return false;
61         }
62         if (getClass() != obj.getClass()) {
63             return false;
64         }
65         WWNETA other = (WWNETA) obj;
66         if (estimatedArrivalWindowBegin == null) {
67             if (other.estimatedArrivalWindowBegin != null) {
68                 return false;
69             }
70         } else if (!estimatedArrivalWindowBegin.equals(other.estimatedArrivalWindowBegin)) {
71             return false;
72         }
73         if (estimatedArrivalWindowEnd == null) {
74             if (other.estimatedArrivalWindowEnd != null) {
75                 return false;
76             }
77         } else if (!estimatedArrivalWindowEnd.equals(other.estimatedArrivalWindowEnd)) {
78             return false;
79         }
80         if (tripId == null) {
81             if (other.tripId != null) {
82                 return false;
83             }
84         } else if (!tripId.equals(other.tripId)) {
85             return false;
86         }
87         return true;
88     }
89
90     @Override
91     public int hashCode() {
92         final int prime = 31;
93         int result = 1;
94         result = prime * result + ((estimatedArrivalWindowBegin == null) ? 0 : estimatedArrivalWindowBegin.hashCode());
95         result = prime * result + ((estimatedArrivalWindowEnd == null) ? 0 : estimatedArrivalWindowEnd.hashCode());
96         result = prime * result + ((tripId == null) ? 0 : tripId.hashCode());
97         return result;
98     }
99
100     @Override
101     public String toString() {
102         StringBuilder builder = new StringBuilder();
103         builder.append("ETA [tripId=").append(tripId).append(", estimatedArrivalWindowBegin=")
104                 .append(estimatedArrivalWindowBegin).append(", estimatedArrivalWindowEnd=")
105                 .append(estimatedArrivalWindowEnd).append("]");
106         return builder.toString();
107     }
108 }