1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.wikimodel.util

File HtmlEntityUtil.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

8
265
7
2
503
332
11
0.04
37.86
3.5
1.57

Classes

Class Line # Actions
HtmlEntityUtil 32 262 0% 10 276
0.00%
HtmlEntityUtil.CharInfo 34 3 0% 1 4
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.wikimodel.util;
21   
22    import java.util.HashMap;
23    import java.util.Map;
24   
25    /**
26    * This class provides utility methods to access HTML entities with their
27    * respective descriptions and numerical codes.
28    *
29    * @version $Id: 59b90ba04bab71b28d0783153cf8fc6e05051b36 $
30    * @since 4.0M1
31    */
 
32    public class HtmlEntityUtil
33    {
 
34    private static class CharInfo
35    {
36    int fCode;
37   
38    String fDescription;
39   
40    String fSymbol;
41   
 
42  0 toggle CharInfo(String symbol, int code, String description)
43    {
44  0 fSymbol = symbol;
45  0 fCode = code;
46  0 fDescription = description;
47    }
48    }
49   
50    /**
51    * This map contains codes of entity symbols
52    */
53    private static Map fCodeMap = new HashMap();
54   
55    /**
56    * This map contains descriptions of entities
57    */
58    private static Map fSymbolMap = new HashMap();
59   
 
60  0 toggle static {
61    // For more information see http://www.w3.org/TR/WD-entities-961125
62  0 add("nbsp", 160, "no-break space");
63  0 add("iexcl", 161, "inverted exclamation mark");
64  0 add("cent", 162, "cent sign");
65  0 add("pound", 163, "pound sterling sign");
66  0 add("curren", 164, "general currency sign");
67  0 add("yen", 165, "yen sign");
68  0 add("brvbar", 166, "broken (vertical) bar");
69  0 add("sect", 167, "section sign");
70  0 add("uml", 168, "umlaut (dieresis)");
71  0 add("copy", 169, "copyright sign");
72  0 add("ordf", 170, "ordinal indicator, feminine");
73  0 add("laquo", 171, "angle quotation mark, left");
74  0 add("not", 172, "not sign");
75  0 add("shy", 173, "soft hyphen");
76  0 add("reg", 174, "registered sign");
77  0 add("macr", 175, "macron");
78  0 add("deg", 176, "degree sign");
79  0 add("plusmn", 177, "plus-or-minus sign");
80  0 add("sup2", 178, "superscript two");
81  0 add("sup3", 179, "superscript three");
82  0 add("acute", 180, "acute accent");
83  0 add("micro", 181, "micro sign");
84  0 add("para", 182, "pilcrow (paragraph sign)");
85  0 add("middot", 183, "middle dot");
86  0 add("cedil", 184, "cedilla");
87  0 add("sup1", 185, "superscript one");
88  0 add("ordm", 186, "ordinal indicator, masculine");
89  0 add("raquo", 187, "angle quotation mark, right");
90  0 add("frac14", 188, "fraction one-quarter");
91  0 add("frac12", 189, "fraction one-half");
92  0 add("frac34", 190, "fraction three-quarters");
93  0 add("iquest", 191, "inverted question mark");
94  0 add("Agrave", 192, "capital A, grave accent");
95  0 add("Aacute", 193, "capital A, acute accent");
96  0 add("Acirc", 194, "capital A, circumflex accent");
97  0 add("Atilde", 195, "capital A, tilde");
98  0 add("Auml", 196, "capital A, dieresis or umlaut mark");
99  0 add("Aring", 197, "capital A, ring");
100  0 add("AElig", 198, "capital AE diphthong (ligature)");
101  0 add("Ccedil", 199, "capital C, cedilla");
102  0 add("Egrave", 200, "capital E, grave accent");
103  0 add("Eacute", 201, "capital E, acute accent");
104  0 add("Ecirc", 202, "capital E, circumflex accent");
105  0 add("Euml", 203, "capital E, dieresis or umlaut mark");
106  0 add("Igrave", 204, "capital I, grave accent");
107  0 add("Iacute", 205, "capital I, acute accent");
108  0 add("Icirc", 206, "capital I, circumflex accent");
109  0 add("Iuml", 207, "capital I, dieresis or umlaut mark");
110  0 add("ETH", 208, "capital Eth, Icelandic");
111  0 add("Ntilde", 209, "capital N, tilde");
112  0 add("Ograve", 210, "capital O, grave accent");
113  0 add("Oacute", 211, "capital O, acute accent");
114  0 add("Ocirc", 212, "capital O, circumflex accent");
115  0 add("Otilde", 213, "capital O, tilde");
116  0 add("Ouml", 214, "capital O, dieresis or umlaut mark");
117  0 add("times", 215, "multiply sign");
118  0 add("Oslash", 216, "capital O, slash");
119  0 add("Ugrave", 217, "capital U, grave accent");
120  0 add("Uacute", 218, "capital U, acute accent");
121  0 add("Ucirc", 219, "capital U, circumflex accent");
122  0 add("Uuml", 220, "capital U, dieresis or umlaut mark");
123  0 add("Yacute", 221, "capital Y, acute accent");
124  0 add("THORN", 222, "capital THORN, Icelandic");
125  0 add("szlig", 223, "small sharp s, German (sz ligature)");
126  0 add("agrave", 224, "small a, grave accent");
127  0 add("aacute", 225, "small a, acute accent");
128  0 add("acirc", 226, "small a, circumflex accent");
129  0 add("atilde", 227, "small a, tilde");
130  0 add("auml", 228, "small a, dieresis or umlaut mark");
131  0 add("aring", 229, "small a, ring");
132  0 add("aelig", 230, "small ae diphthong (ligature)");
133  0 add("ccedil", 231, "small c, cedilla");
134  0 add("egrave", 232, "small e, grave accent");
135  0 add("eacute", 233, "small e, acute accent");
136  0 add("ecirc", 234, "small e, circumflex accent");
137  0 add("euml", 235, "small e, dieresis or umlaut mark");
138  0 add("igrave", 236, "small i, grave accent");
139  0 add("iacute", 237, "small i, acute accent");
140  0 add("icirc", 238, "small i, circumflex accent");
141  0 add("iuml", 239, "small i, dieresis or umlaut mark");
142  0 add("eth", 240, "small eth, Icelandic");
143  0 add("ntilde", 241, "small n, tilde");
144  0 add("ograve", 242, "small o, grave accent");
145  0 add("oacute", 243, "small o, acute accent");
146  0 add("ocirc", 244, "small o, circumflex accent");
147  0 add("otilde", 245, "small o, tilde");
148  0 add("ouml", 246, "small o, dieresis or umlaut mark");
149  0 add("divide", 247, "divide sign");
150  0 add("oslash", 248, "small o, slash");
151  0 add("ugrave", 249, "small u, grave accent");
152  0 add("uacute", 250, "small u, acute accent");
153  0 add("ucirc", 251, "small u, circumflex accent");
154  0 add("uuml", 252, "small u, dieresis or umlaut mark");
155  0 add("yacute", 253, "small y, acute accent");
156  0 add("thorn", 254, "small thorn, Icelandic");
157  0 add("yuml", 255, "small y, dieresis or umlaut mark");
158   
159    // Mathematical, Greek and Symbolic characters for HTML");
160    /*
161    * Portions International Organization for Standardization 1986:
162    * Permission to copy in any form is granted for use with conforming
163    * SGML systems and applications as defined in ISO 8879, provided this
164    * notice is included in all copies.
165    */
166   
167    /*
168    * Relevant ISO entity set is given unless names are newly introduced.
169    * New names (ie, not in ISO 8879 list) do not clash with any existing
170    * ISO 8879 entity names. Unicode character numbers are given for each
171    * character, in hex, and are identical for Unicode 1.1 and Unicode 2.0.
172    * CDATA values are decimal conversions of the Unicode values. Names are
173    * Unicode 2.0 names.
174    */
175   
176    // Latin Extended-B
177  0 add(
178    "fnof",
179    192,
180    "latin small f with hook, =function, =florin, U0192 ISOtech");
181   
182    // Greek
183  0 add("Alpha", 913, "greek capital letter alpha, U0391");
184  0 add("Beta", 914, "greek capital letter beta, U0392");
185  0 add("Gamma", 915, "greek capital letter gamma, U0393 ISOgrk3");
186  0 add("Delta", 916, "greek capital letter delta, U0394 ISOgrk3");
187  0 add("Epsilon", 917, "greek capital letter epsilon, U0395");
188  0 add("Zeta", 918, "greek capital letter zeta, U0396");
189  0 add("Eta", 919, "greek capital letter eta, U0397");
190  0 add("Theta", 920, "greek capital letter theta, U0398 ISOgrk3");
191  0 add("Iota", 921, "greek capital letter iota, U0399");
192  0 add("Kappa", 922, "greek capital letter kappa, U039A");
193  0 add("Lambda", 923, "greek capital letter lambda, U039B ISOgrk3");
194  0 add("Mu", 924, "greek capital letter mu, U039C");
195  0 add("Nu", 925, "greek capital letter nu, U039D");
196  0 add("Xi", 926, "greek capital letter xi, U039E ISOgrk3");
197  0 add("Omicron", 927, "greek capital letter omicron, U039F");
198  0 add("Pi", 928, "greek capital letter pi, U03A0 ISOgrk3");
199  0 add("Rho", 929, "greek capital letter rho, U03A1");
200    // there is no Sigmaf, and no U03A2 character either
201  0 add("Sigma", 931, "greek capital letter sigma, U03A3 ISOgrk3");
202  0 add("Tau", 932, "greek capital letter tau, U03A4");
203  0 add("Upsi", 933, "greek capital letter upsilon, U03A5 ISOgrk3");
204  0 add("Phi", 934, "greek capital letter phi, U03A6 ISOgrk3");
205  0 add("Chi", 935, "greek capital letter chi, U03A7");
206  0 add("Psi", 936, "greek capital letter psi, U03A8 ISOgrk3");
207  0 add("Omega", 937, "greek capital letter omega, U03A9 ISOgrk3");
208   
209  0 add("alpha", 945, "greek small letter alpha, U03B1 ISOgrk3");
210  0 add("beta", 946, "greek small letter beta, U03B2 ISOgrk3");
211  0 add("gamma", 947, "greek small letter gamma, U03B3 ISOgrk3");
212  0 add("delta", 948, "greek small letter delta, U03B4 ISOgrk3");
213  0 add("epsi", 949, "greek small letter epsilon, U03B5 ISOgrk3");
214    // why not 'epsilon' ?? how to remember which three are truncated??
215  0 add("zeta", 950, "greek small letter zeta, U03B6 ISOgrk3");
216  0 add("eta", 951, "greek small letter eta, U03B7 ISOgrk3");
217  0 add("theta", 952, "greek small letter theta, U03B8 ISOgrk3");
218  0 add("iota", 953, "greek small letter iota, U03B9 ISOgrk3");
219  0 add("kappa", 954, "greek small letter kappa, U03BA ISOgrk3");
220  0 add("lambda", 955, "greek small letter lambda, U03BB ISOgrk3");
221  0 add("mu", 956, "greek small letter mu, U03BC ISOgrk3");
222  0 add("nu", 957, "greek small letter nu, U03BD ISOgrk3");
223  0 add("xi", 958, "greek small letter xi, U03BE ISOgrk3");
224  0 add("omicron", 959, "greek small letter omicron, U03BF NEW");
225  0 add("pi", 960, "greek small letter pi, U03C0 ISOgrk3");
226  0 add("rho", 961, "greek small letter rho, U03C1 ISOgrk3");
227  0 add("sigmaf", 962, "greek small letter final sigma, U03C2 ISOgrk3");
228  0 add("sigma", 963, "greek small letter sigma, U03C3 ISOgrk3");
229  0 add("tau", 964, "greek small letter tau, U03C4 ISOgrk3");
230  0 add("upsi", 965, "greek small letter upsilon, U03C5 ISOgrk3");
231    // why not 'upsilon'
232  0 add("phi", 966, "greek small letter phi, U03C6 ISOgrk3");
233  0 add("chi", 967, "greek small letter chi, U03C7 ISOgrk3");
234  0 add("psi", 968, "greek small letter psi, U03C8 ISOgrk3");
235  0 add("omega", 969, "greek small letter omega, U03C9 ISOgrk3");
236  0 add("theta", 977, "greek small letter theta symbol, U03D1 NEW");
237  0 add("upsih", 978, "greek upsilon with hook symbol, U03D2 NEW");
238  0 add("piv", 982, "greek pi symbol, U03D6 ISOgrk3");
239   
240    // General Punctuation
241  0 add("bull", 8226, "bullet, =black small circle, U2022 ISOpub ");
242    // bullet is NOT the same as bullet operator, U2219
243  0 add(
244    "hellip",
245    8230,
246    "horizontal ellipsis, =three dot leader, U2026 ISOpub ");
247  0 add("prime", 8242, "prime, =minutes, =feet, U2032 ISOtech");
248  0 add("Prime", 8243, "double prime, =seconds, =inches, U2033 ISOtech");
249  0 add("oline", 8254, "overline, =spacing overscore, U203E NEW");
250  0 add("frasl", 8260, "fraction slash, U2044 NEW");
251   
252    // Letterlike Symbols
253  0 add(
254    "weierp",
255    8472,
256    "script capital P, =power set, =Weierstrass p, U2118 ISOamso");
257  0 add(
258    "image",
259    8465,
260    "blackletter capital I, =imaginary part, U2111 ISOamso");
261  0 add(
262    "real",
263    8476,
264    "blackletter capital R, =real part symbol, U211C ISOamso");
265  0 add("trade", 8482, "trade mark sign, U2122 ISOnum");
266  0 add(
267    "alefsym",
268    8501,
269    "alef symbol, =first transfinite cardinal, U2135 NEW");
270    // alef symbol is NOT the same as hebrew letter alef, U05D0 although the
271    // same glyph could be used to depict both characters
272   
273    // Arrows
274  0 add("larr", 8592, "leftwards arrow, U2190 ISOnum");
275  0 add("uarr", 8593, "upwards arrow, U2191 ISOnum");
276  0 add("rarr", 8594, "rightwards arrow, U2192 ISOnum");
277  0 add("darr", 8595, "downwards arrow, U2193 ISOnum");
278  0 add("harr", 8596, "left right arrow, U2194 ISOamsa");
279  0 add(
280    "crarr",
281    8629,
282    "downwards arrow with corner leftwards, =carriage return, U21B5 NEW");
283  0 add("lArr", 8656, "leftwards double arrow, U21D0 ISOtech");
284    // Unicode does not say that lArr is the same as the 'is implied by'
285    // arrow but also does not have any other character for that function.
286    // So ? lArr can be used for 'is implied by' as ISOtech suggests
287  0 add("uArr", 8657, "upwards double arrow, U21D1 ISOamsa");
288  0 add("rArr", 8658, "rightwards double arrow, U21D2 ISOtech");
289    // Unicode does not say this is the 'implies' character but does not
290    // have another character with this function so ? rArr can be used for
291    // 'implies' as ISOtech suggests
292  0 add("dArr", 8659, "downwards double arrow, U21D3 ISOamsa");
293  0 add("hArr", 8660, "left right double arrow, U21D4 ISOamsa");
294   
295    // Mathematical Operators
296  0 add("forall", 8704, "for all, U2200 ISOtech");
297  0 add("part", 8706, "partial differential, U2202 ISOtech ");
298  0 add("exist", 8707, "there exists, U2203 ISOtech");
299  0 add("empty", 8709, "empty set, =null set, =diameter, U2205 ISOamso");
300  0 add("nabla", 8711, "nabla, =backward difference, U2207 ISOtech");
301  0 add("isin", 8712, "element of, U2208 ISOtech");
302  0 add("notin", 8713, "not an element of, U2209 ISOtech");
303  0 add("ni", 8715, "contains as member, U220B ISOtech");
304    // should there be a more memorable name than 'ni'?
305  0 add("prod", 8719, "n-ary product, =product sign, U220F ISOamsb");
306    // prod is NOT the same character as U03A0 'greek capital letter pi'
307    // though the same glyph might be used for both
308  0 add("sum", 8722, "n-ary sumation, U2211 ISOamsb");
309    // sum is NOT the same character as U03A3 'greek capital letter sigma'
310    // though the same glyph might be used for both
311  0 add("minus", 8722, "minus sign, U2212 ISOtech");
312  0 add("lowast", 8727, "asterisk operator, U2217 ISOtech");
313  0 add("radic", 8730, "square root, =radical sign, U221A ISOtech");
314  0 add("prop", 8733, "proportional to, U221D ISOtech");
315  0 add("infin", 8734, "infinity, U221E ISOtech");
316  0 add("ang", 8736, "angle, U2220 ISOamso");
317  0 add("and", 8869, "logical and, =wedge, U2227 ISOtech");
318  0 add("or", 8870, "logical or, =vee, U2228 ISOtech");
319  0 add("cap", 8745, "intersection, =cap, U2229 ISOtech");
320  0 add("cup", 8746, "union, =cup, U222A ISOtech");
321  0 add("int", 8747, "integral, U222B ISOtech");
322  0 add("there4", 8756, "therefore, U2234 ISOtech");
323  0 add(
324    "sim",
325    8764,
326    "tilde operator, =varies with, =similar to, U223C ISOtech");
327    // tilde operator is NOT the same character as the tilde, U007E,
328    // although the same glyph might be used to represent both
329  0 add("cong", 8773, "approximately equal to, U2245 ISOtech");
330  0 add("asymp", 8773, "almost equal to, =asymptotic to, U2248 ISOamsr");
331  0 add("ne", 8800, "not equal to, U2260 ISOtech");
332  0 add("equiv", 8801, "identical to, U2261 ISOtech");
333  0 add("le", 8804, "less-than or equal to, U2264 ISOtech");
334  0 add("ge", 8805, "greater-than or equal to, U2265 ISOtech");
335  0 add("sub", 8834, "subset of, U2282 ISOtech");
336  0 add("sup", 8835, "superset of, U2283 ISOtech");
337    // note that nsup, 'not a superset of, U2283' is not covered by the
338    // Symbol font encoding and is not included. Should it be, for symmetry?
339    // It is in ISOamsn
340  0 add("nsub", 8836, "not a subset of, U2284 ISOamsn");
341  0 add("sube", 8838, "subset of or equal to, U2286 ISOtech");
342  0 add("supe", 8839, "superset of or equal to, U2287 ISOtech");
343  0 add("oplus", 8853, "circled plus, =direct sum, U2295 ISOamsb");
344  0 add("otimes", 8855, "circled times, =vector product, U2297 ISOamsb");
345  0 add(
346    "perp",
347    8869,
348    "up tack, =orthogonal to, =perpendicular, U22A5 ISOtech");
349  0 add("sdot", 8901, "dot operator, U22C5 ISOamsb");
350    // dot operator is NOT the same character as U00B7 middle dot
351   
352    // Miscellaneous Technical
353  0 add("lceil", 8968, "left ceiling, =apl upstile, U2308, ISOamsc ");
354  0 add("rceil", 8969, "right ceiling, U2309, ISOamsc ");
355  0 add("lfloor", 8970, "left floor, =apl downstile, U230A, ISOamsc ");
356  0 add("rfloor", 8971, "right floor, U230B, ISOamsc ");
357  0 add("lang", 9001, "left-pointing angle bracket, =bra, U2329 ISOtech");
358    // lang is NOT the same character as U003C 'less than' or U2039 'single
359    // left-pointing angle quotation mark'
360  0 add("rang", 9002, "right-pointing angle bracket, =ket, U232A ISOtech");
361    // rang is NOT the same character as U003E 'greater than' or U203A
362    // 'single right-pointing angle quotation mark'
363   
364    // Geometric Shapes
365  0 add("loz", 9674, "lozenge, U25CA ISOpub");
366   
367    // Miscellaneous Symbols
368  0 add("spades", 9824, "black spade suit, U2660 ISOpub");
369    // black here seems to mean filled as opposed to hollow
370  0 add("clubs", 9827, "black club suit, =shamrock, U2663 ISOpub");
371  0 add("hearts", 9829, "black heart suit, =valentine, U2665 ISOpub");
372  0 add("diams", 9830, "black diamond suit, U2666 ISOpub");
373   
374    // Appendix C: Character Entities for special symbols and BIDI text
375   
376    // Special characters for HTML
377   
378    // Character entity set.
379   
380    /*
381    * Portions International Organization for Standardization 1986:
382    * Permission to copy in any form is granted for use with conforming
383    * SGML systems and applications as defined in ISO 8879, provided this
384    * notice is included in all copies.
385    */
386   
387    /*
388    * Relevant ISO entity set is given unless names are newly introduced.
389    * New names (ie, not in ISO 8879 list) do not clash with any existing
390    * ISO 8879 entity names. Unicode character numbers are given for each
391    * character, in hex, and are identical for Unicode 1.1 and Unicode 2.0.
392    * CDATA values are decimal conversions of the Unicode values. Names are
393    * Unicode 2.0 names. C0 Controls and Basic Latin
394    */
395  0 add("quot", 34, "quotation mark, =apl quote, U0022 ISOnum");
396  0 add("amp", 38, "ampersand, U0026 ISOnum");
397  0 add("lt", 60, "less-than sign, U003C ISOnum");
398  0 add("gt", 62, "greater-than sign, U003E ISOnum");
399   
400    // Latin Extended-A
401  0 add("OElig", 338, "latin capital ligature oe, U0152 ISOlat2");
402  0 add("oelig", 339, "latin small ligature oe, U0153 ISOlat2");
403    // ligature is a misnomer, this is a separate character in some
404    // languages
405  0 add("Scaron", 352, "latin capital letter s with caron, U0160 ISOlat2");
406  0 add("scaron", 353, "latin small letter s with caron, U0161 ISOlat2");
407  0 add("Yuml", 376, "latin capital letter y with diaeresis, U0178 ISOlat2");
408   
409    // Spacing Modifier Letters
410  0 add("circ", 710, "modifier letter circumflex accent, U02C6 ISOpub");
411  0 add("tilde", 732, "small tilde, U02DC ISOdia");
412   
413    // General Punctuation");
414  0 add("ensp", 8194, "en space, U2002 ISOpub");
415  0 add("emsp", 8195, "em space, U2003 ISOpub");
416  0 add("thinsp", 8201, "thin space, U2009 ISOpub");
417  0 add("zwnj", 8204, "zero width non-joiner, U200C NEW RFC 2070");
418  0 add("zwj", 8205, "zero width joiner, U200D NEW RFC 2070");
419  0 add("lrm", 8206, "left-to-right mark, U200E NEW RFC 2070");
420  0 add("rlm", 8207, "right-to-left mark, U200F NEW RFC 2070");
421  0 add("ndash", 8211, "en dash, U2013 ISOpub");
422  0 add("mdash", 8212, "em dash, U2014 ISOpub");
423  0 add("lsquo", 8216, "left single quotation mark, U2018 ISOnum");
424  0 add("rsquo", 8217, "right single quotation mark, U2019 ISOnum");
425  0 add("sbquo", 8218, "single low-9 quotation mark, U201A NEW");
426  0 add("ldquo", 8220, "left double quotation mark, U201C ISOnum");
427  0 add("rdquo", 8221, "right double quotation mark, U201D ISOnum");
428  0 add("bdquo", 8222, "double low-9 quotation mark, U201E NEW");
429  0 add("dagger", 8224, "dagger, U2020 ISOpub");
430  0 add("Dagger", 8225, "double dagger, U2021 ISOpub");
431  0 add("permil", 8240, "per mille sign, U2030 ISOtech");
432  0 add(
433    "lsaquo",
434    8249,
435    "single left-pointing angle quotation mark, U2039 ISO proposed");
436    // lsaquo is proposed but not yet ISO standardised");
437  0 add(
438    "rsaquo",
439    8250,
440    "single right-pointing angle quotation mark, U203A ISO proposed");
441    // rsaquo is proposed but not yet ISO standardised");
442   
443    }
444   
 
445  0 toggle private static void add(String symbol, int code, String descr)
446    {
447  0 CharInfo info = new CharInfo(symbol, code, descr);
448  0 fCodeMap.put(code, info);
449  0 fSymbolMap.put(symbol, info);
450    }
451   
452    /**
453    * A character corresponding to the given symbol.
454    *
455    * @param symbol for this symbol the corresponding character will be
456    * returned
457    * @return a character corresponding to the given symbol
458    */
 
459  0 toggle public static char getChar(String symbol)
460    {
461  0 CharInfo info = (CharInfo) fSymbolMap.get(symbol);
462  0 return (info != null) ? (char) info.fCode : '\0';
463    }
464   
465    /**
466    * Returns description of the given character
467    *
468    * @param ch for this character the corresponding description will be
469    * returned
470    * @return description of the given character
471    */
 
472  0 toggle public static String getDescription(char ch)
473    {
474  0 CharInfo info = (CharInfo) fCodeMap.get(Integer.valueOf(ch));
475  0 return (info != null) ? info.fDescription : null;
476    }
477   
478    /**
479    * Returns description of the given symbol.
480    *
481    * @param symbol for this symbol the corresponding description will be
482    * returned
483    * @return description of the given symbol
484    */
 
485  0 toggle public static String getDescription(String symbol)
486    {
487  0 CharInfo info = (CharInfo) fSymbolMap.get(symbol);
488  0 return (info != null) ? info.fDescription : null;
489    }
490   
491    /**
492    * Returns a symbol corresponding to the given character or
493    * <code>null</code> if nothing was found
494    *
495    * @param ch for this character the corresponding symbol will be returned
496    * @return a symbol corresponding to the given character
497    */
 
498  0 toggle public static String getSymbol(char ch)
499    {
500  0 CharInfo info = (CharInfo) fCodeMap.get(Integer.valueOf(ch));
501  0 return (info != null) ? info.fSymbol : null;
502    }
503    }