Top Description Fields Methods
com.ibm.icu.text

public Interface SymbolTable

Known Direct Implementers
com.ibm.icu.text.TransliteratorParser.ParseData, com.ibm.icu.text.UnicodeSet.XSymbolTable, com.ibm.icu.text.RBBISymbolTable
Imports
java.text.ParsePosition

An interface that defines both lookup protocol and parsing of symbolic names.

This interface is used by UnicodeSet to resolve $Variable style references that appear in set patterns. RBBI and Transliteration both independently implement this interface.

A symbol table maintains two kinds of mappings. The first is between symbolic names and their values. For example, if the variable with the name "start" is set to the value "alpha" (perhaps, though not necessarily, through an expression such as "$start=alpha"), then the call lookup("start") will return the char[] array ['a', 'l', 'p', 'h', 'a'].

The second kind of mapping is between character values and UnicodeMatcher objects. This is used by RuleBasedTransliterator, which uses characters in the private use area to represent objects such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z], then lookupMatcher(0xE015) will return the UnicodeSet [a-z].

Finally, a symbol table defines parsing behavior for symbolic names. All symbolic names start with the SYMBOL_REF character. When a parser encounters this character, it calls parseReference() with the position immediately following the SYMBOL_REF. The symbol table parses the name, if there is one, and returns it.

ICU Status
Stable since ICU 2.8.

Field Summary

Modifier and TypeField and Description
public static final char
SYMBOL_REF

The character preceding a symbol reference name.

Method Summary

Modifier and TypeMethod and Description
public char[]

Returns:

a char array containing the name's value, or null if there is no mapping for s.
lookup
(String
the symbolic name to lookup
s
)

Lookup the characters associated with this string and return it.

public UnicodeMatcher

Returns:

the UnicodeMatcher object represented by the given character, or null if there is no mapping for ch.
lookupMatcher
(int
a 32-bit code point from 0 to 0x10FFFF inclusive.
ch
)

Lookup the UnicodeMatcher associated with the given character, and return it.

public String

Returns:

the parsed name, or null if there is no valid symbolic name at the given position.
parseReference
(String
the text to parse for the name
text
,
ParsePosition
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. If the parse failed, pos is unchanged on exit.
pos
,
int
the index after the last character to be parsed.
limit
)

Parse a symbol reference name from the given string, starting at the given position.

Field Detail

SYMBOL_REFback to summary
public static final char SYMBOL_REF

The character preceding a symbol reference name.

ICU Status
Stable since ICU 2.8.

Method Detail

lookupback to summary
public char[] lookup(String s)

Lookup the characters associated with this string and return it. Return null if no such name exists. The resultant array may have length zero.

Parameters
s:String

the symbolic name to lookup

Returns:char[]

a char array containing the name's value, or null if there is no mapping for s.

ICU Status
Stable since ICU 2.8.
lookupMatcherback to summary
public UnicodeMatcher lookupMatcher(int ch)

Lookup the UnicodeMatcher associated with the given character, and return it. Return null if not found.

Parameters
ch:int

a 32-bit code point from 0 to 0x10FFFF inclusive.

Returns:UnicodeMatcher

the UnicodeMatcher object represented by the given character, or null if there is no mapping for ch.

ICU Status
Stable since ICU 2.8.
parseReferenceback to summary
public String parseReference(String text, ParsePosition pos, int limit)

Parse a symbol reference name from the given string, starting at the given position. If no valid symbol reference name is found, return null and leave pos unchanged. That is, if the character at pos cannot start a name, or if pos is at or after text.length(), then return null. This indicates an isolated SYMBOL_REF character.

Parameters
text:String

the text to parse for the name

pos:ParsePosition

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. If the parse failed, pos is unchanged on exit.

limit:int

the index after the last character to be parsed.

Returns:String

the parsed name, or null if there is no valid symbolic name at the given position.

ICU Status
Stable since ICU 2.8.