return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
*/
public void postAction() throws InterruptedException, TimeoutException, ExecutionException {
BridgeHandler bridgeHandler = getBridgeHandler();
- if (bridgeHandler == null)
+ if (bridgeHandler == null) {
return;
+ }
bridgeHandler.postAction(endpoint);
}
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(Object obj) {
if (this == obj) {
}
break;
case CHANNEL_COLOR:
- if (on != null && on == false) {
+ if (on != null && !on) {
updateState(channelId, OnOffType.OFF);
} else if (bri != null && "xy".equals(newState.colormode)) {
final double @Nullable [] xy = newState.xy;
}
private static boolean toBoolean(char value) {
- if (value == 'O') {
- return false;
- } else {
- return true;
- }
+ return value != 'O';
}
private static DigiplexResponse resolveSystemEvent(String message) {
// TODO: According to documentation: areaNo = 255 - Occurs in at least one area enabled in the system.
// I did never encounter 255 on my system though (EVO192).
// 15 is returned instead, which (I believe) has the same meaning.
- if (this.areaNo == 15 || this.areaNo == 255) {
- return true;
- }
- return false;
+ return (this.areaNo == 15 || this.areaNo == 255);
}
}
private boolean isDefaultName(ZoneLabelResponse response) {
return ZONE_DEFAULT_NAMES.stream().anyMatch(format -> {
- if (String.format(format, response.zoneNo).equals(response.zoneName)) {
- return true;
- } else {
- return false;
- }
+ return String.format(format, response.zoneNo).equals(response.zoneName);
});
}
*
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(Object obj) {
if (this == obj) {
*
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(Object obj) {
if (this == obj) {
* @return true or false
*/
public static boolean inRange(int value, int min, int max) {
- if (value < min) {
- return false;
- }
- if (value > max) {
- return false;
- }
- return true;
+ return value >= min && value <= max;
}
/**
String[] channelTypes = { PANEL_SERVICE_REQUIRED, PANEL_AC_TROUBLE, PANEL_TELEPHONE_TROUBLE, PANEL_FTC_TROUBLE,
PANEL_ZONE_FAULT, PANEL_ZONE_TAMPER, PANEL_ZONE_LOW_BATTERY, PANEL_TIME_LOSS };
- String channel;
ChannelUID channelUID = null;
int bitCount = 8;
int state = (db1 >> 4) & 0x03;
- if (state != 0) {
- // TODO: display error state on thing
- return true;
- } else {
- return false;
- }
+ // TODO: display error state on thing
+ return state != 0;
}
protected State getPositionData() {
new byte[] { SAMessageType.SA_WR_LEARNMODE.getValue(), (byte) (activate ? 1 : 0), 0, 0, 0, 0, 0 });
}
- public final static BasePacket SA_RD_LEARNEDCLIENTS = new SAMessage(SAMessageType.SA_RD_LEARNEDCLIENTS);
+ public static final BasePacket SA_RD_LEARNEDCLIENTS = new SAMessage(SAMessageType.SA_RD_LEARNEDCLIENTS);
public static BasePacket SA_RD_MAILBOX_STATUS(byte[] clientId, byte[] controllerId) {
return new SAMessage(SAMessageType.SA_RD_MAILBOX_STATUS,
.collect(groupingBy(call -> call.quay.id));
List<DisplayData> processedData = new ArrayList<>();
- if (departures.keySet().size() > 0) {
+ if (!departures.keySet().isEmpty()) {
DisplayData processedData01 = getDisplayData(stopPlace, departures, 0);
processedData.add(processedData01);
}
}
public MeasureType getMeasureType(@Nullable ParserCustomizationType customizationType) {
- if (customizationType == null)
+ if (customizationType == null) {
return measureType;
+ }
return Optional.ofNullable(customizations).map(m -> m.get(customizationType))
.map(ParserCustomization::getMeasureType).orElse(measureType);
}
* @return the response body
* @throws FroniusCommunicationException when the request execution failed or interrupted
*/
- public synchronized static String executeUrl(String url, int timeout) throws FroniusCommunicationException {
+ public static synchronized String executeUrl(String url, int timeout) throws FroniusCommunicationException {
int attemptCount = 1;
try {
while (true) {
BigDecimal port = (BigDecimal) config.get(FSInternetRadioBindingConstants.CONFIG_PROPERTY_PORT.toString());
String pin = (String) config.get(FSInternetRadioBindingConstants.CONFIG_PROPERTY_PIN.toString());
- if (ip == null || port.compareTo(BigDecimal.ZERO) == 0 || pin == null || pin.isEmpty()) {
- return false;
- }
- return true;
+ return !(ip == null || port.compareTo(BigDecimal.ZERO) == 0 || pin == null || pin.isEmpty());
}
@SuppressWarnings("null")
public class Device {
private final Logger logger = LoggerFactory.getLogger(Device.class);
- private transient static final String DEVICE_TYPE_PREFIX = "gardena smart";
+ private static final transient String DEVICE_TYPE_PREFIX = "gardena smart";
public boolean active = true;
public String id;
public String deviceType;
private Logger logger = LoggerFactory.getLogger(CommandProcessor.class);
private boolean terminate = false;
- private final String TERMINATE_COMMAND = "terminate";
+ private static final String TERMINATE_COMMAND = "terminate";
- private final int SEND_QUEUE_MAX_DEPTH = 10;
- private final int SEND_QUEUE_TIMEOUT = 2000;
+ private static final int SEND_QUEUE_MAX_DEPTH = 10;
+ private static final int SEND_QUEUE_TIMEOUT = 2000;
private ConnectionManager connectionManager;
private boolean deviceIsConnected;
- private final String COMMAND_NAME = "command";
- private final String SERIAL1_NAME = "serial-1";
- private final String SERIAL2_NAME = "serial-2";
+ private static final String COMMAND_NAME = "command";
+ private static final String SERIAL1_NAME = "serial-1";
+ private static final String SERIAL2_NAME = "serial-2";
- private final int COMMAND_PORT = 4998;
- private final int SERIAL1_PORT = 4999;
- private final int SERIAL2_PORT = 5000;
+ private static final int COMMAND_PORT = 4998;
+ private static final int SERIAL1_PORT = 4999;
+ private static final int SERIAL2_PORT = 5000;
- private final int SOCKET_CONNECT_TIMEOUT = 1500;
+ private static final int SOCKET_CONNECT_TIMEOUT = 1500;
private ScheduledFuture<?> connectionMonitorJob;
- private final int CONNECTION_MONITOR_FREQUENCY = 60;
- private final int CONNECTION_MONITOR_START_DELAY = 15;
+ private static final int CONNECTION_MONITOR_FREQUENCY = 60;
+ private static final int CONNECTION_MONITOR_START_DELAY = 15;
private Runnable connectionMonitorRunnable = () -> {
logger.trace("Performing connection check for thing {} at IP {}", thingID(), commandConnection.getIP());
}
private boolean deviceSupportsSerialPort2() {
- if (thing.getThingTypeUID().equals(THING_TYPE_GC_100_12)) {
- return true;
- }
- return false;
+ return thing.getThingTypeUID().equals(THING_TYPE_GC_100_12);
}
/*
super(thing, httpClient);
}
+ @SuppressWarnings("PMD.SimplifyBooleanExpressions")
@Override
protected State getValue(String channelId, GoEStatusResponseBaseDTO goeResponseBase) {
var state = super.getValue(channelId, goeResponseBase);
} else if (pullupdownStr.equals(GPIOBindingConstants.PUD_UP)) {
pullupdown = JPigpio.PI_PUD_UP;
} else {
- if (!pullupdownStr.equals(GPIOBindingConstants.PUD_OFF))
+ if (!pullupdownStr.equals(GPIOBindingConstants.PUD_OFF)) {
throw new InvalidPullUpDownException();
+ }
}
gpio = new GPIO(jPigpio, gpioId, JPigpio.PI_INPUT);
jPigpio.gpioSetAlertFunc(gpio.getPin(), (gpio, level, tick) -> {
@NonNullByDefault
public class GreeException extends Exception {
private static final long serialVersionUID = -2337258558995287405L;
- private static String EX_NONE = "none";
+ private static final String EX_NONE = "none";
public GreeException(@Nullable Exception exception) {
super(exception);
@NonNullByDefault
public class GreeAirDevice {
private final Logger logger = LoggerFactory.getLogger(GreeAirDevice.class);
- private final static Gson gson = new Gson();
+ private static final Gson gson = new Gson();
private boolean isBound = false;
private final InetAddress ipAddress;
private int port = 0;
}
public void getDeviceStatus(DatagramSocket clientSocket) throws GreeException {
-
if (!isBound) {
throw new GreeException("Device not bound");
}
@NonNullByDefault
public class HeosActions implements ThingActions {
- private final static Logger logger = LoggerFactory.getLogger(HeosActions.class);
+ private static final Logger logger = LoggerFactory.getLogger(HeosActions.class);
private @Nullable HeosBridgeHandler handler;
@Override
public void handleGroupCommand(Command command, @Nullable String id, ThingUID uid,
HeosGroupHandler heosGroupHandler) throws IOException, ReadException {
-
if (command instanceof RefreshType) {
return;
}
}
switch (command) {
-
case PLAYER_STATE_CHANGED:
playerStateChanged(eventObject);
break;
* Disposes the client.
*/
public void dispose() {
- if (future != null)
+ if (future != null) {
future.cancel(true);
+ }
}
/**
ParameterOption defaultOption = options.get(offset);
logger.trace("Changing default option to {} (offset {})", defaultOption, offset);
builder.withDefault(defaultOption.getValue());
- } else if (options.size() > 0) {
+ } else if (!options.isEmpty()) {
ParameterOption defaultOption = options.get(0);
logger.trace("Changing default option to {} (first value)", defaultOption);
builder.withDefault(defaultOption.getValue());
return s;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
protected final Integer MIN_TIME = 0;
protected final Integer MAX_TIME = 1430;
- protected final static String TYPE_MONDAY = "Mo";
- protected final static String TYPE_TUESDAY = "Tu";
- protected final static String TYPE_WEDNESDAY = "We";
- protected final static String TYPE_THURSDAY = "Th";
- protected final static String TYPE_FRIDAY = "Fr";
- protected final static String TYPE_SATURDAY = "Sa";
- protected final static String TYPE_SUNDAY = "Su";
+ protected static final String TYPE_MONDAY = "Mo";
+ protected static final String TYPE_TUESDAY = "Tu";
+ protected static final String TYPE_WEDNESDAY = "We";
+ protected static final String TYPE_THURSDAY = "Th";
+ protected static final String TYPE_FRIDAY = "Fr";
+ protected static final String TYPE_SATURDAY = "Sa";
+ protected static final String TYPE_SUNDAY = "Su";
private String activeDay = TYPE_MONDAY;
private Integer activeCycle = 1;
* @param is2013 the target module's-generation
* @return true if a poll is required to get the new status-value
*/
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
public boolean shouldPollStatusAfterCommand(int firmwareVersion) {
// Regulator set-points will send status-messages on every change (all firmware versions)
if (type == Type.REGULATOR) {
* @return if hexRepresentation == null return -1, otherwise return percentage
*/
public static int getPercentage(@Nullable String hexRepresentation) {
- if (hexRepresentation == null)
+ if (hexRepresentation == null) {
return -1;
+ }
int decimal = Integer.parseInt(hexRepresentation, 16);
BigDecimal level = new BigDecimal(100 * decimal).divide(new BigDecimal(255), RoundingMode.FLOOR);
return level.intValue();
int code = visiblity.getCode();
- if (visibilityValues.length < code || visibilityValues[code] == 1) {
- return true;
- }
-
- return false;
+ return (visibilityValues.length < code || visibilityValues[code] == 1);
}
public static HeatpumpChannel fromString(String heatpumpCommand) throws InvalidChannelException {
@NonNullByDefault
public class MagentaTVControl {
private final Logger logger = LoggerFactory.getLogger(MagentaTVControl.class);
- private final static HashMap<String, String> KEY_MAP = new HashMap<>();
+ private static final HashMap<String, String> KEY_MAP = new HashMap<>();
private final MagentaTVNetwork network;
private final MagentaTVHttp http = new MagentaTVHttp();
@NonNullByDefault
public class TimeStabilizer {
- private final static int SLIDING_SECONDS = 300;
- private final static int MAX_FLUCTUATION_SECONDS = 180;
+ private static final int SLIDING_SECONDS = 300;
+ private static final int MAX_FLUCTUATION_SECONDS = 180;
private final Deque<Item> cache = new ConcurrentLinkedDeque<Item>();
return previousState.map(this::hasFinishedChangedFromPreviousState).orElse(true);
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
private boolean hasFinishedChangedFromPreviousState(DeviceState previous) {
if (previous.getStateType().equals(nextState.getStateType())) {
return false;
private boolean allowModelUpdate() {
final long timeSinceLastUpdate = System.currentTimeMillis() - model.getLastUpdated();
- if (timeSinceLastUpdate > MIN_TIME_BETWEEEN_MODEL_UPDATES_MS) {
- return true;
- }
- return false;
+ return timeSinceLastUpdate > MIN_TIME_BETWEEEN_MODEL_UPDATES_MS;
}
public MillheatModel getModel() {
*/
package org.openhab.binding.modbus.sunspec.internal.parser;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.modbus.sunspec.internal.SunSpecConstants;
}
// parse manufacturer, model and version
- block.manufacturer = ModbusBitUtilities.extractStringFromRegisters(raw, 2, 32, Charset.forName("UTF-8"));
- block.model = ModbusBitUtilities.extractStringFromRegisters(raw, 18, 32, Charset.forName("UTF-8"));
- block.version = ModbusBitUtilities.extractStringFromRegisters(raw, 42, 16, Charset.forName("UTF-8"));
- block.serialNumber = ModbusBitUtilities.extractStringFromRegisters(raw, 50, 32, Charset.forName("UTF-8"));
+ block.manufacturer = ModbusBitUtilities.extractStringFromRegisters(raw, 2, 32, StandardCharsets.UTF_8);
+ block.model = ModbusBitUtilities.extractStringFromRegisters(raw, 18, 32, StandardCharsets.UTF_8);
+ block.version = ModbusBitUtilities.extractStringFromRegisters(raw, 42, 16, StandardCharsets.UTF_8);
+ block.serialNumber = ModbusBitUtilities.extractStringFromRegisters(raw, 50, 32, StandardCharsets.UTF_8);
block.deviceAddress = extractUInt16(raw, 66, 1);
break;
case CHANNEL_COLOR_TEMPERATURE_ABS:
// Color temperature (absolute)
- int colorTempKelvin;
-
IntegerState state = new Ct();
if (command instanceof DecimalType) {
state.setValue(((DecimalType) command).intValue());
goEquals = go.equals(otherGo);
}
- if (goEquals == false) {
+ if (!goEquals) {
// No reason to compare layout if global oriantation is different
return false;
}
processNext(currentTimeMillis);
}
- abstract protected void reset(long currentTimeMillis);
+ protected abstract void reset(long currentTimeMillis);
- abstract protected void processNext(long currentTimeMillis);
+ protected abstract void processNext(long currentTimeMillis);
}
public static class TriggerButtonConfig {
final int up;
final int down;
- final static DirectionConfiguration NORMAL = new DirectionConfiguration(1, 2);
- final static DirectionConfiguration REVERSED = new DirectionConfiguration(2, 1);
+ static final DirectionConfiguration NORMAL = new DirectionConfiguration(1, 2);
+ static final DirectionConfiguration REVERSED = new DirectionConfiguration(2, 1);
private DirectionConfiguration(int up, int down) {
this.up = up;
public static final String CHANNEL_NET_MENU8 = "netmenu#item8";
public static final String CHANNEL_NET_MENU9 = "netmenu#item9";
- public final static String CHANNEL_AUDIO_IN_INFO = "info#audioIn";
- public final static String CHANNEL_AUDIO_OUT_INFO = "info#audioOut";
- public final static String CHANNEL_VIDEO_IN_INFO = "info#videoIn";
- public final static String CHANNEL_VIDEO_OUT_INFO = "info#videoOut";
+ public static final String CHANNEL_AUDIO_IN_INFO = "info#audioIn";
+ public static final String CHANNEL_AUDIO_OUT_INFO = "info#audioOut";
+ public static final String CHANNEL_VIDEO_IN_INFO = "info#videoIn";
+ public static final String CHANNEL_VIDEO_OUT_INFO = "info#videoOut";
// Used for Discovery service
public static final String MANUFACTURER = "ONKYO";
DISARM(6),
BEEP(8);
- private final static Logger logger = LoggerFactory.getLogger(PartitionCommand.class);
+ private static final Logger logger = LoggerFactory.getLogger(PartitionCommand.class);
private int command;
public class ParadoxUtil {
private static final String SPACE_DELIMITER = " ";
- private final static Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
public static byte calculateChecksum(byte[] payload) {
int result = 0;
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "TRACE");
}
- private final static Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(ParadoxUtil.class);
private static final byte[] EXPECTED1 = { (byte) 0xAA, 0x0A, 0x00, 0x03, 0x08, (byte) 0xF0, 0x00, 0x00, 0x01,
(byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, 0x01, 0x02, 0x03,
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
}
/* check if the given value is a special one like 888.8 or 999.9 for shortcut or open load on a sensor wire */
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
private boolean isSpecialValue(Double dd) {
if ((Math.abs(dd - 888.8) < 0.1) || (Math.abs(dd - (-888.8)) < 0.1)) {
/* value out of range */
*/
@NonNullByDefault
public class RFXComTestHelper {
- static final public ThingUID bridgeUID = new ThingUID("rfxcom", "tcpbridge", "rfxtrx0");
- static final public ThingUID thingUID = new ThingUID("rfxcom", bridgeUID, "mocked");
- static final public ThingTypeUID thingTypeUID = new ThingTypeUID("rfxcom", "raw");
+ public static final ThingUID bridgeUID = new ThingUID("rfxcom", "tcpbridge", "rfxtrx0");
+ public static final ThingUID thingUID = new ThingUID("rfxcom", bridgeUID, "mocked");
+ public static final ThingTypeUID thingTypeUID = new ThingTypeUID("rfxcom", "raw");
- static final public ChannelUID commandChannelUID = new ChannelUID(thingUID, RFXComBindingConstants.CHANNEL_COMMAND);
+ public static final ChannelUID commandChannelUID = new ChannelUID(thingUID, RFXComBindingConstants.CHANNEL_COMMAND);
- static public void basicBoundaryCheck(PacketType packetType, RFXComMessage message) throws RFXComException {
+ public static void basicBoundaryCheck(PacketType packetType, RFXComMessage message) throws RFXComException {
// This is a place where its easy to make mistakes in coding, and can result in errors, normally
// array bounds errors
byte[] binaryMessage = message.decodeMessage();
assertEquals(packetType.toByte(), binaryMessage[1], "Wrong packet type");
}
- static public int getActualIntValue(RFXComDeviceMessage msg, RFXComDeviceConfiguration config, String channelId)
+ public static int getActualIntValue(RFXComDeviceMessage msg, RFXComDeviceConfiguration config, String channelId)
throws RFXComException {
return ((DecimalType) msg.convertToState(channelId, config, new MockDeviceState())).intValue();
}
*/
@NonNullByDefault
public class RFXComLighting4MessageTest {
- static public final ChannelUID contactChannelUID = new ChannelUID(thingUID, CHANNEL_CONTACT);
+ public static final ChannelUID contactChannelUID = new ChannelUID(thingUID, CHANNEL_CONTACT);
- static public void checkDiscoveryResult(RFXComDeviceMessage<RFXComLighting4Message.SubType> msg, String deviceId,
+ public static void checkDiscoveryResult(RFXComDeviceMessage<RFXComLighting4Message.SubType> msg, String deviceId,
@Nullable Integer pulse, String subType) throws RFXComException {
String thingUID = "homeduino:rfxcom:fssfsd:thing";
DiscoveryResultBuilder builder = DiscoveryResultBuilder.create(new ThingUID(thingUID));
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(Object obj) {
if (this == obj) {
boolean isOnline = false;
for (Device<?, ?, ?> device : upnpService.getRegistry().getDevices()) {
- if (createService((RemoteDevice) device) == true) {
+ if (createService((RemoteDevice) device)) {
isOnline = true;
}
}
- if (isOnline == true) {
+ if (isOnline) {
logger.debug("Device was online");
putOnline();
} else {
return String.format("Message: command = %02X, payload = %s", this.command, getPayloadAsHex());
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
public static final String CHANNEL_ESENSOR_TEMP5 = CHANNEL_SENSOR_TEMP + "5";
public static final String CHANNEL_ESENSOR_HUMIDITY = CHANNEL_SENSOR_HUM;
public static final String CHANNEL_ESENSOR_VOLTAGE = CHANNEL_SENSOR_VOLTAGE;
- public static final String CHANNEL_ESENSOR_DIGITALINPUT = "digitalInput";;
- public static final String CHANNEL_ESENSOR_ANALOGINPUT = "analogInput";;
+ public static final String CHANNEL_ESENSOR_DIGITALINPUT = "digitalInput";
+ public static final String CHANNEL_ESENSOR_ANALOGINPUT = "analogInput";
public static final String CHANNEL_ESENSOR_INPUT = "input";
public static final String CHANNEL_ESENSOR_INPUT1 = CHANNEL_ESENSOR_INPUT + "1";
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
boolean hasitems = "1".equals(entry.value);
if (f != null) {
// Except for some favorites (e.g. Spotify) use hasitems:1 and type:playlist
- if (hasitems && isTypePlaylist == false) {
+ if (hasitems && !isTypePlaylist) {
// Skip subfolders
favorites.remove(f);
f = null;
"schema-state-ro");
// Channel specific configuration items
- public final static String CHANNEL_CONFIG_OUTPUT = "output";
+ public static final String CHANNEL_CONFIG_OUTPUT = "output";
}
* @param portNumber - the portNumber in Range 1-32
* @return
*/
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean hasPortnumber(int portNumber) {
if (podNumber == 0 && portNumber <= 16) {
*/
public void updateData(LittleStation station) {
logger.debug("Update Tankerkoenig data '{}'", getThing().getUID());
- if (station.isOpen() == true) {
+ if (station.isOpen()) {
logger.debug("Checked Station is open! '{}'", getThing().getUID());
updateState(CHANNEL_STATION_OPEN, OpenClosedType.OPEN);
if (station.getDiesel() != null) {
@NonNullByDefault
public class TouchWandUnitFromJson {
- private final static Logger logger = LoggerFactory.getLogger(TouchWandUnitFromJson.class);
+ private static final Logger logger = LoggerFactory.getLogger(TouchWandUnitFromJson.class);
public TouchWandUnitFromJson() {
}
private boolean isTriggerChannel(byte address, byte channel) {
VelbusChannelIdentifier velbusChannelIdentifier = new VelbusChannelIdentifier(address, channel);
- if (getModuleAddress().getChannelNumber(velbusChannelIdentifier) == 6) {
- return true;
- } else {
- return false;
- }
+ return getModuleAddress().getChannelNumber(velbusChannelIdentifier) == 6;
}
@Override
}
private boolean messageIsEmpty(DeviceInfoMessage message) {
- if (message.getCurrentActions() == null && message.getInfo() == null && message.getMeasurements() == null) {
- return true;
- }
- return false;
+ return (message.getCurrentActions() == null && message.getInfo() == null
+ && message.getMeasurements() == null);
}
/**
return super.hashCode();
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return super.hashCode();
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return super.hashCode();
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return super.hashCode();
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return super.hashCode();
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
}
public static String createBinaryStateContent(boolean binaryState) {
- String binary = binaryState == true ? "1" : "0";
+ String binary = binaryState ? "1" : "0";
String content = "<?xml version=\"1.0\"?>"
+ "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
+ "<s:Body>" + "<u:SetBinaryState xmlns:u=\"urn:Belkin:service:basicevent:1\">" + "<BinaryState>"
defaultImageRefreshInterval = config.defaultImageRefreshInterval;
backgroundDiscoveryEnabled = config.discoveryEnabled;
- logger.debug("Bridge: Background discovery is {}", backgroundDiscoveryEnabled == true ? "ENABLED" : "DISABLED");
+ logger.debug("Bridge: Background discovery is {}", backgroundDiscoveryEnabled ? "ENABLED" : "DISABLED");
host = config.host;
useSSL = config.useSSL.booleanValue();
@NonNullByDefault
public class HomekitChangeListener implements ItemRegistryChangeListener {
private final Logger logger = LoggerFactory.getLogger(HomekitChangeListener.class);
- private final static String REVISION_CONFIG = "revision";
- private final static String ACCESSORY_COUNT = "accessory_count";
- private final static String KNOWN_ACCESSORIES = "known_accessories";
+ private static final String REVISION_CONFIG = "revision";
+ private static final String ACCESSORY_COUNT = "accessory_count";
+ private static final String KNOWN_ACCESSORIES = "known_accessories";
private final ItemRegistry itemRegistry;
private final HomekitAccessoryRegistry accessoryRegistry = new HomekitAccessoryRegistry();
private final MetadataRegistry metadataRegistry;
try {
boolean changed = false;
- boolean removed = false;
for (final String name : pendingUpdates) {
String oldValue = knownAccessories.get(name);
accessoryRegistry.remove(name);
return result;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
@Override
public boolean equals(Object obj) {
if (this == obj) {
private final Logger logger = LoggerFactory.getLogger(HomekitTaggedItem.class);
/** configuration keywords at items level **/
- public final static String DELAY = "commandDelay";
- public final static String DIMMER_MODE = "dimmerMode";
+ public static final String DELAY = "commandDelay";
+ public static final String DIMMER_MODE = "dimmerMode";
public static final String BATTERY_LOW_THRESHOLD = "lowThreshold";
- public final static String INSTANCE = "instance";
- public final static String INVERTED = "inverted";
- public final static String MAX_VALUE = "maxValue";
- public final static String MIN_VALUE = "minValue";
- public final static String PRIMARY_SERVICE = "primary";
- public final static String STEP = "step";
- public final static String UNIT = "unit";
- public final static String EMULATE_STOP_STATE = "stop";
- public final static String EMULATE_STOP_SAME_DIRECTION = "stopSameDirection";
+ public static final String INSTANCE = "instance";
+ public static final String INVERTED = "inverted";
+ public static final String MAX_VALUE = "maxValue";
+ public static final String MIN_VALUE = "minValue";
+ public static final String PRIMARY_SERVICE = "primary";
+ public static final String STEP = "step";
+ public static final String UNIT = "unit";
+ public static final String EMULATE_STOP_STATE = "stop";
+ public static final String EMULATE_STOP_SAME_DIRECTION = "stopSameDirection";
private static final Map<Integer, String> CREATED_ACCESSORY_IDS = new ConcurrentHashMap<>();
@NonNullByDefault
public class HomekitAccessoryFactory {
private static final Logger logger = LoggerFactory.getLogger(HomekitAccessoryFactory.class);
- public final static String METADATA_KEY = "homekit"; // prefix for HomeKit meta information in items.xml
+ public static final String METADATA_KEY = "homekit"; // prefix for HomeKit meta information in items.xml
/** List of mandatory attributes for each accessory type. **/
- private final static Map<HomekitAccessoryType, HomekitCharacteristicType[]> MANDATORY_CHARACTERISTICS = new HashMap<HomekitAccessoryType, HomekitCharacteristicType[]>() {
+ private static final Map<HomekitAccessoryType, HomekitCharacteristicType[]> MANDATORY_CHARACTERISTICS = new HashMap<HomekitAccessoryType, HomekitCharacteristicType[]>() {
{
put(ACCESSORY_GROUP, new HomekitCharacteristicType[] {});
put(LEAK_SENSOR, new HomekitCharacteristicType[] { LEAK_DETECTED_STATE });
};
/** List of service implementation for each accessory type. **/
- private final static Map<HomekitAccessoryType, Class<? extends AbstractHomekitAccessoryImpl>> SERVICE_IMPL_MAP = new HashMap<HomekitAccessoryType, Class<? extends AbstractHomekitAccessoryImpl>>() {
+ private static final Map<HomekitAccessoryType, Class<? extends AbstractHomekitAccessoryImpl>> SERVICE_IMPL_MAP = new HashMap<HomekitAccessoryType, Class<? extends AbstractHomekitAccessoryImpl>>() {
{
put(ACCESSORY_GROUP, HomekitAccessoryGroupImpl.class);
put(LEAK_SENSOR, HomekitLeakSensorImpl.class);
MetadataRegistry metadataRegistry, HomekitAccessoryUpdater updater, HomekitSettings settings,
Set<HomekitTaggedItem> ancestorServices) throws HomekitException {
final var item = taggedItem.getItem();
- if (!(item instanceof GroupItem))
+ if (!(item instanceof GroupItem)) {
return;
+ }
for (var groupMember : ((GroupItem) item).getMembers().stream()
.sorted((lhs, rhs) -> lhs.getName().compareTo(rhs.getName())).collect(Collectors.toList())) {
.collect(Collectors.toList());
logger.trace("accessory types for {} are {}", groupMember.getName(), accessoryTypes);
- if (accessoryTypes.isEmpty())
+ if (accessoryTypes.isEmpty()) {
continue;
+ }
if (accessoryTypes.size() > 1) {
logger.warn("Item {} is a HomeKit sub-accessory, but multiple accessory types are not allowed.",
private static final Logger logger = LoggerFactory.getLogger(HomekitCharacteristicFactory.class);
// List of optional characteristics and corresponding method to create them.
- private final static Map<HomekitCharacteristicType, BiFunction<HomekitTaggedItem, HomekitAccessoryUpdater, Characteristic>> optional = new HashMap<HomekitCharacteristicType, BiFunction<HomekitTaggedItem, HomekitAccessoryUpdater, Characteristic>>() {
+ private static final Map<HomekitCharacteristicType, BiFunction<HomekitTaggedItem, HomekitAccessoryUpdater, Characteristic>> optional = new HashMap<HomekitCharacteristicType, BiFunction<HomekitTaggedItem, HomekitAccessoryUpdater, Characteristic>>() {
{
put(NAME, HomekitCharacteristicFactory::createNameCharacteristic);
put(BATTERY_LOW_STATUS, HomekitCharacteristicFactory::createStatusLowBatteryCharacteristic);
* @author Andy Lintner - Initial contribution
*/
public class HomekitHumiditySensorImpl extends AbstractHomekitAccessoryImpl implements HumiditySensorAccessory {
- private final static String CONFIG_MULTIPLICATOR = "homekitMultiplicator";
+ private static final String CONFIG_MULTIPLICATOR = "homekitMultiplicator";
public HomekitHumiditySensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
HomekitAccessoryUpdater updater, HomekitSettings settings) {
private ItemRegistry itemRegistry;
private @Nullable DynamoDbEnhancedAsyncClient client;
private @Nullable DynamoDbAsyncClient lowLevelClient;
- private final static Logger logger = LoggerFactory.getLogger(DynamoDBPersistenceService.class);
+ private static final Logger logger = LoggerFactory.getLogger(DynamoDBPersistenceService.class);
private boolean isProperlyConfigured;
private @Nullable DynamoDBConfig dbConfig;
private @Nullable DynamoDBTableNameResolver tableNameResolver;
protected static final Unit<Dimensionless> DIMENSIONLESS_ITEM_UNIT = Units.ONE;
private static @Nullable URI endpointOverride;
- protected static UnitProvider UNIT_PROVIDER;
+ protected static final UnitProvider UNIT_PROVIDER;
static {
ComponentContext context = Mockito.mock(ComponentContext.class);
BundleContext bundleContext = Mockito.mock(BundleContext.class);
* @param tablePrefix
* @return new persistence service
*/
- protected synchronized static DynamoDBPersistenceService newService(@Nullable Boolean legacy, boolean cleanLocal,
+ protected static synchronized DynamoDBPersistenceService newService(@Nullable Boolean legacy, boolean cleanLocal,
@Nullable URI overrideLocalURI, @Nullable String table, @Nullable String tablePrefix) {
final DynamoDBPersistenceService service;
Map<String, Object> config = getConfig(legacy, table, tablePrefix);
flux = flux.filter(tag(TAG_ITEM_NAME).equal(itemName));
}
- if (needsToUseItemTagName)
+ if (needsToUseItemTagName) {
flux = flux.keep(new String[] { FIELD_MEASUREMENT_NAME, COLUMN_TIME_NAME_V2, COLUMN_VALUE_NAME_V2,
TAG_ITEM_NAME });
- else
+ } else {
flux = flux.keep(new String[] { FIELD_MEASUREMENT_NAME, COLUMN_TIME_NAME_V2, COLUMN_VALUE_NAME_V2 });
+ }
}
if (criteria.getState() != null && criteria.getOperator() != null) {
this.maxInclusive = maxInclusive;
}
+ @SuppressWarnings("PMD.SimplifyBooleanReturns")
public boolean contains(final BigDecimal value) {
final boolean minMatch;
if (min == null) {