[miio] cleanup several SAT warnings (#10871)

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
Marcel 2021-06-16 10:28:44 +02:00 committed by GitHub
parent 28c513ac3a
commit 36d7dc26b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 19 deletions

View File

@ -88,7 +88,7 @@ public class MiIoHandlerFactory extends BaseThingHandlerFactory {
}
@Deactivate
private void dispose() {
public void dispose() {
final Future<Boolean> scheduledTask = this.scheduledTask;
if (scheduledTask != null && !scheduledTask.isDone()) {
scheduledTask.cancel(true);

View File

@ -121,11 +121,7 @@ public class MiIoBasicChannel {
}
public boolean isMiOt() {
if (piid != null && siid != null && (getPiid() != 0 || getSiid() != 0)) {
return true;
} else {
return false;
}
return (piid != null && siid != null && (getPiid() != 0 || getSiid() != 0));
}
public String getFriendlyName() {

View File

@ -29,15 +29,13 @@ import org.openhab.core.library.unit.Units;
public class MiIoQuantityTypesTest {
@Test
public void UnknownUnitTest() {
public void unknownUnitTest() {
String unitName = "some none existent unit";
assertNull(MiIoQuantiyTypes.get(unitName));
}
@Test
public void regularsUnitTest() {
String unitName = "minute";
assertEquals(Units.MINUTE, MiIoQuantiyTypes.get(unitName));
@ -47,7 +45,6 @@ public class MiIoQuantityTypesTest {
@Test
public void aliasUnitsTest() {
String unitName = "square_meter";
assertEquals(SIUnits.SQUARE_METRE, MiIoQuantiyTypes.get(unitName));

View File

@ -149,7 +149,7 @@ public class RoboMapViewer extends JFrame {
@Override
public void mouseMoved(@Nullable MouseEvent e) {
if (e != null) {
MapPoint roboMouseLocation = MapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
MapPoint roboMouseLocation = mapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
updateStatusLine(roboMouseLocation);
}
}
@ -164,7 +164,7 @@ public class RoboMapViewer extends JFrame {
repaint();
if (rrDrawPanel.hasDrawZone()) {
final MapPoint endLocation = MapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
final MapPoint endLocation = mapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
double minX = Math.min(fromLocation.getX(), endLocation.getX());
double maxX = Math.max(fromLocation.getX(), endLocation.getX());
double minY = Math.min(fromLocation.getY(), endLocation.getY());
@ -173,7 +173,7 @@ public class RoboMapViewer extends JFrame {
"Zone coordinates:\t%s, %s\t\tZone clean command: app_zoned_clean[[ %.0f,%.0f,%.0f,%.0f,1 ]]\r\n",
endLocation, fromLocation, minX, minY, maxX, maxY));
} else {
final MapPoint pointLocation = MapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
final MapPoint pointLocation = mapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
textArea.append(String.format(
"GoTo coordinates:\t[X=%.0f, Y=%.0f]\t\tGoto command: app_goto_target[ %.0f,%.0f ]\r\n",
pointLocation.getX(), pointLocation.getY(), pointLocation.getX(),
@ -186,7 +186,7 @@ public class RoboMapViewer extends JFrame {
public void mousePressed(@Nullable MouseEvent e) {
if (e != null) {
rrDrawPanel.setStartPoint(e.getX(), e.getY());
fromLocation = MapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
fromLocation = mapCoordstoRoboCoords(localCoordtoMapCoords(e.getPoint()));
}
}
@ -296,7 +296,7 @@ public class RoboMapViewer extends JFrame {
}
}
private MapPoint MapCoordstoRoboCoords(MapPoint imagePoint) {
private MapPoint mapCoordstoRoboCoords(MapPoint imagePoint) {
final RRMapDraw rrMap = this.rrMap;
if (rrMap != null) {
final RRMapFileParser mapDetails = rrMap.getMapParseDetails();
@ -484,10 +484,7 @@ class RRDrawPanel extends JPanel {
public boolean hasDrawZone() {
int pw = Math.abs(x - x2);
int ph = Math.abs(y - y2);
if (pw != 0 && ph != 0) {
return true;
}
return false;
return pw != 0 && ph != 0;
}
public void drawZoneRect(Graphics g, int x, int y, int x2, int y2) {