Package org.refcodes.codec
Enum BaseMetricsConfig
- java.lang.Object
-
- java.lang.Enum<BaseMetricsConfig>
-
- org.refcodes.codec.BaseMetricsConfig
-
- All Implemented Interfaces:
Serializable
,Comparable<BaseMetricsConfig>
,BaseMetrics
,org.refcodes.mixin.CharSetAccessor
,org.refcodes.numerical.NumberBaseAccessor
,org.refcodes.numerical.PaddingCharAccessor
public enum BaseMetricsConfig extends Enum<BaseMetricsConfig> implements BaseMetrics
This enumeration provides access to pre-configuredBaseMetrics
to be used by aBaseBuilder
, aBaseDecoder
, aBaseEncoder
or the like..
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.CharSetAccessor
org.refcodes.mixin.CharSetAccessor.CharSetBuilder<B extends org.refcodes.mixin.CharSetAccessor.CharSetBuilder<B>>, org.refcodes.mixin.CharSetAccessor.CharSetMutator, org.refcodes.mixin.CharSetAccessor.CharSetProperty
-
Nested classes/interfaces inherited from interface org.refcodes.numerical.NumberBaseAccessor
org.refcodes.numerical.NumberBaseAccessor.NumberBaseBuilder<B extends org.refcodes.numerical.NumberBaseAccessor.NumberBaseBuilder<B>>, org.refcodes.numerical.NumberBaseAccessor.NumberBaseMutator, org.refcodes.numerical.NumberBaseAccessor.NumberBaseProperty
-
Nested classes/interfaces inherited from interface org.refcodes.numerical.PaddingCharAccessor
org.refcodes.numerical.PaddingCharAccessor.PaddingCharBuilder<B extends org.refcodes.numerical.PaddingCharAccessor.PaddingCharBuilder<B>>, org.refcodes.numerical.PaddingCharAccessor.PaddingCharMutator, org.refcodes.numerical.PaddingCharAccessor.PaddingCharProperty
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BASE16
BASE2
BASE32
BASE4
BASE64
BASE64_ARABIC
BASE64_URL
BASE8
BINARY
ENCODED_AS_NUMBER
Use this encoding when you want to retrieve a "valid" number *not* beginning with a zero "0" and just consisting of the numbers 0 to 9.HEXADECIMAL
OCTAL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBitsPerDigit()
Number in bits for one digit.int
getBytesPerInt()
Number of bytes to exactly store a minimum number of digits.char[]
getCharSet()
int
getDigitMask()
The digit mask is the bit-field covering just the digit's bits (starting at bit 0).int
getDigitsPerByte()
Number of digits required to represent a byte.int
getDigitsPerInt()
Number of digits stored in an integer.int
getNumberBase()
char
getPaddingChar()
static BaseMetrics
toBaseCodec(int aNumberBase)
To base codec.char
toChar(int aValue)
Retrieves the (encoded) character for the (decoded) value.String
toString()
int
toValue(char aChar)
Retrieves the (decoded) value for the (encoded) character.static BaseMetricsConfig
valueOf(String name)
Returns the enum constant of this type with the specified name.static BaseMetricsConfig[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BASE2
public static final BaseMetricsConfig BASE2
-
BINARY
public static final BaseMetricsConfig BINARY
-
BASE4
public static final BaseMetricsConfig BASE4
-
BASE8
public static final BaseMetricsConfig BASE8
-
OCTAL
public static final BaseMetricsConfig OCTAL
-
ENCODED_AS_NUMBER
public static final BaseMetricsConfig ENCODED_AS_NUMBER
Use this encoding when you want to retrieve a "valid" number *not* beginning with a zero "0" and just consisting of the numbers 0 to 9. E.g. when a "number" variable is to be encoded and still must look like a number without any prefixed "0" chars. "0" is used as padding char being suffixed.
-
BASE16
public static final BaseMetricsConfig BASE16
-
HEXADECIMAL
public static final BaseMetricsConfig HEXADECIMAL
-
BASE32
public static final BaseMetricsConfig BASE32
-
BASE64
public static final BaseMetricsConfig BASE64
-
BASE64_ARABIC
public static final BaseMetricsConfig BASE64_ARABIC
-
BASE64_URL
public static final BaseMetricsConfig BASE64_URL
-
-
Method Detail
-
values
public static BaseMetricsConfig[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BaseMetricsConfig c : BaseMetricsConfig.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BaseMetricsConfig 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 nameNullPointerException
- if the argument is null
-
getNumberBase
public int getNumberBase()
- Specified by:
getNumberBase
in interfaceorg.refcodes.numerical.NumberBaseAccessor
-
getCharSet
public char[] getCharSet()
- Specified by:
getCharSet
in interfaceBaseMetrics
- Specified by:
getCharSet
in interfaceorg.refcodes.mixin.CharSetAccessor
-
getBytesPerInt
public int getBytesPerInt()
Number of bytes to exactly store a minimum number of digits.- Specified by:
getBytesPerInt
in interfaceBaseMetrics
- Returns:
- the bytes per int
-
getDigitsPerInt
public int getDigitsPerInt()
Number of digits stored in an integer.- Specified by:
getDigitsPerInt
in interfaceBaseMetrics
- Returns:
- the digits per int
-
getBitsPerDigit
public int getBitsPerDigit()
Number in bits for one digit.- Specified by:
getBitsPerDigit
in interfaceBaseMetrics
- Returns:
- the bits per digit
-
getDigitsPerByte
public int getDigitsPerByte()
Number of digits required to represent a byte.- Specified by:
getDigitsPerByte
in interfaceBaseMetrics
- 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 interfaceBaseMetrics
- 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 interfaceBaseMetrics
- 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 interfaceBaseMetrics
- Parameters:
aValue
- the value- Returns:
- the char
-
getPaddingChar
public char getPaddingChar()
- Specified by:
getPaddingChar
in interfaceorg.refcodes.numerical.PaddingCharAccessor
-
toString
public String toString()
- Overrides:
toString
in classEnum<BaseMetricsConfig>
-
-