Interface BaseMetrics

All Superinterfaces:
CharSetAccessor, NumberBaseAccessor, PaddingCharAccessor
All Known Implementing Classes:
BaseMetricsConfig, BaseMetricsImpl

public interface BaseMetrics extends CharSetAccessor, PaddingCharAccessor, NumberBaseAccessor
The BaseMetrics provide the metrics for a codec to be used by an implementation of the BaseBuilder, the BaseDecoder, the BaseEncoder or the like.
  • Method Details

    • getCharSet

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

      int getBytesPerInt()
      Number of bytes to exactly store a minimum number of digits.
      Returns:
      the bytes per int
    • getBytesPerBlock

      int getBytesPerBlock()
      Number of bytes to exactly fit into an encoded block.
      Returns:
      the bytes per block
    • getDigitsPerInt

      int getDigitsPerInt()
      Number of digits stored in an integer.
      Returns:
      the digits per int
    • getDigitsPerBlock

      default int getDigitsPerBlock()
      The size of a digits-block, any String of digits not being a multiple of the digits-block size requires padding chars.
      Returns:
      the digits per block.
    • getBitsPerDigit

      int getBitsPerDigit()
      Number in bits for one digit.
      Returns:
      the bits per digit
    • getDigitsPerByte

      int getDigitsPerByte()
      Number of digits required to represent a byte.
      Returns:
      the digits per byte
    • getDigitMask

      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.
      Returns:
      the digit mask
    • toValue

      int toValue(char aChar)
      Retrieves the (decoded) value for the (encoded) character.
      Parameters:
      aChar - the char
      Returns:
      the int
    • toChar

      char toChar(int aValue)
      Retrieves the (encoded) character for the (decoded) value.
      Parameters:
      aValue - the value
      Returns:
      the char
    • toPaddingCharsNumber

      default int toPaddingCharsNumber(int aSize)
      Determines the number of padding characters to be appended to data of a given number of bytes to be encoded.
      Parameters:
      aSize - The size for which to determine the number of padding characters.
      Returns:
      The according number of padding characters.
    • toPaddingChars

      default String toPaddingChars(int aSize)
      Determines the padding String to be appended to data of the given number of bytes to be encoded.
      Parameters:
      aSize - The size for which to determine the number of padding characters.
      Returns:
      The according padding String.