test_class.file: bundles/org.openhab.core/src/test/java/org/openhab/core/types/util/UnitUtilsTest.java
test_class.identifier: UnitUtilsTest
test_case.body: @Test
      public void forBaseUnitsOfSameSystemShouldBeFalse() {
          assertFalse(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), SIUnits.METRE));
          assertFalse(UnitUtils.isDifferentMeasurementSystem(SIUnits.METRE, MILLI(SIUnits.METRE)));
          assertFalse(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), MILLI(SIUnits.METRE)));
          assertFalse(UnitUtils.isDifferentMeasurementSystem(ImperialUnits.MILE, ImperialUnits.INCH));
          assertFalse(UnitUtils.isDifferentMeasurementSystem(HECTO(SIUnits.PASCAL), SIUnits.PASCAL));
      }
test_case.class_method_signature: UnitUtilsTest.forBaseUnitsOfSameSystemShouldBeFalse()
test_case.full_signature: @Test public void forBaseUnitsOfSameSystemShouldBeFalse()
test_case.identifier: forBaseUnitsOfSameSystemShouldBeFalse
test_case.invocations: assertFalse isDifferentMeasurementSystem CENTI assertFalse isDifferentMeasurementSystem MILLI assertFalse isDifferentMeasurementSystem CENTI MILLI assertFalse isDifferentMeasurementSystem assertFalse isDifferentMeasurementSystem HECTO
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void forBaseUnitsOfSameSystemShouldBeFalse()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(UnitUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(UnitUtils.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: UNIT_PLACEHOLDER = "%unit%"
focal_class.modifier: public static final
focal_class.original_string: public static final String UNIT_PLACEHOLDER = "%unit%";
focal_class.type: String
focal_class.var_name: UNIT_PLACEHOLDER
focal_class.declarator: UNIT_PERCENT_FORMAT_STRING = "%%"
focal_class.modifier: public static final
focal_class.original_string: public static final String UNIT_PERCENT_FORMAT_STRING = "%%";
focal_class.type: String
focal_class.var_name: UNIT_PERCENT_FORMAT_STRING
focal_class.declarator: JAVAX_MEASURE_QUANTITY_PREFIX = "javax.measure.quantity."
focal_class.modifier: private static final
focal_class.original_string: private static final String JAVAX_MEASURE_QUANTITY_PREFIX = "javax.measure.quantity.";
focal_class.type: String
focal_class.var_name: JAVAX_MEASURE_QUANTITY_PREFIX
focal_class.declarator: FRAMEWORK_DIMENSION_PREFIX = "org.openhab.core.library.dimension."
focal_class.modifier: private static final
focal_class.original_string: private static final String FRAMEWORK_DIMENSION_PREFIX = "org.openhab.core.library.dimension.";
focal_class.type: String
focal_class.var_name: FRAMEWORK_DIMENSION_PREFIX
focal_class.declarator: ALL_SYSTEM_OF_UNITS = Arrays.asList(SIUnits.class,
              ImperialUnits.class, SmartHomeUnits.class, Units.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Collection<Class<? extends SystemOfUnits>> ALL_SYSTEM_OF_UNITS = Arrays.asList(SIUnits.class,
              ImperialUnits.class, SmartHomeUnits.class, Units.class);
focal_class.type: Collection<Class<? extends SystemOfUnits>>
focal_class.var_name: ALL_SYSTEM_OF_UNITS
focal_class.file: bundles/org.openhab.core/src/main/java/org/openhab/core/types/util/UnitUtils.java
focal_class.identifier: UnitUtils
focal_class.class_method_signature: UnitUtils.parseDimension(String dimension)
focal_class.full_signature: public static @Nullable Class<? extends Quantity<?>> parseDimension(String dimension)
focal_class.identifier: parseDimension
focal_class.modifiers: public static @Nullable
focal_class.parameters: (String dimension)
focal_class.return: Class<? extends Quantity<?>>
focal_class.signature: Class<? extends Quantity<?>> parseDimension(String dimension)
focal_class.class_method_signature: UnitUtils.getDimensionName(Unit<?> unit)
focal_class.full_signature: public static @Nullable String getDimensionName(Unit<?> unit)
focal_class.identifier: getDimensionName
focal_class.modifiers: public static @Nullable
focal_class.parameters: (Unit<?> unit)
focal_class.return: String
focal_class.signature: String getDimensionName(Unit<?> unit)
focal_class.class_method_signature: UnitUtils.parseUnit(@Nullable String pattern)
focal_class.full_signature: public static @Nullable Unit<?> parseUnit(@Nullable String pattern)
focal_class.identifier: parseUnit
focal_class.modifiers: public static @Nullable
focal_class.parameters: (@Nullable String pattern)
focal_class.return: Unit<?>
focal_class.signature: Unit<?> parseUnit(@Nullable String pattern)
focal_class.class_method_signature: UnitUtils.isDifferentMeasurementSystem(Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)
focal_class.full_signature: public static boolean isDifferentMeasurementSystem(Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)
focal_class.identifier: isDifferentMeasurementSystem
focal_class.modifiers: public static
focal_class.parameters: (Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)
focal_class.return: boolean
focal_class.signature: boolean isDifferentMeasurementSystem(Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)
focal_class.class_method_signature: UnitUtils.isMetricConversion(UnitConverter converter)
focal_class.full_signature: private static boolean isMetricConversion(UnitConverter converter)
focal_class.identifier: isMetricConversion
focal_class.modifiers: private static
focal_class.parameters: (UnitConverter converter)
focal_class.return: boolean
focal_class.signature: boolean isMetricConversion(UnitConverter converter)
focal_class.class_method_signature: UnitUtils.dimensionClass(String prefix, String name)
focal_class.full_signature: @SuppressWarnings("unchecked") private static Class<? extends Quantity<?>> dimensionClass(String prefix, String name)
focal_class.identifier: dimensionClass
focal_class.modifiers: @SuppressWarnings("unchecked") private static
focal_class.parameters: (String prefix, String name)
focal_class.return: Class<? extends Quantity<?>>
focal_class.signature: Class<? extends Quantity<?>> dimensionClass(String prefix, String name)
focal_method.body: public static boolean isDifferentMeasurementSystem(Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit) {
          Set<? extends Unit<?>> siUnits = SIUnits.getInstance().getUnits();
          Set<? extends Unit<?>> usUnits = ImperialUnits.getInstance().getUnits();
  
          boolean differentSystems = (siUnits.contains(thisUnit) && usUnits.contains(thatUnit)) //
                  || (siUnits.contains(thatUnit) && usUnits.contains(thisUnit));
  
          if (!differentSystems) {
              if (thisUnit instanceof TransformedUnit
                      && isMetricConversion(((TransformedUnit<?>) thisUnit).getConverter())) {
                  return isDifferentMeasurementSystem(((TransformedUnit<?>) thisUnit).getParentUnit(), thatUnit);
              }
  
              if (thatUnit instanceof TransformedUnit
                      && isMetricConversion(((TransformedUnit<?>) thatUnit).getConverter())) {
                  return isDifferentMeasurementSystem(thisUnit, ((TransformedUnit<?>) thatUnit).getParentUnit());
              }
          }
  
          // Compare the unit symbols. For product units (e.g. 1km / 1h) the equality is not given in the Sets above.
          if (!differentSystems) {
              Set<String> siSymbols = siUnits.stream().map(Unit::getSymbol).collect(toSet());
              Set<String> usSymbols = usUnits.stream().map(Unit::getSymbol).collect(toSet());
  
              differentSystems = (siSymbols.contains(thisUnit.getSymbol()) && usSymbols.contains(thatUnit.getSymbol())) //
                      || (siSymbols.contains(thatUnit.getSymbol()) && usSymbols.contains(thisUnit.getSymbol()));
          }
  
          return differentSystems;
      }
focal_method.class_method_signature: UnitUtils.isDifferentMeasurementSystem(Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)
focal_method.full_signature: public static boolean isDifferentMeasurementSystem(Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)
focal_method.identifier: isDifferentMeasurementSystem
focal_method.invocations: getUnits getInstance getUnits getInstance contains contains contains contains isMetricConversion getConverter isDifferentMeasurementSystem getParentUnit isMetricConversion getConverter isDifferentMeasurementSystem getParentUnit collect map stream toSet collect map stream toSet contains getSymbol contains getSymbol contains getSymbol contains getSymbol
focal_method.modifiers: public static
focal_method.parameters: (Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)
focal_method.return: boolean
focal_method.signature: boolean isDifferentMeasurementSystem(Unit<? extends Quantity<?>> thisUnit, Unit<?> thatUnit)