2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.nest.internal.wwn.dto;
15 import java.util.Date;
18 * Used to set and update the WWN ETA values.
20 * @author David Bennett - Initial contribution
21 * @author Wouter Born - Extract ETA object from Structure
22 * @author Wouter Born - Add equals, hashCode, toString methods
26 private String tripId;
27 private Date estimatedArrivalWindowBegin;
28 private Date estimatedArrivalWindowEnd;
30 public String getTripId() {
34 public void setTripId(String tripId) {
38 public Date getEstimatedArrivalWindowBegin() {
39 return estimatedArrivalWindowBegin;
42 public void setEstimatedArrivalWindowBegin(Date estimatedArrivalWindowBegin) {
43 this.estimatedArrivalWindowBegin = estimatedArrivalWindowBegin;
46 public Date getEstimatedArrivalWindowEnd() {
47 return estimatedArrivalWindowEnd;
50 public void setEstimatedArrivalWindowEnd(Date estimatedArrivalWindowEnd) {
51 this.estimatedArrivalWindowEnd = estimatedArrivalWindowEnd;
55 public boolean equals(Object obj) {
62 if (getClass() != obj.getClass()) {
65 WWNETA other = (WWNETA) obj;
66 if (estimatedArrivalWindowBegin == null) {
67 if (other.estimatedArrivalWindowBegin != null) {
70 } else if (!estimatedArrivalWindowBegin.equals(other.estimatedArrivalWindowBegin)) {
73 if (estimatedArrivalWindowEnd == null) {
74 if (other.estimatedArrivalWindowEnd != null) {
77 } else if (!estimatedArrivalWindowEnd.equals(other.estimatedArrivalWindowEnd)) {
81 if (other.tripId != null) {
84 } else if (!tripId.equals(other.tripId)) {
91 public int hashCode() {
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());
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();