Class HighLevelEncoder


  • public final class HighLevelEncoder
    extends java.lang.Object
    This produces nearly optimal encodings of text into the first-level of encoding used by Aztec code. It uses a dynamic algorithm. For each prefix of the string, it determines a set of encodings that could lead to this prefix. We repeatedly add a character and generate a new set of optimal encodings until we have read through the entire input.
    • Field Detail

      • MODE_NAMES

        static final java.lang.String[] MODE_NAMES
      • LATCH_TABLE

        static final int[][] LATCH_TABLE
      • CHAR_MAP

        private static final int[][] CHAR_MAP
      • SHIFT_TABLE

        static final int[][] SHIFT_TABLE
      • text

        private final byte[] text
      • charset

        private final java.nio.charset.Charset charset
    • Constructor Detail

      • HighLevelEncoder

        public HighLevelEncoder​(byte[] text)
      • HighLevelEncoder

        public HighLevelEncoder​(byte[] text,
                                java.nio.charset.Charset charset)
    • Method Detail

      • encode

        public BitArray encode()
        Returns:
        text represented by this encoder encoded as a BitArray
      • updateStateListForChar

        private java.util.Collection<State> updateStateListForChar​(java.lang.Iterable<State> states,
                                                                   int index)
      • updateStateForChar

        private void updateStateForChar​(State state,
                                        int index,
                                        java.util.Collection<State> result)
      • updateStateListForPair

        private static java.util.Collection<State> updateStateListForPair​(java.lang.Iterable<State> states,
                                                                          int index,
                                                                          int pairCode)
      • updateStateForPair

        private static void updateStateForPair​(State state,
                                               int index,
                                               int pairCode,
                                               java.util.Collection<State> result)
      • simplifyStates

        private static java.util.Collection<State> simplifyStates​(java.lang.Iterable<State> states)