Stay organized with collections
Save and categorize content based on your preferences.
SymbolTable
public
interface
SymbolTable
android.icu.text.SymbolTable
|
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.
Summary
Constants |
char |
SYMBOL_REF
The character preceding a symbol reference name.
|
Public methods |
abstract
char[]
|
lookup(String s)
Lookup the characters associated with this string and return it.
|
abstract
UnicodeMatcher
|
lookupMatcher(int ch)
Lookup the UnicodeMatcher associated with the given character, and
return it.
|
abstract
String
|
parseReference(String text, ParsePosition pos, int limit)
Parse a symbol reference name from the given string, starting
at the given position.
|
Constants
SYMBOL_REF
public static final char SYMBOL_REF
The character preceding a symbol reference name.
Constant Value:
36
(0x00000024)
Public methods
lookup
public abstract 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. |
lookupMatcher
public abstract 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. |
parseReference
public abstract 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. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# SymbolTable\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nSymbolTable\n===========\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/icu/text/SymbolTable \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nSymbolTable\n`\n\n\n`\n\n\n`\n\n|------------------------------|\n| android.icu.text.SymbolTable |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAn interface that defines both lookup protocol and parsing of\nsymbolic names.\n\nThis interface is used by UnicodeSet to resolve $Variable style\nreferences that appear in set patterns. RBBI and Transliteration\nboth independently implement this interface.\n\nA symbol table maintains two kinds of mappings. The first is\nbetween symbolic names and their values. For example, if the\nvariable with the name \"start\" is set to the value \"alpha\"\n(perhaps, though not necessarily, through an expression such as\n\"$start=alpha\"), then the call lookup(\"start\") will return the\nchar\\[\\] array \\['a', 'l', 'p', 'h', 'a'\\].\n\nThe second kind of mapping is between character values and\nUnicodeMatcher objects. This is used by RuleBasedTransliterator,\nwhich uses characters in the private use area to represent objects\nsuch as UnicodeSets. If U+E015 is mapped to the UnicodeSet \\[a-z\\],\nthen lookupMatcher(0xE015) will return the UnicodeSet \\[a-z\\].\n\nFinally, a symbol table defines parsing behavior for symbolic\nnames. All symbolic names start with the SYMBOL_REF character.\nWhen a parser encounters this character, it calls parseReference()\nwith the position immediately following the SYMBOL_REF. The symbol\ntable parses the name, if there is one, and returns it.\n\nSummary\n-------\n\n| ### Constants ||\n|--------|-------------------------------------------------------------------------------------------------------------------|\n| `char` | [SYMBOL_REF](/reference/android/icu/text/SymbolTable#SYMBOL_REF) The character preceding a symbol reference name. |\n\n| ### Public methods ||\n|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract char[]` | ` `[lookup](/reference/android/icu/text/SymbolTable#lookup(java.lang.String))`(`[String](/reference/java/lang/String)` s) ` Lookup the characters associated with this string and return it. |\n| ` abstract `[UnicodeMatcher](/reference/android/icu/text/UnicodeMatcher) | ` `[lookupMatcher](/reference/android/icu/text/SymbolTable#lookupMatcher(int))`(int ch) ` Lookup the UnicodeMatcher associated with the given character, and return it. |\n| ` abstract `[String](/reference/java/lang/String) | ` `[parseReference](/reference/android/icu/text/SymbolTable#parseReference(java.lang.String,%20java.text.ParsePosition,%20int))`(`[String](/reference/java/lang/String)` text, `[ParsePosition](/reference/java/text/ParsePosition)` pos, int limit) ` Parse a symbol reference name from the given string, starting at the given position. |\n\nConstants\n---------\n\n### SYMBOL_REF\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static final char SYMBOL_REF\n```\n\nThe character preceding a symbol reference name.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n36\n(0x00000024)\n\n\nPublic methods\n--------------\n\n### lookup\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract char[] lookup (String s)\n```\n\nLookup the characters associated with this string and return it.\nReturn null if no such name exists. The resultant\narray may have length zero.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----|----------------------------------------------|\n| `s` | `String`: the symbolic name to lookup \u003cbr /\u003e |\n\n| Returns ||\n|----------|----------------------------------------------------------------------------------------|\n| `char[]` | a char array containing the name's value, or null if there is no mapping for s. \u003cbr /\u003e |\n\n### lookupMatcher\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract UnicodeMatcher lookupMatcher (int ch)\n```\n\nLookup the UnicodeMatcher associated with the given character, and\nreturn it. Return null if not found.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------|-----------------------------------------------------------------|\n| `ch` | `int`: a 32-bit code point from 0 to 0x10FFFF inclusive. \u003cbr /\u003e |\n\n| Returns ||\n|--------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|\n| [UnicodeMatcher](/reference/android/icu/text/UnicodeMatcher) | the UnicodeMatcher object represented by the given character, or null if there is no mapping for ch. \u003cbr /\u003e |\n\n### parseReference\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract String parseReference (String text, \n ParsePosition pos, \n int limit)\n```\n\nParse a symbol reference name from the given string, starting\nat the given position. If no valid symbol reference name is\nfound, return null and leave pos unchanged. That is, if the\ncharacter at pos cannot start a name, or if pos is at or after\ntext.length(), then return null. This indicates an isolated\nSYMBOL_REF character.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `text` | `String`: the text to parse for the name \u003cbr /\u003e |\n| `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. \u003cbr /\u003e |\n| `limit` | `int`: the index after the last character to be parsed. \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------|-------------------------------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | the parsed name, or null if there is no valid symbolic name at the given position. \u003cbr /\u003e |"]]