test_class.declarator: ITEM_NAME = "test"
test_class.modifier: private static final
test_class.original_string: private static final String ITEM_NAME = "test";
test_class.type: String
test_class.var_name: ITEM_NAME
test_class.declarator: stateDescriptionService
test_class.modifier: private @Mock
test_class.original_string: private @Mock StateDescriptionService stateDescriptionService;
test_class.type: StateDescriptionService
test_class.var_name: stateDescriptionService
test_class.file: bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/NumberItemTest.java
test_class.identifier: NumberItemTest
test_case.body: @Test
      public void testSetQuantityTypeAccepted() {
          NumberItem item = new NumberItem("Number:Temperature", ITEM_NAME);
          item.setState(new QuantityType<>("20 °C"));
  
          assertThat(item.getState(), is(new QuantityType<>("20 °C")));
      }
test_case.class_method_signature: NumberItemTest.testSetQuantityTypeAccepted()
test_case.full_signature: @Test public void testSetQuantityTypeAccepted()
test_case.identifier: testSetQuantityTypeAccepted
test_case.invocations: setState assertThat getState is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSetQuantityTypeAccepted()
focal_class.declarator: acceptedDataTypes = new ArrayList<>()
focal_class.modifier: private static
focal_class.original_string: private static List<Class<? extends State>> acceptedDataTypes = new ArrayList<>();
focal_class.type: List<Class<? extends State>>
focal_class.var_name: acceptedDataTypes
focal_class.declarator: acceptedCommandTypes = new ArrayList<>()
focal_class.modifier: private static
focal_class.original_string: private static List<Class<? extends Command>> acceptedCommandTypes = new ArrayList<>();
focal_class.type: List<Class<? extends Command>>
focal_class.var_name: acceptedCommandTypes
focal_class.declarator: dimension
focal_class.modifier: @Nullable
      private
focal_class.original_string: @Nullable
      private Class<? extends Quantity<?>> dimension;
focal_class.type: Class<? extends Quantity<?>>
focal_class.var_name: dimension
focal_class.file: bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/NumberItem.java
focal_class.identifier: NumberItem
focal_class.class_method_signature: NumberItem.NumberItem(String name)
focal_class.full_signature: public  NumberItem(String name)
focal_class.identifier: NumberItem
focal_class.modifiers: public
focal_class.parameters: (String name)
focal_class.signature:  NumberItem(String name)
focal_class.class_method_signature: NumberItem.NumberItem(String type, String name)
focal_class.full_signature: public  NumberItem(String type, String name)
focal_class.identifier: NumberItem
focal_class.modifiers: public
focal_class.parameters: (String type, String name)
focal_class.signature:  NumberItem(String type, String name)
focal_class.class_method_signature: NumberItem.getAcceptedDataTypes()
focal_class.full_signature: @Override public List<Class<? extends State>> getAcceptedDataTypes()
focal_class.identifier: getAcceptedDataTypes
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<Class<? extends State>>
focal_class.signature: List<Class<? extends State>> getAcceptedDataTypes()
focal_class.class_method_signature: NumberItem.getAcceptedCommandTypes()
focal_class.full_signature: @Override public List<Class<? extends Command>> getAcceptedCommandTypes()
focal_class.identifier: getAcceptedCommandTypes
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<Class<? extends Command>>
focal_class.signature: List<Class<? extends Command>> getAcceptedCommandTypes()
focal_class.class_method_signature: NumberItem.send(DecimalType command)
focal_class.full_signature: public void send(DecimalType command)
focal_class.identifier: send
focal_class.modifiers: public
focal_class.parameters: (DecimalType command)
focal_class.return: void
focal_class.signature: void send(DecimalType command)
focal_class.class_method_signature: NumberItem.getStateDescription(@Nullable Locale locale)
focal_class.full_signature: @Override public @Nullable StateDescription getStateDescription(@Nullable Locale locale)
focal_class.identifier: getStateDescription
focal_class.modifiers: @Override public @Nullable
focal_class.parameters: (@Nullable Locale locale)
focal_class.return: StateDescription
focal_class.signature: StateDescription getStateDescription(@Nullable Locale locale)
focal_class.class_method_signature: NumberItem.getDimension()
focal_class.full_signature: public @Nullable Class<? extends Quantity<?>> getDimension()
focal_class.identifier: getDimension
focal_class.modifiers: public @Nullable
focal_class.parameters: ()
focal_class.return: Class<? extends Quantity<?>>
focal_class.signature: Class<? extends Quantity<?>> getDimension()
focal_class.class_method_signature: NumberItem.setState(State state)
focal_class.full_signature: @Override public void setState(State state)
focal_class.identifier: setState
focal_class.modifiers: @Override public
focal_class.parameters: (State state)
focal_class.return: void
focal_class.signature: void setState(State state)
focal_class.class_method_signature: NumberItem.getUnitSymbol()
focal_class.full_signature: public @Nullable String getUnitSymbol()
focal_class.identifier: getUnitSymbol
focal_class.modifiers: public @Nullable
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getUnitSymbol()
focal_class.class_method_signature: NumberItem.getUnit()
focal_class.full_signature: public @Nullable Unit<? extends Quantity<?>> getUnit()
focal_class.identifier: getUnit
focal_class.modifiers: public @Nullable
focal_class.parameters: ()
focal_class.return: Unit<? extends Quantity<?>>
focal_class.signature: Unit<? extends Quantity<?>> getUnit()
focal_class.class_method_signature: NumberItem.toQuantityType(DecimalType originalType,
              @Nullable Class<? extends Quantity<?>> dimension)
