Enum SIPrefixes

java.lang.Object
java.lang.Enum<SIPrefixes>
org.djunits.unit.si.SIPrefixes
All Implemented Interfaces:
Serializable, Comparable<SIPrefixes>, java.lang.constant.Constable

public enum SIPrefixes
extends Enum<SIPrefixes>
Useful sets of SI prefixes.

Copyright (c) 2019-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License

Author:
Alexander Verbraeck
  • Enum Constant Details

    • NONE

      public static final SIPrefixes NONE
      No SI prefixes allowed. E.g., for the "inch".
    • UNIT

      public static final SIPrefixes UNIT
      All standard SI prefixes allowed. E.g., for the "meter".
    • UNIT_POS

      public static final SIPrefixes UNIT_POS
      All SI prefixes indicating larger than 1. E.g., for the electronVolt to avoid underflow with float values.
    • PER_UNIT

      public static final SIPrefixes PER_UNIT
      All standard SI prefixes allowed for "per unit". E.g., for the "per second".
    • KILO

      public static final SIPrefixes KILO
      SI prefixes allowed, but default starts with "kilo" / "k", e.g., for the "kilogram".
  • Field Details

  • Method Details

    • values

      public static SIPrefixes[] 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 SIPrefixes 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
    • getUnit

      public static SIPrefix getUnit​(String prefixKey)
      Look up and return the prefix information for the given prefix key (e.g., "G" for "giga").
      Parameters:
      prefixKey - String; the prefix key, e.g., "G" for "giga"
      Returns:
      SIPrefix; the SIPrefix information, or null if the prefixKey does not exist
    • getPerUnit

      public static SIPrefix getPerUnit​(String prefixKey)
      Look up and return the prefix information for the given prefix key (e.g., "/n" for "per nano").
      Parameters:
      prefixKey - String; the prefix key, e.g., "/n" for "per nano"
      Returns:
      SIPrefix; the SIPrefix information, or null if the prefixKey does not exist
    • getKiloUnit

      public static SIPrefix getKiloUnit​(String prefixKey)
      Return the prefix information for the given prefix key (e.g., "G" for "giga"), with an offset of a factor 1000 for units that have "kilo" as the default.
      Parameters:
      prefixKey - String; the prefix key, e.g., "G" for "giga"
      Returns:
      SIPrefix; the SIPrefix information, with an offset of 1000. So "k" will return 1, and "" will return 1.0E-3.