1/* GENERATED SOURCE. DO NOT MODIFY. */
2// © 2016 and later: Unicode, Inc. and others.
3// License & terms of use: http://www.unicode.org/copyright.html#License
4/*
5**********************************************************************
6*   Copyright (c) 2002, International Business Machines Corporation
7*   and others.  All Rights Reserved.
8**********************************************************************
9*   Date        Name        Description
10*   01/14/2002  aliu        Creation.
11**********************************************************************
12*/
13
14package android.icu.text;
15
16/**
17 * <code>UnicodeReplacer</code> defines a protocol for objects that
18 * replace a range of characters in a Replaceable string with output
19 * text.  The replacement is done via the Replaceable API so as to
20 * preserve out-of-band data.
21 * @author Alan Liu
22 */
23interface UnicodeReplacer {
24
25    /**
26     * Replace characters in 'text' from 'start' to 'limit' with the
27     * output text of this object.  Update the 'cursor' parameter to
28     * give the cursor position and return the length of the
29     * replacement text.
30     *
31     * @param text the text to be matched
32     * @param start inclusive start index of text to be replaced
33     * @param limit exclusive end index of text to be replaced;
34     * must be greater than or equal to start
35     * @param cursor output parameter for the cursor position.
36     * Not all replacer objects will update this, but in a complete
37     * tree of replacer objects, representing the entire output side
38     * of a transliteration rule, at least one must update it.
39     * @return the number of 16-bit code units in the text replacing
40     * the characters at offsets start..(limit-1) in text
41     */
42    public abstract int replace(Replaceable text,
43                                int start,
44                                int limit,
45                                int[] cursor);
46
47    /**
48     * Returns a string representation of this replacer.  If the
49     * result of calling this function is passed to the appropriate
50     * parser, typically TransliteratorParser, it will produce another
51     * replacer that is equal to this one.
52     * @param escapeUnprintable if TRUE then convert unprintable
53     * character to their hex escape representations, \\uxxxx or
54     * \\Uxxxxxxxx.  Unprintable characters are defined by
55     * Utility.isUnprintable().
56     */
57    public abstract String toReplacerPattern(boolean escapeUnprintable);
58
59    /**
60     * Union the set of all characters that may output by this object
61     * into the given set.
62     * @param toUnionTo the set into which to union the output characters
63     */
64    public abstract void addReplacementSetTo(UnicodeSet toUnionTo);
65}
66
67//eof
68