java.lang.Object
java.lang.Enum<Data>
oracle.communication.brm.charging.util.unit.Data
All Implemented Interfaces:
Serializable, Comparable<Data>, Constable, Unit<Data>

public enum Data extends Enum<Data> implements Unit<Data>
Represents a Data volume unit with supported units in:
  • Bytes
  • KiloBytes = KibiBytes = 1024 Bytes
  • MegaBytes = MebiBytes = 1024 * 1024 Bytes
  • GigaBytes = GibiBytes = 1024 * 1024 * 1024 Bytes
  • TeraBytes = TebiBytes = 1024 * 1024 * 1024 * 1024 Bytes
Version:
1.0
Author:
ashsriva
  • Enum Constant Details

    • Bytes

      public static final Data Bytes
    • KibiBytes

      public static final Data KibiBytes
    • MebiBytes

      public static final Data MebiBytes
    • GibiBytes

      public static final Data GibiBytes
    • TebiBytes

      public static final Data TebiBytes
    • KiloBytes

      public static final Data KiloBytes
    • MegaBytes

      public static final Data MegaBytes
    • GigaBytes

      public static final Data GigaBytes
    • TeraBytes

      public static final Data TeraBytes
  • Field Details

    • METRIC_PREFIX_SET

      public static final EnumSet<Data> METRIC_PREFIX_SET
    • BINARY_PREFIX_SET

      public static final EnumSet<Data> BINARY_PREFIX_SET
  • Method Details

    • values

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

      public static Data valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • getRatio

      @Deprecated public long getRatio(Data d)
      Deprecated.

      The method returns a negative value if d is smaller than this Unit. For example, if d is KibiBytes and this Unit is in MebiBytes then the returned value will be 1024. If d is in MebiBytes and this Unit is in KibiBytes then the returned value is -1024. Negative value is returned to avoid any expensive divisions.

      Specified by:
      getRatio in interface Unit<Data>
      Parameters:
      d - Data
      Returns:
      long the ratio between d and this Unit. TODO: this method should be made private, it is still public here to provide backward compatibility to customers who are potentially still using it.
    • valueOf

      public UnitValue<Data> valueOf(BigDecimal b)
      Returns an instance of the UnitValue with this Unit and provided quantity
      Specified by:
      valueOf in interface Unit<Data>
      Parameters:
      b - BigDecimal
      Returns:
      UnitValue
    • convert

      public UnitValue<Data> convert(UnitValue<Data> otherValue)
      Returns an instance of the UnitValue with this Unit converted according to a specific ratio
      Specified by:
      convert in interface Unit<Data>
      Parameters:
      otherValue - UnitValue unit value to convert to
      Returns:
      UnitValue unit value resulting from conversion of otherValue to the unit
    • createValueFromUnitString

      public static UnitValue<Data> createValueFromUnitString(String unitString, BigDecimal theValue)
      helper method used to choose the correct UOM and set the value.
      Parameters:
      unitString - the UOM for the Data value
      theValue - the data value
      Returns:
      returns the newly created UnitValue from the supplied values.