Class QuantityTypeArithmeticGroupFunction.DimensionalGroupFunction

java.lang.Object
org.openhab.core.library.types.QuantityTypeArithmeticGroupFunction.DimensionalGroupFunction
All Implemented Interfaces:
GroupFunction
Direct Known Subclasses:
QuantityTypeArithmeticGroupFunction.Avg, QuantityTypeArithmeticGroupFunction.Max, QuantityTypeArithmeticGroupFunction.Median, QuantityTypeArithmeticGroupFunction.Min, QuantityTypeArithmeticGroupFunction.Sum
Enclosing interface:
QuantityTypeArithmeticGroupFunction

public abstract static class QuantityTypeArithmeticGroupFunction.DimensionalGroupFunction extends Object implements GroupFunction
  • Field Details

    • baseItemUnit

      protected final javax.measure.Unit<?> baseItemUnit
    • systemUnit

      protected final javax.measure.Unit<?> systemUnit
  • Constructor Details

    • DimensionalGroupFunction

      public DimensionalGroupFunction(javax.measure.Unit<?> baseItemUnit)
  • Method Details

    • getStateAs

      public <T extends State> @Nullable T getStateAs(@Nullable Set<Item> items, Class<T> stateClass)
      Description copied from interface: GroupFunction
      Calculates the group state and returns it as a state of the requested type.
      Specified by:
      getStateAs in interface GroupFunction
      Parameters:
      items - the items to calculate a group state for
      stateClass - the type in which the state should be returned
      Returns:
      the calculated group state of the requested type or null, if type is not supported
    • getParameters

      public State[] getParameters()
      Description copied from interface: GroupFunction
      Returns the parameters of the function as an array.
      Specified by:
      getParameters in interface GroupFunction
      Returns:
      the parameters of this function
    • toQuantityTypesOfUnit

      protected List<QuantityType> toQuantityTypesOfUnit(Set<Item> items, javax.measure.Unit<?> unit)
      Convert a set of Item to a respective list of QuantityType. Exclude any Items whose current State is not a QuantityType. Convert any remaining QuantityType to the 'referenceUnit' and exclude any values that did not convert.
      Parameters:
      items - a list of Item
      Returns:
      a list of QuantityType converted to the 'referenceUnit'