Class BasicAlphabetMapper

  • All Implemented Interfaces:
    AlphabetMapper

    public class BasicAlphabetMapper
    extends java.lang.Object
    implements AlphabetMapper
    A basic alphabet mapper that just creates a mapper based on the passed in array of characters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      char[] convertToChars​(byte[] input)
      Return a char[] for this alphabet based on the indexes passed.
      byte[] convertToIndexes​(char[] input)
      Return the passed in char[] as a byte array of indexes (indexes can be more than 1 byte)
      int getRadix()
      Return the number of characters in the alphabet.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BasicAlphabetMapper

        public BasicAlphabetMapper​(java.lang.String alphabet)
        Base constructor.
        Parameters:
        alphabet - a String of characters making up the alphabet.
      • BasicAlphabetMapper

        public BasicAlphabetMapper​(char[] alphabet)
        Base constructor.
        Parameters:
        alphabet - an array of characters making up the alphabet.
    • Method Detail

      • getRadix

        public int getRadix()
        Description copied from interface: AlphabetMapper
        Return the number of characters in the alphabet.
        Specified by:
        getRadix in interface AlphabetMapper
        Returns:
        the radix for the alphabet.
      • convertToIndexes

        public byte[] convertToIndexes​(char[] input)
        Description copied from interface: AlphabetMapper
        Return the passed in char[] as a byte array of indexes (indexes can be more than 1 byte)
        Specified by:
        convertToIndexes in interface AlphabetMapper
        Parameters:
        input - characters to be mapped.
        Returns:
        an index array.
      • convertToChars

        public char[] convertToChars​(byte[] input)
        Description copied from interface: AlphabetMapper
        Return a char[] for this alphabet based on the indexes passed.
        Specified by:
        convertToChars in interface AlphabetMapper
        Parameters:
        input - input array of indexes.
        Returns:
        an array of char corresponding to the index values.