]> git.basschouten.com Git - openhab-addons.git/blob
f78f016c08d048d43322a028d85604e92e1de8b0
[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.lametrictime.internal.api.local.dto;
14
15 /**
16  * Pojo for goal data.
17  *
18  * @author Gregory Moyer - Initial contribution
19  */
20 public class GoalData {
21     private Integer start;
22     private Integer current;
23     private Integer end;
24     private String unit;
25
26     public Integer getStart() {
27         return start;
28     }
29
30     public void setStart(Integer start) {
31         this.start = start;
32     }
33
34     public GoalData withStart(Integer start) {
35         this.start = start;
36         return this;
37     }
38
39     public Integer getCurrent() {
40         return current;
41     }
42
43     public void setCurrent(Integer current) {
44         this.current = current;
45     }
46
47     public GoalData withCurrent(Integer current) {
48         this.current = current;
49         return this;
50     }
51
52     public Integer getEnd() {
53         return end;
54     }
55
56     public void setEnd(Integer end) {
57         this.end = end;
58     }
59
60     public GoalData withEnd(Integer end) {
61         this.end = end;
62         return this;
63     }
64
65     public String getUnit() {
66         return unit;
67     }
68
69     public void setUnit(String unit) {
70         this.unit = unit;
71     }
72
73     public GoalData withUnit(String unit) {
74         this.unit = unit;
75         return this;
76     }
77
78     @Override
79     public int hashCode() {
80         final int prime = 31;
81         int result = 1;
82         result = prime * result + ((current == null) ? 0 : current.hashCode());
83         result = prime * result + ((end == null) ? 0 : end.hashCode());
84         result = prime * result + ((start == null) ? 0 : start.hashCode());
85         result = prime * result + ((unit == null) ? 0 : unit.hashCode());
86         return result;
87     }
88
89     @Override
90     public boolean equals(Object obj) {
91         if (this == obj) {
92             return true;
93         }
94         if (obj == null) {
95             return false;
96         }
97         if (getClass() != obj.getClass()) {
98             return false;
99         }
100         GoalData other = (GoalData) obj;
101         if (current == null) {
102             if (other.current != null) {
103                 return false;
104             }
105         } else if (!current.equals(other.current)) {
106             return false;
107         }
108         if (end == null) {
109             if (other.end != null) {
110                 return false;
111             }
112         } else if (!end.equals(other.end)) {
113             return false;
114         }
115         if (start == null) {
116             if (other.start != null) {
117                 return false;
118             }
119         } else if (!start.equals(other.start)) {
120             return false;
121         }
122         if (unit == null) {
123             if (other.unit != null) {
124                 return false;
125             }
126         } else if (!unit.equals(other.unit)) {
127             return false;
128         }
129         return true;
130     }
131
132     @Override
133     public String toString() {
134         StringBuilder builder = new StringBuilder();
135         builder.append("GoalData [start=");
136         builder.append(start);
137         builder.append(", current=");
138         builder.append(current);
139         builder.append(", end=");
140         builder.append(end);
141         builder.append(", unit=");
142         builder.append(unit);
143         builder.append("]");
144         return builder.toString();
145     }
146 }