Enum Class BaseMetricsConfig

java.lang.Object
java.lang.Enum<BaseMetricsConfig>
org.refcodes.codec.BaseMetricsConfig
All Implemented Interfaces:
Serializable, Comparable<BaseMetricsConfig>, Constable, BaseMetrics, CharSetAccessor, NumberBaseAccessor, PaddingCharAccessor

public enum BaseMetricsConfig extends Enum<BaseMetricsConfig> implements BaseMetrics
This enumeration provides access to preconfigured BaseMetrics to be used by a BaseBuilder, a BaseDecoder, a BaseEncoder or the like..
  • Enum Constant Details

  • Method Details

    • values

      public static BaseMetricsConfig[] 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 BaseMetricsConfig 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
    • getNumberBase

      public int getNumberBase()
      Specified by:
      getNumberBase in interface NumberBaseAccessor
    • getCharSet

      public char[] getCharSet()
      Specified by:
      getCharSet in interface BaseMetrics
      Specified by:
      getCharSet in interface CharSetAccessor
    • getBytesPerInt

      public int getBytesPerInt()
      Number of bytes to exactly store a minimum number of digits.
      Specified by:
      getBytesPerInt in interface BaseMetrics
      Returns:
      the bytes per int
    • getDigitsPerInt

      public int getDigitsPerInt()
      Number of digits stored in an integer.
      Specified by:
      getDigitsPerInt in interface BaseMetrics
      Returns:
      the digits per int
    • getBitsPerDigit

      public int getBitsPerDigit()
      Number in bits for one digit.
      Specified by:
      getBitsPerDigit in interface BaseMetrics
      Returns:
      the bits per digit
    • getDigitsPerByte

      public int getDigitsPerByte()
      Number of digits required to represent a byte.
      Specified by:
      getDigitsPerByte in interface BaseMetrics
      Returns:
      the digits per byte
    • getDigitMask

      public int getDigitMask()
      The digit mask is the bit-field covering just the digit's bits (starting at bit 0). Those bits in the mask are set to one which are required to represent a digit.
      Specified by:
      getDigitMask in interface BaseMetrics
      Returns:
      the digit mask
    • toBaseCodec

      public static BaseMetrics toBaseCodec(int aNumberBase)
      To base codec.
      Parameters:
      aNumberBase - the number base
      Returns:
      the base metrics
    • toValue

      public int toValue(char aChar)
      Retrieves the (decoded) value for the (encoded) character.
      Specified by:
      toValue in interface BaseMetrics
      Parameters:
      aChar - the char
      Returns:
      the int
    • toChar

      public char toChar(int aValue)
      Retrieves the (encoded) character for the (decoded) value.
      Specified by:
      toChar in interface BaseMetrics
      Parameters:
      aValue - the value
      Returns:
      the char
    • getPaddingChar

      public char getPaddingChar()
      Specified by:
      getPaddingChar in interface PaddingCharAccessor
    • getBytesPerBlock

      public int getBytesPerBlock()
      Number of bytes to exactly fit into an encoded block.
      Specified by:
      getBytesPerBlock in interface BaseMetrics
      Returns:
      the bytes per block