]> git.basschouten.com Git - openhab-addons.git/blob
b7e994b2bd6bb2bdbfefabd68ea298dbb7419b8f
[openhab-addons.git] /
1 /*
2  * Copyright 2017 Gregory Moyer
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openhab.binding.sleepiq.api.model;
17
18 import com.google.gson.annotations.SerializedName;
19
20 public class BedSideStatus
21 {
22     @SerializedName("isInBed")
23     private Boolean inBed;
24     private String alertDetailedMessage;
25     private Integer sleepNumber;
26     private Long alertId;
27     private TimeSince lastLink;
28     private Integer pressure; // appears to be in kPa
29
30     public Boolean isInBed()
31     {
32         return inBed;
33     }
34
35     public void setInBed(Boolean inBed)
36     {
37         this.inBed = inBed;
38     }
39
40     public BedSideStatus withInBed(Boolean inBed)
41     {
42         setInBed(inBed);
43         return this;
44     }
45
46     public String getAlertDetailedMessage()
47     {
48         return alertDetailedMessage;
49     }
50
51     public void setAlertDetailedMessage(String alertDetailedMessage)
52     {
53         this.alertDetailedMessage = alertDetailedMessage;
54     }
55
56     public BedSideStatus withAlertDetailedMessage(String alertDetailedMessage)
57     {
58         setAlertDetailedMessage(alertDetailedMessage);
59         return this;
60     }
61
62     public Integer getSleepNumber()
63     {
64         return sleepNumber;
65     }
66
67     public void setSleepNumber(Integer sleepNumber)
68     {
69         this.sleepNumber = sleepNumber;
70     }
71
72     public BedSideStatus withSleepNumber(Integer sleepNumber)
73     {
74         setSleepNumber(sleepNumber);
75         return this;
76     }
77
78     public Long getAlertId()
79     {
80         return alertId;
81     }
82
83     public void setAlertId(Long alertId)
84     {
85         this.alertId = alertId;
86     }
87
88     public BedSideStatus withAlertId(Long alertId)
89     {
90         setAlertId(alertId);
91         return this;
92     }
93
94     public TimeSince getLastLink()
95     {
96         return lastLink;
97     }
98
99     public void setLastLink(TimeSince lastLink)
100     {
101         this.lastLink = lastLink;
102     }
103
104     public BedSideStatus withLastLink(TimeSince lastLink)
105     {
106         setLastLink(lastLink);
107         return this;
108     }
109
110     public Integer getPressure()
111     {
112         return pressure;
113     }
114
115     public void setPressure(Integer pressure)
116     {
117         this.pressure = pressure;
118     }
119
120     public BedSideStatus withPressure(Integer pressure)
121     {
122         setPressure(pressure);
123         return this;
124     }
125
126     @Override
127     public int hashCode()
128     {
129         final int prime = 31;
130         int result = 1;
131         result = prime * result
132                  + ((alertDetailedMessage == null) ? 0 : alertDetailedMessage.hashCode());
133         result = prime * result + ((alertId == null) ? 0 : alertId.hashCode());
134         result = prime * result + ((inBed == null) ? 0 : inBed.hashCode());
135         result = prime * result + ((lastLink == null) ? 0 : lastLink.hashCode());
136         result = prime * result + ((pressure == null) ? 0 : pressure.hashCode());
137         result = prime * result + ((sleepNumber == null) ? 0 : sleepNumber.hashCode());
138         return result;
139     }
140
141     @Override
142     public boolean equals(Object obj)
143     {
144         if (this == obj)
145         {
146             return true;
147         }
148         if (obj == null)
149         {
150             return false;
151         }
152         if (!(obj instanceof BedSideStatus))
153         {
154             return false;
155         }
156         BedSideStatus other = (BedSideStatus)obj;
157         if (alertDetailedMessage == null)
158         {
159             if (other.alertDetailedMessage != null)
160             {
161                 return false;
162             }
163         }
164         else if (!alertDetailedMessage.equals(other.alertDetailedMessage))
165         {
166             return false;
167         }
168         if (alertId == null)
169         {
170             if (other.alertId != null)
171             {
172                 return false;
173             }
174         }
175         else if (!alertId.equals(other.alertId))
176         {
177             return false;
178         }
179         if (inBed == null)
180         {
181             if (other.inBed != null)
182             {
183                 return false;
184             }
185         }
186         else if (!inBed.equals(other.inBed))
187         {
188             return false;
189         }
190         if (lastLink == null)
191         {
192             if (other.lastLink != null)
193             {
194                 return false;
195             }
196         }
197         else if (!lastLink.equals(other.lastLink))
198         {
199             return false;
200         }
201         if (pressure == null)
202         {
203             if (other.pressure != null)
204             {
205                 return false;
206             }
207         }
208         else if (!pressure.equals(other.pressure))
209         {
210             return false;
211         }
212         if (sleepNumber == null)
213         {
214             if (other.sleepNumber != null)
215             {
216                 return false;
217             }
218         }
219         else if (!sleepNumber.equals(other.sleepNumber))
220         {
221             return false;
222         }
223         return true;
224     }
225
226     @Override
227     public String toString()
228     {
229         StringBuilder builder = new StringBuilder();
230         builder.append("BedSideStatus [inBed=");
231         builder.append(inBed);
232         builder.append(", alertDetailedMessage=");
233         builder.append(alertDetailedMessage);
234         builder.append(", sleepNumber=");
235         builder.append(sleepNumber);
236         builder.append(", alertId=");
237         builder.append(alertId);
238         builder.append(", lastLink=");
239         builder.append(lastLink);
240         builder.append(", pressure=");
241         builder.append(pressure);
242         builder.append("]");
243         return builder.toString();
244     }
245 }