focal_class.full_signature: public @Nullable QuantityType<?> toQuantityType(DecimalType originalType,
              @Nullable Class<? extends Quantity<?>> dimension)
focal_class.identifier: toQuantityType
focal_class.modifiers: public @Nullable
focal_class.parameters: (DecimalType originalType,
              @Nullable Class<? extends Quantity<?>> dimension)
focal_class.return: QuantityType<?>
focal_class.signature: QuantityType<?> toQuantityType(DecimalType originalType,
              @Nullable Class<? extends Quantity<?>> dimension)
focal_class.class_method_signature: NumberItem.getUnit(@Nullable Class<? extends Quantity<?>> dimension)
focal_class.full_signature: @SuppressWarnings({ "unchecked", "rawtypes" }) private @Nullable Unit<? extends Quantity<?>> getUnit(@Nullable Class<? extends Quantity<?>> dimension)
focal_class.identifier: getUnit
focal_class.modifiers: @SuppressWarnings({ "unchecked", "rawtypes" }) private @Nullable
focal_class.parameters: (@Nullable Class<? extends Quantity<?>> dimension)
focal_class.return: Unit<? extends Quantity<?>>
focal_class.signature: Unit<? extends Quantity<?>> getUnit(@Nullable Class<? extends Quantity<?>> dimension)
focal_class.superclass: extends GenericItem
focal_method.body: @Override
      public void setState(State state) {
          // DecimalType update for a NumberItem with dimension, convert to QuantityType:
          if (state instanceof DecimalType && dimension != null) {
              Unit<?> unit = getUnit();
              if (unit != null) {
                  super.setState(new QuantityType<>(((DecimalType) state).doubleValue(), unit));
                  return;
              }
          }
  
          // QuantityType update, check unit and convert if necessary:
          if (state instanceof QuantityType) {
              Unit<?> itemUnit = getUnit();
              Unit<?> stateUnit = ((QuantityType<?>) state).getUnit();
              if (itemUnit != null && (!stateUnit.getSystemUnit().equals(itemUnit.getSystemUnit())
                      || UnitUtils.isDifferentMeasurementSystem(itemUnit, stateUnit))) {
                  QuantityType<?> convertedState = ((QuantityType<?>) state).toUnit(itemUnit);
                  if (convertedState != null) {
                      super.setState(convertedState);
                      return;
                  }
  
                  // the state could not be converted to an accepted unit.
                  return;
              }
          }
  
          if (isAcceptedState(acceptedDataTypes, state)) {
              super.setState(state);
          } else {
              logSetTypeError(state);
          }
      }
focal_method.class_method_signature: NumberItem.setState(State state)
focal_method.full_signature: @Override public void setState(State state)
focal_method.identifier: setState
focal_method.invocations: getUnit setState doubleValue getUnit getUnit equals getSystemUnit getSystemUnit isDifferentMeasurementSystem toUnit setState isAcceptedState setState logSetTypeError
focal_method.modifiers: @Override public
focal_method.parameters: (State state)
focal_method.return: void
focal_method.signature: void setState(State state)