12ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* GENERATED SOURCE. DO NOT MODIFY. */ 22ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* 32ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ******************************************************************************* 4bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * Copyright (C) 2001-2016, International Business Machines Corporation and * 52ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * others. All Rights Reserved. * 62ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ******************************************************************************* 72ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 82ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpackage android.icu.text; 92ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/** 112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>UnicodeMatcher</code> defines a protocol for objects that can 122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * match a range of characters in a Replaceable string. 132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpublic interface UnicodeMatcher { 152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Constant returned by <code>matches()</code> indicating a 182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * mismatch between the text and this matcher. The text contains 192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a character which does not match, or the text does not contain 202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * all desired characters for a non-incremental match. 212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int U_MISMATCH = 0; 232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Constant returned by <code>matches()</code> indicating a 262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * partial match between the text and this matcher. This value is 272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * only returned for incremental match operations. All characters 282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of the text match, but more characters are required for a 292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * complete match. Alternatively, for variable-length matchers, 302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * all characters of the text match, and if more characters were 312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * supplied at limit, they might also match. 322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int U_PARTIAL_MATCH = 1; 342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Constant returned by <code>matches()</code> indicating a 372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * complete match between the text and this matcher. For an 382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * incremental variable-length match, this value is returned if 392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the given text matches, and it is known that additional 402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * characters would not alter the extent of the match. 412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int U_MATCH = 2; 432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 45bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * The character at index i, where i < contextStart || i >= contextLimit, 462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * is ETHER. This allows explicit matching by rules and UnicodeSets 472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of text outside the context. In traditional terms, this allows anchoring 482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * at the start and/or end. 492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final char ETHER = '\uFFFF'; 512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Return a UMatchDegree value indicating the degree of match for 542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the given text at the given offset. Zero, one, or more 552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * characters may be matched. 562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 57bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * Matching in the forward direction is indicated by limit > 582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * offset. Characters from offset forwards to limit-1 will be 592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * considered for matching. 602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 61bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * Matching in the reverse direction is indicated by limit < 622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * offset. Characters from offset backwards to limit+1 will be 632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * considered for matching. 642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * If limit == offset then the only match possible is a zero 662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * character match (which subclasses may implement if desired). 672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * If U_MATCH is returned, then as a side effect, advance the 692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * offset parameter to the limit of the matched substring. In the 702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * forward direction, this will be the index of the last matched 712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * character plus one. In the reverse direction, this will be the 722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * index of the last matched character minus one. 732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param text the text to be matched 752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param offset on input, the index into text at which to begin 762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * matching. On output, the limit of the matched text. The 772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * number of matched characters is the output value of offset 782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * minus the input value. Offset should always point to the 792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * HIGH SURROGATE (leading code unit) of a pair of surrogates, 802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * both on entry and upon return. 812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param limit the limit index of text to be matched. Greater 822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * than offset for a forward direction match, less than offset for 832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a backward direction match. The last character to be 842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * considered for matching will be text.charAt(limit-1) in the 852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * forward direction or text.charAt(limit+1) in the backward 862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * direction. 872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param incremental if TRUE, then assume further characters may 882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * be inserted at limit and check for partial matching. Otherwise 892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * assume the text as given is complete. 902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return a match degree value indicating a full match, a partial 912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * match, or a mismatch. If incremental is FALSE then 922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * U_PARTIAL_MATCH should never be returned. 932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract int matches(Replaceable text, 952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller int[] offset, 962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller int limit, 972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller boolean incremental); 982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns a string representation of this matcher. If the result of 1012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * calling this function is passed to the appropriate parser, it 1022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * will produce another matcher that is equal to this one. 1032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param escapeUnprintable if TRUE then convert unprintable 1042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * character to their hex escape representations, \\uxxxx or 1052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * \\Uxxxxxxxx. Unprintable characters are those other than 1062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * U+000A, U+0020..U+007E. 1072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract String toPattern(boolean escapeUnprintable); 1092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns TRUE if this matcher will match a character c, where c 112bfab1e7fec36dff93fb980c546ad64a565faf9fcPaul Duffin * & 0xFF == v, at offset, in the forward direction (with limit > 1132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * offset). This is used by <tt>RuleBasedTransliterator</tt> for 1142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * indexing. 1152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 1162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>Note: This API uses an int even though the value will be 1172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * restricted to 8 bits in order to avoid complications with 1182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * signedness (bytes convert to ints in the range -128..127). 1192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract boolean matchesIndexValue(int v); 1212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Union the set of all characters that may be matched by this object 1242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * into the given set. 1252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param toUnionTo the set into which to union the source characters 1262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public abstract void addMatchSetTo(UnicodeSet toUnionTo); 1282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller} 1292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller//eof 131