1 /* 2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 /* 27 ******************************************************************************* 28 * (C) Copyright IBM Corp. 1996-2005 - All Rights Reserved * 29 * * 30 * The original version of this source code and documentation is copyrighted * 31 * and owned by IBM, These materials are provided under terms of a License * 32 * Agreement between IBM and Sun. This technology is protected by multiple * 33 * US and International patents. This notice and attribution to IBM may not * 34 * to removed. * 35 ******************************************************************************* 36 */ 37 38 package sun.text.normalizer; 39 40 import java.text.ParsePosition; 41 42 /** 43 * An interface that defines both lookup protocol and parsing of 44 * symbolic names. 45 * 46 * <p>A symbol table maintains two kinds of mappings. The first is 47 * between symbolic names and their values. For example, if the 48 * variable with the name "start" is set to the value "alpha" 49 * (perhaps, though not necessarily, through an expression such as 50 * "$start=alpha"), then the call lookup("start") will return the 51 * char[] array ['a', 'l', 'p', 'h', 'a']. 52 * 53 * <p>The second kind of mapping is between character values and 54 * UnicodeMatcher objects. This is used by RuleBasedTransliterator, 55 * which uses characters in the private use area to represent objects 56 * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z], 57 * then lookupMatcher(0xE015) will return the UnicodeSet [a-z]. 58 * 59 * <p>Finally, a symbol table defines parsing behavior for symbolic 60 * names. All symbolic names start with the SYMBOL_REF character. 61 * When a parser encounters this character, it calls parseReference() 62 * with the position immediately following the SYMBOL_REF. The symbol 63 * table parses the name, if there is one, and returns it. 64 * 65 * @draft ICU 2.8 66 * @deprecated This is a draft API and might change in a future release of ICU. 67 */ 68 @Deprecated 69 public interface SymbolTable { 70 71 /** 72 * The character preceding a symbol reference name. 73 * @draft ICU 2.8 74 * @deprecated This is a draft API and might change in a future release of ICU. 75 */ 76 @Deprecated 77 static final char SYMBOL_REF = '$'; 78 79 /** 80 * Lookup the characters associated with this string and return it. 81 * Return {@code null} if no such name exists. The resultant 82 * array may have length zero. 83 * @param s the symbolic name to lookup 84 * @return a char array containing the name's value, or null if 85 * there is no mapping for s. 86 * @draft ICU 2.8 87 * @deprecated This is a draft API and might change in a future release of ICU. 88 */ 89 @Deprecated 90 char[] lookup(String s); 91 92 /** 93 * Lookup the UnicodeMatcher associated with the given character, and 94 * return it. Return {@code null} if not found. 95 * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. 96 * @return the UnicodeMatcher object represented by the given 97 * character, or null if there is no mapping for ch. 98 * @draft ICU 2.8 99 * @deprecated This is a draft API and might change in a future release of ICU. 100 */ 101 @Deprecated 102 UnicodeMatcher lookupMatcher(int ch); 103 104 /** 105 * Parse a symbol reference name from the given string, starting 106 * at the given position. If no valid symbol reference name is 107 * found, return null and leave pos unchanged. That is, if the 108 * character at pos cannot start a name, or if pos is at or after 109 * text.length(), then return null. This indicates an isolated 110 * SYMBOL_REF character. 111 * @param text the text to parse for the name 112 * @param pos on entry, the index of the first character to parse. 113 * This is the character following the SYMBOL_REF character. On 114 * exit, the index after the last parsed character. If the parse 115 * failed, pos is unchanged on exit. 116 * @param limit the index after the last character to be parsed. 117 * @return the parsed name, or null if there is no valid symbolic 118 * name at the given position. 119 * @draft ICU 2.8 120 * @deprecated This is a draft API and might change in a future release of ICU. 121 */ 122 @Deprecated 123 String parseReference(String text, ParsePosition pos, int limit); 124 }