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.io.imperihome.internal.model.param;
15 import org.openhab.core.library.types.DecimalType;
20 * @author Pepijn de Geus - Initial contribution
22 public class NumericValueParam extends DeviceParam {
25 private boolean graphable = true;
27 public NumericValueParam(ParamType type, String unit) {
32 public NumericValueParam(ParamType type, String unit, DecimalType value) {
34 setValue(value == null ? 0 : value.doubleValue());
38 public Number getValue() {
39 return (Number) super.getValue();
42 public void setValue(Number value) {
43 super.setValue(value);
46 public String getUnit() {
50 public void setUnit(String unit) {
54 public boolean isGraphable() {
58 public void setGraphable(boolean graphable) {
59 this.graphable = graphable;
63 public boolean equals(Object o) {
67 if (!(o instanceof NumericValueParam)) {
70 if (!super.equals(o)) {
74 NumericValueParam that = (NumericValueParam) o;
76 if (graphable != that.graphable) {
79 return unit != null ? unit.equals(that.unit) : that.unit == null;
83 public String toString() {
84 return "NumericValueParam{" + "super=" + super.toString() + ", unit='" + unit + '\'' + ", graphable="