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.smartmeter.internal.conformity.negate;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * Models the negate bit - namely the OBIS code, whether its in the status bytes and on which position (of the status)
22 * @author Matthias Steigenberger - Initial contribution
26 public class NegateBitModel {
28 private int negatePosition;
29 private boolean negateBit;
30 private String negateObis;
31 private boolean status;
35 * @param negatePosition
38 * @param status Whether to get the negate bit from status value or from actual value.
40 public NegateBitModel(int negatePosition, boolean negateBit, String negateObis, boolean status) {
41 this.negatePosition = negatePosition;
42 this.negateBit = negateBit;
43 this.negateObis = negateObis;
47 public int getNegatePosition() {
48 return negatePosition;
51 public boolean isNegateBit() {
55 public String getNegateChannelId() {
60 public int hashCode() {
63 result = prime * result + (negateBit ? 1231 : 1237);
64 result = prime * result + (negateObis.hashCode());
65 result = prime * result + negatePosition;
69 @SuppressWarnings("PMD.SimplifyBooleanReturns")
71 public boolean equals(@Nullable Object obj) {
78 if (getClass() != obj.getClass()) {
81 NegateBitModel other = (NegateBitModel) obj;
82 if (negateBit != other.negateBit) {
85 if (!negateObis.equals(other.negateObis)) {
88 if (negatePosition != other.negatePosition) {
94 public boolean isStatus() {