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.lifx.internal.dto;
15 import java.time.Duration;
18 * The pending or current HEV cycle state.
20 * @author Wouter Born - Initial contribution
22 public class HevCycleState {
24 public static final HevCycleState OFF = new HevCycleState(false);
25 public static final HevCycleState ON = new HevCycleState(true);
27 private boolean enable;
28 private Duration duration;
30 public HevCycleState(boolean enable) {
32 this.duration = Duration.ZERO;
35 public HevCycleState(boolean enable, Duration duration) {
37 this.duration = duration;
40 public boolean isEnable() {
44 public Duration getDuration() {
49 public int hashCode() {
52 result = prime * result + ((duration == null) ? 0 : duration.hashCode());
53 result = prime * result + (enable ? 1231 : 1237);
58 public boolean equals(Object obj) {
65 if (getClass() != obj.getClass()) {
68 HevCycleState other = (HevCycleState) obj;
69 if (duration == null) {
70 if (other.duration != null) {
73 } else if (!duration.equals(other.duration)) {
76 return enable == other.enable;
80 public String toString() {
81 return "HevCycleState [enable=" + enable + ", duration=" + duration + "]";