Package org.refcodes.numerical
Interface BaseConverterBuilder
-
- All Superinterfaces:
org.refcodes.mixin.CharSetAccessor
,org.refcodes.mixin.CharSetAccessor.CharSetBuilder<BaseConverterBuilder>
,org.refcodes.mixin.CharSetAccessor.CharSetMutator
,org.refcodes.mixin.CharSetAccessor.CharSetProperty
,NumberBaseAccessor
,NumberBaseAccessor.NumberBaseBuilder<BaseConverterBuilder>
,NumberBaseAccessor.NumberBaseMutator
,NumberBaseAccessor.NumberBaseProperty
- All Known Implementing Classes:
BaseConverterBuilderImpl
public interface BaseConverterBuilder extends org.refcodes.mixin.CharSetAccessor.CharSetProperty, org.refcodes.mixin.CharSetAccessor.CharSetBuilder<BaseConverterBuilder>, NumberBaseAccessor.NumberBaseProperty, NumberBaseAccessor.NumberBaseBuilder<BaseConverterBuilder>
A number base converter from and to long values and which may also convert to and from byte arrays. You set a number base viawithNumberBase(int)
orNumberBaseAccessor.NumberBaseMutator.setNumberBase(int)
and you can convert forth and back withtoNumberBaseValue(long)
ortoNumber(String)
.
-
-
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
NumberBaseAccessor.NumberBaseBuilder<B extends NumberBaseAccessor.NumberBaseBuilder<B>>, NumberBaseAccessor.NumberBaseMutator, NumberBaseAccessor.NumberBaseProperty
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description long
getNumber()
Retrieves the number from the number property.java.lang.String
getNumberBaseValue()
Retrieves the number base value from the number base value property.byte[]
getNumberData()
Retrieves the number from the number property.void
setNumber(long aNumber)
Sets the number for the number property.void
setNumberBaseValue(java.lang.String aNumberBaseValue)
Sets the number base value for the number base value property.void
setNumberData(byte[] aNumberData)
Sets the number for the number property.long
toNumber(java.lang.String aNumberBaseValue)
Retrieves the number calculated from the provided number base value.java.lang.String
toNumberBaseValue(byte[] aNumberData)
Retrieves the number base value calculated from the number.java.lang.String
toNumberBaseValue(long aNumber)
Retrieves the number base value calculated from the number.byte[]
toNumberData(java.lang.String aNumberBaseValue)
Retrieves the number calculated from the provided number base value.default BaseConverterBuilder
withNumber(long aNumber)
Sets the number for the number property.default BaseConverterBuilder
withNumberBase(int aNumberBase)
Sets the number base for the number base property.default BaseConverterBuilder
withNumberBaseValue(java.lang.String aNumberBaseValue)
Sets the number base value for the number base value property.default BaseConverterBuilder
withNumberData(byte[] aNumberData)
Sets the number for the number property.-
Methods inherited from interface org.refcodes.numerical.NumberBaseAccessor
getNumberBase
-
Methods inherited from interface org.refcodes.numerical.NumberBaseAccessor.NumberBaseMutator
setNumberBase
-
-
-
-
Method Detail
-
withNumberBase
default BaseConverterBuilder withNumberBase(int aNumberBase)
Sets the number base for the number base property.- Specified by:
withNumberBase
in interfaceNumberBaseAccessor.NumberBaseBuilder<BaseConverterBuilder>
- Parameters:
aNumberBase
- The number base to be stored by the number base property.- Returns:
- The builder for applying multiple build operations.
-
getNumberBaseValue
java.lang.String getNumberBaseValue()
Retrieves the number base value from the number base value property.- Returns:
- The number base value stored by the number base value property.
-
toNumberBaseValue
java.lang.String toNumberBaseValue(byte[] aNumberData)
Retrieves the number base value calculated from the number. This method is to be side effect free in terms of the number (and the encoded result) is not part of the state for this instance (from the point of view of this method). For avoiding thread race conditions / side effects regarding the decoded data (and the encoded result), use this method instead of the combination ofwithNumberData(byte[])
withgetNumberBaseValue()
- Parameters:
aNumberData
- The number to be encoded.- Returns:
- The number base value calculated from the number.
-
toNumberBaseValue
java.lang.String toNumberBaseValue(long aNumber)
Retrieves the number base value calculated from the number. This method is to be side effect free in terms of the number (and the encoded result) is not part of the state for this instance (from the point of view of this method). For avoiding thread race conditions / side effects regarding the decoded data (and the encoded result), use this method instead of the combination ofwithNumberData(byte[])
withgetNumberBaseValue()
- Parameters:
aNumber
- The number to be encoded.- Returns:
- The number base value calculated from the number.
-
setNumberBaseValue
void setNumberBaseValue(java.lang.String aNumberBaseValue)
Sets the number base value for the number base value property.- Parameters:
aNumberBaseValue
- The number base value to be stored by the number base value property.
-
withNumberBaseValue
default BaseConverterBuilder withNumberBaseValue(java.lang.String aNumberBaseValue)
Sets the number base value for the number base value property.- Parameters:
aNumberBaseValue
- The number base value to be stored by the number base value property.- Returns:
- The builder for applying multiple build operations.
-
getNumber
long getNumber()
Retrieves the number from the number property.- Returns:
- The number stored by the number property.
-
getNumberData
byte[] getNumberData()
Retrieves the number from the number property.- Returns:
- The number stored by the number property.
-
toNumber
long toNumber(java.lang.String aNumberBaseValue) throws java.lang.IllegalArgumentException
Retrieves the number calculated from the provided number base value. This method is to be side effect free in terms of the number base value (and the decoded result) is not part of the state for this instance (from the point of view of this method). For avoiding thread race conditions / side effects regarding the encoded text (and the decoded result), use this method instead of the combination ofwithNumberBaseValue(String)
withgetNumberData()
.- Parameters:
aNumberBaseValue
- The number base value to be decoded.- Returns:
- The number decoded from the number base value.
- Throws:
java.lang.IllegalArgumentException
- the illegal argument exception
-
toNumberData
byte[] toNumberData(java.lang.String aNumberBaseValue) throws java.lang.NumberFormatException
Retrieves the number calculated from the provided number base value. This method is to be side effect free in terms of the number base value (and the decoded result) is not part of the state for this instance (from the point of view of this method). For avoiding thread race conditions / side effects regarding the encoded text (and the decoded result), use this method instead of the combination ofwithNumberBaseValue(String)
withgetNumberData()
.- Parameters:
aNumberBaseValue
- The number base value to be decoded.- Returns:
- The number decoded from the number base value.
- Throws:
java.lang.NumberFormatException
- the number format exception
-
setNumberData
void setNumberData(byte[] aNumberData)
Sets the number for the number property.- Parameters:
aNumberData
- The number to be stored by the number property.
-
setNumber
void setNumber(long aNumber)
Sets the number for the number property.- Parameters:
aNumber
- The number to be stored by the number property.
-
withNumberData
default BaseConverterBuilder withNumberData(byte[] aNumberData)
Sets the number for the number property.- Parameters:
aNumberData
- The number to be stored by the number property.- Returns:
- The builder for applying multiple build operations.
-
withNumber
default BaseConverterBuilder withNumber(long aNumber)
Sets the number for the number property.- Parameters:
aNumber
- The number to be stored by the number property.- Returns:
- The builder for applying multiple build operations.
-
-