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.elerotransmitterstick.internal.stick;
15 import java.util.Arrays;
16 import java.util.concurrent.Delayed;
17 import java.util.concurrent.TimeUnit;
20 * @author Volker Bier - Initial contribution
22 public class Command implements Delayed {
23 public static final int TIMED_PRIORITY = 30;
24 public static final int COMMAND_PRIORITY = 20;
25 public static final int FAST_INFO_PRIORITY = 10;
26 public static final int INFO_PRIORITY = 0;
28 private Integer[] channelId;
29 private CommandType commandType;
31 protected int priority = COMMAND_PRIORITY;
33 public Command(final CommandType cmd, final Integer... channels) {
38 protected Command(final CommandType cmd, int priority, final Integer... channels) {
41 this.priority = priority;
45 public String toString() {
46 return "Command " + commandType + " on channels " + Arrays.toString(channelId) + " with priority " + priority;
50 @SuppressWarnings("PMD.CompareObjectsWithEquals")
51 public int compareTo(Delayed delayed) {
52 if (delayed == this) {
56 return Long.compare(0, delayed.getDelay(TimeUnit.MILLISECONDS));
60 public long getDelay(TimeUnit unit) {
64 public int getPriority() {
68 public Integer[] getChannelIds() {
72 public CommandType getCommandType() {