Enum TraitUnitDimension

java.lang.Object
java.lang.Enum<TraitUnitDimension>
com.codename1.home.TraitUnitDimension
All Implemented Interfaces:
Comparable<TraitUnitDimension>

public enum TraitUnitDimension extends Enum<TraitUnitDimension>
What a TraitUnit measures. Two units convert into one another only when they share a dimension; asking for anything else is a bug in the calling code and throws.
  • Enum Constant Details

    • DIMENSIONLESS

      public static final TraitUnitDimension DIMENSIONLESS
      A bare number with no unit -- an ordinal, a count, a boolean carried as a number.
    • RATIO

      public static final TraitUnitDimension RATIO
      A proportion. Canonical unit TraitUnit.PERCENT.
    • TEMPERATURE

      public static final TraitUnitDimension TEMPERATURE
      Temperature. Canonical unit TraitUnit.CELSIUS. The only dimension here that needs the affine offset.
    • ANGLE

      public static final TraitUnitDimension ANGLE
      A plane angle, used for colour hue. Canonical unit TraitUnit.ARC_DEGREE.
    • COLOR_TEMPERATURE

      public static final TraitUnitDimension COLOR_TEMPERATURE

      The correlated colour temperature of a light. Canonical unit TraitUnit.MIRED.

      Its own dimension rather than a member of TEMPERATURE, which it resembles only by name: a light at 250 mireds is not 250 degrees of anything, and letting the two convert would turn a thermostat setpoint into a colour by arithmetic that raises no error.

    • ILLUMINANCE

      public static final TraitUnitDimension ILLUMINANCE
      Illuminance. Canonical unit TraitUnit.LUX.
    • CONCENTRATION_PARTS

      public static final TraitUnitDimension CONCENTRATION_PARTS

      A concentration expressed as a fraction of the whole -- parts per million and its relatives. Canonical unit TraitUnit.PPM.

      Deliberately does not convert to CONCENTRATION_MASS. Going between parts-per and micrograms per cubic metre needs the molar mass of the gas and the ambient temperature and pressure, none of which this API has. Accessories report one or the other; where the platform gives a value in the dimension the trait does not use, the port reports no value rather than inventing the missing physics.

    • CONCENTRATION_MASS

      public static final TraitUnitDimension CONCENTRATION_MASS
      A concentration expressed as mass per volume, used for particulate matter. Canonical unit TraitUnit.MICROGRAM_PER_CUBIC_METER.
  • Method Details

    • values

      public static TraitUnitDimension[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static TraitUnitDimension valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null