Showing the changes to java/pkg/sun/text/normalizer/SymbolTable.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,119 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2005, 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 | +public interface SymbolTable { | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * The character preceding a symbol reference name. | |
| 72 | + * @draft ICU 2.8 | |
| 73 | + * @deprecated This is a draft API and might change in a future release of ICU. | |
| 74 | + */ | |
| 75 | + static final char SYMBOL_REF = '$'; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Lookup the characters associated with this string and return it. | |
| 79 | + * Return <tt>null</tt> if no such name exists. The resultant | |
| 80 | + * array may have length zero. | |
| 81 | + * @param s the symbolic name to lookup | |
| 82 | + * @return a char array containing the name's value, or null if | |
| 83 | + * there is no mapping for s. | |
| 84 | + * @draft ICU 2.8 | |
| 85 | + * @deprecated This is a draft API and might change in a future release of ICU. | |
| 86 | + */ | |
| 87 | + char[] lookup(String s); | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * Lookup the UnicodeMatcher associated with the given character, and | |
| 91 | + * return it. Return <tt>null</tt> if not found. | |
| 92 | + * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. | |
| 93 | + * @return the UnicodeMatcher object represented by the given | |
| 94 | + * character, or null if there is no mapping for ch. | |
| 95 | + * @draft ICU 2.8 | |
| 96 | + * @deprecated This is a draft API and might change in a future release of ICU. | |
| 97 | + */ | |
| 98 | + UnicodeMatcher lookupMatcher(int ch); | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * Parse a symbol reference name from the given string, starting | |
| 102 | + * at the given position. If no valid symbol reference name is | |
| 103 | + * found, return null and leave pos unchanged. That is, if the | |
| 104 | + * character at pos cannot start a name, or if pos is at or after | |
| 105 | + * text.length(), then return null. This indicates an isolated | |
| 106 | + * SYMBOL_REF character. | |
| 107 | + * @param text the text to parse for the name | |
| 108 | + * @param pos on entry, the index of the first character to parse. | |
| 109 | + * This is the character following the SYMBOL_REF character. On | |
| 110 | + * exit, the index after the last parsed character. If the parse | |
| 111 | + * failed, pos is unchanged on exit. | |
| 112 | + * @param limit the index after the last character to be parsed. | |
| 113 | + * @return the parsed name, or null if there is no valid symbolic | |
| 114 | + * name at the given position. | |
| 115 | + * @draft ICU 2.8 | |
| 116 | + * @deprecated This is a draft API and might change in a future release of ICU. | |
| 117 | + */ | |
| 118 | + String parseReference(String text, ParsePosition pos, int limit); | |
| 119 | +} | |