]> git.basschouten.com Git - openhab-addons.git/blob
0ca21fdd6a25dfd22738fc43167d624160a74b7b
[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.minecraft.internal.message.data;
14
15 /**
16  * Object representing a tracked Minecraft sign.
17  *
18  * @author Mattias Markehed - Initial contribution
19  */
20 public class SignData {
21
22     private String name;
23     private boolean state;
24
25     /**
26      * Creates a representation of sign.
27      *
28      * @param name text on sign.
29      * @param state true if powered by redstone else false.
30      */
31     public SignData(String name, boolean state) {
32         this.name = name;
33         this.state = state;
34     }
35
36     /**
37      * The text on sign.
38      *
39      * @return text name
40      */
41     public String getName() {
42         return name;
43     }
44
45     /**
46      * The active sign of state.
47      *
48      * @return true if powered by redstone
49      */
50     public boolean getState() {
51         return state;
52     }
53
54     @Override
55     public int hashCode() {
56         final int prime = 31;
57         int result = 1;
58         result = prime * result + ((name == null) ? 0 : name.hashCode());
59         return result;
60     }
61
62     @Override
63     public boolean equals(Object obj) {
64         if (this == obj) {
65             return true;
66         }
67         if (obj == null) {
68             return false;
69         }
70         if (getClass() != obj.getClass()) {
71             return false;
72         }
73         SignData other = (SignData) obj;
74         if (name == null) {
75             if (other.name != null) {
76                 return false;
77             }
78         } else if (!name.equals(other.name)) {
79             return false;
80         }
81         return true;
82     }
83 }