Class BaseConverterBuilderImpl

    • Constructor Detail

      • BaseConverterBuilderImpl

        public BaseConverterBuilderImpl​()
        Instantiates a new base converter builder impl.
    • Method Detail

      • getCharSet

        public char[] getCharSet​()
        Specified by:
        getCharSet in interface org.refcodes.mixin.CharSetAccessor
      • setCharSet

        public void setCharSet​(char[] aCharSet)
        Specified by:
        setCharSet in interface org.refcodes.mixin.CharSetAccessor.CharSetMutator
      • setNumberBase

        public void setNumberBase​(int aNumberBase)
        Sets the value for the number base property.
        Specified by:
        setNumberBase in interface NumberBaseAccessor.NumberBaseMutator
        Parameters:
        aNumberBase - The value to be stored by the number base property.
      • getNumberBase

        public int getNumberBase​()
        Retrieves the value from the number base property.
        Specified by:
        getNumberBase in interface NumberBaseAccessor
        Returns:
        The name stored by the number base property.
      • toNumberBaseValue

        public 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 of BaseConverterBuilder.withNumberData(byte[]) with BaseConverterBuilder.getNumberBaseValue()
        Specified by:
        toNumberBaseValue in interface BaseConverterBuilder
        Parameters:
        aNumber - The number to be encoded.
        Returns:
        The number base value calculated from the number.
      • getNumber

        public long getNumber​()
        Retrieves the number from the number property.
        Specified by:
        getNumber in interface BaseConverterBuilder
        Returns:
        The number stored by the number property.
      • toNumber

        public long toNumber​(String aNumberBaseValue)
                      throws 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 of BaseConverterBuilder.withNumberBaseValue(String) with BaseConverterBuilder.getNumberData().
        Specified by:
        toNumber in interface BaseConverterBuilder
        Parameters:
        aNumberBaseValue - The number base value to be decoded.
        Returns:
        The number decoded from the number base value.
        Throws:
        IllegalArgumentException - the illegal argument exception
      • setNumber

        public void setNumber​(long aNumber)
        Sets the number for the number property.
        Specified by:
        setNumber in interface BaseConverterBuilder
        Parameters:
        aNumber - The number to be stored by the number property.
      • getNumberBaseValue

        public String getNumberBaseValue​()
        Retrieves the number base value from the number base value property.
        Specified by:
        getNumberBaseValue in interface BaseConverterBuilder
        Returns:
        The number base value stored by the number base value property.
      • setNumberBaseValue

        public void setNumberBaseValue​(String aNumberBaseValue)
        Sets the number base value for the number base value property.
        Specified by:
        setNumberBaseValue in interface BaseConverterBuilder
        Parameters:
        aNumberBaseValue - The number base value to be stored by the number base value property.
      • getNumberData

        public byte[] getNumberData​()
        Retrieves the number from the number property.
        Specified by:
        getNumberData in interface BaseConverterBuilder
        Returns:
        The number stored by the number property.
      • setNumberData

        public void setNumberData​(byte[] aNumberData)
        Sets the number for the number property.
        Specified by:
        setNumberData in interface BaseConverterBuilder
        Parameters:
        aNumberData - The number to be stored by the number property.
      • toNumberBaseValue

        public 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 of BaseConverterBuilder.withNumberData(byte[]) with BaseConverterBuilder.getNumberBaseValue()
        Specified by:
        toNumberBaseValue in interface BaseConverterBuilder
        Parameters:
        aNumberData - The number to be encoded.
        Returns:
        The number base value calculated from the number.
      • toNumberData

        public byte[] toNumberData​(String aNumberBaseValue)
        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 of BaseConverterBuilder.withNumberBaseValue(String) with BaseConverterBuilder.getNumberData().
        Specified by:
        toNumberData in interface BaseConverterBuilder
        Parameters:
        aNumberBaseValue - The number base value to be decoded.
        Returns:
        The number decoded from the number base value.
      • toVerboseString

        protected static String toVerboseString​(byte[] aBytes)
        TODO: This helper is required to help making the code break when it reaches its bad implementations. Bad bad hack! Remove when code is fixed.
        Parameters:
        aBytes - the bytes
        Returns:
        the string