2000-03-10 04:07:32 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
|
|
|
* Copyright (C) 1996-2000, International Business Machines Corporation and *
|
|
|
|
* others. All Rights Reserved. *
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/SymbolTable.java,v $
|
2000-04-25 01:42:58 +00:00
|
|
|
* $Date: 2000/04/25 01:42:58 $
|
|
|
|
* $Revision: 1.4 $
|
2000-03-10 04:07:32 +00:00
|
|
|
*
|
|
|
|
*****************************************************************************************
|
|
|
|
*/
|
2000-02-03 18:10:05 +00:00
|
|
|
package com.ibm.text;
|
2000-04-21 22:16:29 +00:00
|
|
|
import java.text.ParsePosition;
|
2000-02-03 18:10:05 +00:00
|
|
|
|
|
|
|
/**
|
2000-04-21 22:16:29 +00:00
|
|
|
* An interface that maps strings to objects. This interface defines
|
|
|
|
* both lookup protocol and parsing. This allows different components
|
|
|
|
* to share a symbol table and to handle name parsing uniformly. It
|
|
|
|
* is expected that client parse code look for the SYMBOL_REF
|
|
|
|
* character and, when seen, attempt to parse the characters after it
|
|
|
|
* using parseReference().
|
|
|
|
*
|
|
|
|
* <p>Currently, RuleBasedTransliterator and UnicodeSet use this
|
|
|
|
* interface to share variable definitions.
|
2000-02-03 18:10:05 +00:00
|
|
|
*/
|
|
|
|
public interface SymbolTable {
|
|
|
|
|
2000-04-21 22:16:29 +00:00
|
|
|
/**
|
|
|
|
* The character preceding a symbol reference name.
|
|
|
|
*/
|
|
|
|
final char SYMBOL_REF = '$';
|
|
|
|
|
2000-02-03 18:10:05 +00:00
|
|
|
/**
|
2000-04-25 01:42:58 +00:00
|
|
|
* Lookup the characters associated with this string and return it.
|
|
|
|
* Return <tt>null</tt> if no such name exists. The resultant
|
|
|
|
* array may have length zero.
|
2000-02-03 18:10:05 +00:00
|
|
|
*/
|
2000-04-25 01:42:58 +00:00
|
|
|
char[] lookup(String s);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lookup the UnicodeSet associated with the given character, and
|
|
|
|
* return it. Return <tt>null</tt> if not found.
|
|
|
|
*/
|
|
|
|
UnicodeSet lookupSet(char ch);
|
2000-04-21 22:16:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse a symbol reference name from the given string, starting
|
|
|
|
* at the given position. If no valid symbol reference name is
|
|
|
|
* found, throw an exception.
|
|
|
|
* @param text the text to parse for the name
|
|
|
|
* @param pos on entry, the index of the first character to parse.
|
|
|
|
* This is the character following the SYMBOL_REF character. On
|
|
|
|
* exit, the index after the last parsed character.
|
|
|
|
* @param limit the index after the last character to be parsed.
|
|
|
|
* @return the parsed name.
|
|
|
|
* @exception IllegalArgumentException if no valid name is found.
|
|
|
|
*/
|
|
|
|
String parseReference(String text, ParsePosition pos, int limit);
|
2000-02-03 18:10:05 +00:00
|
|
|
}
|