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