Class Normalizer2Impl.ReorderingBuffer

  • All Implemented Interfaces:
    Appendable
    Enclosing class:
    Normalizer2Impl

    public static final class Normalizer2Impl.ReorderingBuffer
    extends Object
    implements Appendable
    Writable buffer that takes care of canonical ordering. Its Appendable methods behave like the C++ implementation's appendZeroCC() methods.

    If dest is a StringBuilder, then the buffer writes directly to it. Otherwise, the buffer maintains a StringBuilder for intermediate text segments until no further changes are necessary and whole segments are appended. append() methods that take combining-class values always write to the StringBuilder. Other append() methods flush and append to the Appendable.

    • Method Detail

      • isEmpty

        public boolean isEmpty()
      • length

        public int length()
      • getLastCC

        public int getLastCC()
      • equals

        public boolean equals​(CharSequence s,
                              int start,
                              int limit)
      • setLastChar

        public void setLastChar​(char c)
      • append

        public void append​(int c,
                           int cc)
      • append

        public void append​(CharSequence s,
                           int start,
                           int limit,
                           int leadCC,
                           int trailCC)
      • appendZeroCC

        public void appendZeroCC​(int c)
      • append

        public Normalizer2Impl.ReorderingBuffer append​(CharSequence s)
        Description copied from interface: Appendable
        Appends the character sequence csq. Implementation classes may not append the whole sequence, for example if the target is a buffer with limited size.

        If csq is null, the characters "null" are appended.

        Specified by:
        append in interface Appendable
        Parameters:
        s - the character sequence to append.
        Returns:
        this Appendable.
      • append

        public Normalizer2Impl.ReorderingBuffer append​(CharSequence s,
                                                       int start,
                                                       int limit)
        Description copied from interface: Appendable
        Appends a subsequence of csq.

        If csq is not null then calling this method is equivalent to calling append(csq.subSequence(start, end)).

        If csq is null, the characters "null" are appended.

        Specified by:
        append in interface Appendable
        Parameters:
        s - the character sequence to append.
        start - the first index of the subsequence of csq that is appended.
        limit - the last index of the subsequence of csq that is appended.
        Returns:
        this Appendable.
      • flush

        public void flush()
        Flushes from the intermediate StringBuilder to the Appendable, if they are different objects. Used after recomposition. Must be called at the end when writing to a non-StringBuilder Appendable.
      • flushAndAppendZeroCC

        public Normalizer2Impl.ReorderingBuffer flushAndAppendZeroCC​(CharSequence s,
                                                                     int start,
                                                                     int limit)
        Flushes from the intermediate StringBuilder to the Appendable, if they are different objects. Then appends the new text to the Appendable or StringBuilder. Normally used after quick check loops find a non-empty sequence.
      • remove

        public void remove()
      • removeSuffix

        public void removeSuffix​(int suffixLength)