Class Transform


  • final class Transform
    extends java.lang.Object
    Transformations on dictionary words. Transform descriptor is a triplet: {prefix, operator, suffix}. "prefix" and "suffix" are short strings inserted before and after transformed dictionary word. "operator" is applied to dictionary word itself. Some operators has "built-in" parameters, i.e. parameter is defined by operator ordinal. Other operators have "external" parameters, supplied via additional table encoded in shared dictionary. Operators: - IDENTITY (0): dictionary word is inserted "as is" - OMIT_LAST_N (1 - 9): last N octets of dictionary word are not inserted; N == ordinal - OMIT_FIRST_M (12-20): first M octets of dictionary word are not inserted; M == ordinal - 11 - UPPERCASE_FIRST (10): first "scalar" is XOR'ed with number 32 - UPPERCASE_ALL (11): all "scalars" are XOR'ed with number 32 - SHIFT_FIRST (21): first "scalar" is shifted by number form parameter table - SHIFT_ALL (22): all "scalar" is shifted by number form parameter table Here "scalar" is a variable length character coding similar to UTF-8 encoding. UPPERCASE_XXX / SHIFT_XXX operators were designed to change the case of UTF-8 encoded characters. While UPPERCASE_XXX works well only on ASCII charset, SHIFT is much more generic and could be used for most (all?) alphabets.
    • Constructor Detail

      • Transform

        Transform()
    • Method Detail

      • unpackTransforms

        private static void unpackTransforms​(byte[] prefixSuffix,
                                             int[] prefixSuffixHeads,
                                             int[] transforms,
                                             java.lang.String prefixSuffixSrc,
                                             java.lang.String transformsSrc)
      • transformDictionaryWord

        static int transformDictionaryWord​(byte[] dst,
                                           int dstOffset,
                                           java.nio.ByteBuffer src,
                                           int srcOffset,
                                           int len,
                                           Transform.Transforms transforms,
                                           int transformIndex)