Use renamed Units class (#9267)

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-12-07 10:34:02 +01:00
committed by GitHub
parent d0480d0f2e
commit ac6f08908f
208 changed files with 1087 additions and 1169 deletions

View File

@@ -19,7 +19,7 @@ import javax.measure.quantity.Dimensionless;
import javax.measure.quantity.Time;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
/**
* Holds the calculates moon phase informations.
@@ -99,7 +99,7 @@ public class MoonPhase {
* Returns the age in days.
*/
public QuantityType<Time> getAge() {
return new QuantityType<>(age, SmartHomeUnits.DAY);
return new QuantityType<>(age, Units.DAY);
}
/**
@@ -113,7 +113,7 @@ public class MoonPhase {
* Returns the illumination.
*/
public QuantityType<Dimensionless> getIllumination() {
return new QuantityType<>(illumination, SmartHomeUnits.PERCENT);
return new QuantityType<>(illumination, Units.PERCENT);
}
/**
@@ -141,7 +141,7 @@ public class MoonPhase {
* Returns the age in degree.
*/
public QuantityType<Angle> getAgeDegree() {
return new QuantityType<>(ageDegree, SmartHomeUnits.DEGREE_ANGLE);
return new QuantityType<>(ageDegree, Units.DEGREE_ANGLE);
}
/**
@@ -155,7 +155,7 @@ public class MoonPhase {
* Returns the age in percent.
*/
public QuantityType<Dimensionless> getAgePercent() {
return new QuantityType<>(agePercent, SmartHomeUnits.PERCENT);
return new QuantityType<>(agePercent, Units.PERCENT);
}
/**

View File

@@ -15,7 +15,7 @@ package org.openhab.binding.astro.internal.model;
import javax.measure.quantity.Angle;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
/**
* Holds the calculated azimuth and elevation.
@@ -43,7 +43,7 @@ public class Position {
* Returns the azimuth.
*/
public QuantityType<Angle> getAzimuth() {
return new QuantityType<>(azimuth, SmartHomeUnits.DEGREE_ANGLE);
return new QuantityType<>(azimuth, Units.DEGREE_ANGLE);
}
/**
@@ -57,7 +57,7 @@ public class Position {
* Returns the elevation.
*/
public QuantityType<Angle> getElevation() {
return new QuantityType<>(elevation, SmartHomeUnits.DEGREE_ANGLE);
return new QuantityType<>(elevation, Units.DEGREE_ANGLE);
}
public double getElevationAsDouble() {

View File

@@ -14,7 +14,7 @@ package org.openhab.binding.astro.internal.model;
import org.openhab.core.library.dimension.Intensity;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
/**
* Holds the calculated direct, diffuse and total
@@ -62,20 +62,20 @@ public class Radiation {
* Returns the total radiation.
*/
public QuantityType<Intensity> getTotal() {
return new QuantityType<>(total, SmartHomeUnits.IRRADIANCE);
return new QuantityType<>(total, Units.IRRADIANCE);
}
/**
* Returns the direct radiation.
*/
public QuantityType<Intensity> getDirect() {
return new QuantityType<>(direct, SmartHomeUnits.IRRADIANCE);
return new QuantityType<>(direct, Units.IRRADIANCE);
}
/**
* Returns the diffuse radiation.
*/
public QuantityType<Intensity> getDiffuse() {
return new QuantityType<>(diffuse, SmartHomeUnits.IRRADIANCE);
return new QuantityType<>(diffuse, Units.IRRADIANCE);
}
}

View File

@@ -20,7 +20,7 @@ import javax.measure.quantity.Time;
import org.openhab.binding.astro.internal.util.DateTimeUtils;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
/**
* Range class which holds a start and a end calendar object.
@@ -63,10 +63,10 @@ public class Range {
return null;
}
if (start.after(end)) {
return new QuantityType<>(0, SmartHomeUnits.MINUTE);
return new QuantityType<>(0, Units.MINUTE);
}
return new QuantityType<>(end.getTimeInMillis() - start.getTimeInMillis(), MILLI(SmartHomeUnits.SECOND))
.toUnit(SmartHomeUnits.MINUTE);
return new QuantityType<>(end.getTimeInMillis() - start.getTimeInMillis(), MILLI(Units.SECOND))
.toUnit(Units.MINUTE);
}
/**

View File

@@ -20,7 +20,7 @@ import javax.measure.quantity.Time;
import org.openhab.binding.astro.internal.util.DateTimeUtils;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
/**
* Holds the season dates of the year and the current name.
@@ -129,7 +129,7 @@ public class Season {
public QuantityType<Time> getTimeLeft() {
Calendar now = Calendar.getInstance();
Calendar next = getNextSeason();
return new QuantityType<>(next.getTimeInMillis() - now.getTimeInMillis(), MILLI(SmartHomeUnits.SECOND))
.toUnit(SmartHomeUnits.DAY);
return new QuantityType<>(next.getTimeInMillis() - now.getTimeInMillis(), MILLI(Units.SECOND))
.toUnit(Units.DAY);
}
}