src/share/classes/com/sun/tools/doclint/Entity.java

Tue, 17 Sep 2013 14:17:13 -0700

author
jjg
date
Tue, 17 Sep 2013 14:17:13 -0700
changeset 2033
fdfbc5f0c4ed
parent 1506
4a3cfc970c6f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8024538: -Xdoclint + -Xprefer:source + incremental compilation == FAIL
Reviewed-by: darcy

jjg@1455 1 /*
jjg@1506 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
jjg@1455 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@1455 4 *
jjg@1455 5 * This code is free software; you can redistribute it and/or modify it
jjg@1455 6 * under the terms of the GNU General Public License version 2 only, as
jjg@1455 7 * published by the Free Software Foundation. Oracle designates this
jjg@1455 8 * particular file as subject to the "Classpath" exception as provided
jjg@1455 9 * by Oracle in the LICENSE file that accompanied this code.
jjg@1455 10 *
jjg@1455 11 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@1455 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@1455 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@1455 14 * version 2 for more details (a copy is included in the LICENSE file that
jjg@1455 15 * accompanied this code).
jjg@1455 16 *
jjg@1455 17 * You should have received a copy of the GNU General Public License version
jjg@1455 18 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@1455 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@1455 20 *
jjg@1455 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jjg@1455 22 * or visit www.oracle.com if you need additional information or have any
jjg@1455 23 * questions.
jjg@1455 24 */
jjg@1455 25
jjg@1455 26 package com.sun.tools.doclint;
jjg@1455 27
jjg@1455 28 import java.util.HashMap;
jjg@1455 29 import java.util.Map;
jjg@1455 30
jjg@1455 31 /**
jjg@1455 32 * Table of entities defined in HTML 4.01.
jjg@1455 33 *
jjg@1455 34 * <p> Derived from
jjg@1455 35 * <a href="http://www.w3.org/TR/html4/sgml/entities.html">Character entity references in HTML 4</a>.
jjg@1455 36 *
jjg@1455 37 * The name of the member follows the name of the entity,
jjg@1455 38 * except when it clashes with a keyword, in which case
jjg@1455 39 * it is prefixed by '_'.
jjg@1455 40 *
jjg@1455 41 * <p><b>This is NOT part of any supported API.
jjg@1455 42 * If you write code that depends on this, you do so at your own
jjg@1455 43 * risk. This code and its internal interfaces are subject to change
jjg@1455 44 * or deletion without notice.</b></p>
jjg@1455 45 */
jjg@1506 46 public enum Entity {
jjg@1455 47 nbsp(160),
jjg@1455 48 iexcl(161),
jjg@1455 49 cent(162),
jjg@1455 50 pound(163),
jjg@1455 51 curren(164),
jjg@1455 52 yen(165),
jjg@1455 53 brvbar(166),
jjg@1455 54 sect(167),
jjg@1455 55 uml(168),
jjg@1455 56 copy(169),
jjg@1455 57 ordf(170),
jjg@1455 58 laquo(171),
jjg@1455 59 not(172),
jjg@1455 60 shy(173),
jjg@1455 61 reg(174),
jjg@1455 62 macr(175),
jjg@1455 63 deg(176),
jjg@1455 64 plusmn(177),
jjg@1455 65 sup2(178),
jjg@1455 66 sup3(179),
jjg@1455 67 acute(180),
jjg@1455 68 micro(181),
jjg@1455 69 para(182),
jjg@1455 70 middot(183),
jjg@1455 71 cedil(184),
jjg@1455 72 sup1(185),
jjg@1455 73 ordm(186),
jjg@1455 74 raquo(187),
jjg@1455 75 frac14(188),
jjg@1455 76 frac12(189),
jjg@1455 77 frac34(190),
jjg@1455 78 iquest(191),
jjg@1455 79 Agrave(192),
jjg@1455 80 Aacute(193),
jjg@1455 81 Acirc(194),
jjg@1455 82 Atilde(195),
jjg@1455 83 Auml(196),
jjg@1455 84 Aring(197),
jjg@1455 85 AElig(198),
jjg@1455 86 Ccedil(199),
jjg@1455 87 Egrave(200),
jjg@1455 88 Eacute(201),
jjg@1455 89 Ecirc(202),
jjg@1455 90 Euml(203),
jjg@1455 91 Igrave(204),
jjg@1455 92 Iacute(205),
jjg@1455 93 Icirc(206),
jjg@1455 94 Iuml(207),
jjg@1455 95 ETH(208),
jjg@1455 96 Ntilde(209),
jjg@1455 97 Ograve(210),
jjg@1455 98 Oacute(211),
jjg@1455 99 Ocirc(212),
jjg@1455 100 Otilde(213),
jjg@1455 101 Ouml(214),
jjg@1455 102 times(215),
jjg@1455 103 Oslash(216),
jjg@1455 104 Ugrave(217),
jjg@1455 105 Uacute(218),
jjg@1455 106 Ucirc(219),
jjg@1455 107 Uuml(220),
jjg@1455 108 Yacute(221),
jjg@1455 109 THORN(222),
jjg@1455 110 szlig(223),
jjg@1455 111 agrave(224),
jjg@1455 112 aacute(225),
jjg@1455 113 acirc(226),
jjg@1455 114 atilde(227),
jjg@1455 115 auml(228),
jjg@1455 116 aring(229),
jjg@1455 117 aelig(230),
jjg@1455 118 ccedil(231),
jjg@1455 119 egrave(232),
jjg@1455 120 eacute(233),
jjg@1455 121 ecirc(234),
jjg@1455 122 euml(235),
jjg@1455 123 igrave(236),
jjg@1455 124 iacute(237),
jjg@1455 125 icirc(238),
jjg@1455 126 iuml(239),
jjg@1455 127 eth(240),
jjg@1455 128 ntilde(241),
jjg@1455 129 ograve(242),
jjg@1455 130 oacute(243),
jjg@1455 131 ocirc(244),
jjg@1455 132 otilde(245),
jjg@1455 133 ouml(246),
jjg@1455 134 divide(247),
jjg@1455 135 oslash(248),
jjg@1455 136 ugrave(249),
jjg@1455 137 uacute(250),
jjg@1455 138 ucirc(251),
jjg@1455 139 uuml(252),
jjg@1455 140 yacute(253),
jjg@1455 141 thorn(254),
jjg@1455 142 yuml(255),
jjg@1455 143 fnof(402),
jjg@1455 144 Alpha(913),
jjg@1455 145 Beta(914),
jjg@1455 146 Gamma(915),
jjg@1455 147 Delta(916),
jjg@1455 148 Epsilon(917),
jjg@1455 149 Zeta(918),
jjg@1455 150 Eta(919),
jjg@1455 151 Theta(920),
jjg@1455 152 Iota(921),
jjg@1455 153 Kappa(922),
jjg@1455 154 Lambda(923),
jjg@1455 155 Mu(924),
jjg@1455 156 Nu(925),
jjg@1455 157 Xi(926),
jjg@1455 158 Omicron(927),
jjg@1455 159 Pi(928),
jjg@1455 160 Rho(929),
jjg@1455 161 Sigma(931),
jjg@1455 162 Tau(932),
jjg@1455 163 Upsilon(933),
jjg@1455 164 Phi(934),
jjg@1455 165 Chi(935),
jjg@1455 166 Psi(936),
jjg@1455 167 Omega(937),
jjg@1455 168 alpha(945),
jjg@1455 169 beta(946),
jjg@1455 170 gamma(947),
jjg@1455 171 delta(948),
jjg@1455 172 epsilon(949),
jjg@1455 173 zeta(950),
jjg@1455 174 eta(951),
jjg@1455 175 theta(952),
jjg@1455 176 iota(953),
jjg@1455 177 kappa(954),
jjg@1455 178 lambda(955),
jjg@1455 179 mu(956),
jjg@1455 180 nu(957),
jjg@1455 181 xi(958),
jjg@1455 182 omicron(959),
jjg@1455 183 pi(960),
jjg@1455 184 rho(961),
jjg@1455 185 sigmaf(962),
jjg@1455 186 sigma(963),
jjg@1455 187 tau(964),
jjg@1455 188 upsilon(965),
jjg@1455 189 phi(966),
jjg@1455 190 chi(967),
jjg@1455 191 psi(968),
jjg@1455 192 omega(969),
jjg@1455 193 thetasym(977),
jjg@1455 194 upsih(978),
jjg@1455 195 piv(982),
jjg@1455 196 bull(8226),
jjg@1455 197 hellip(8230),
jjg@1455 198 prime(8242),
jjg@1455 199 Prime(8243),
jjg@1455 200 oline(8254),
jjg@1455 201 frasl(8260),
jjg@1455 202 weierp(8472),
jjg@1455 203 image(8465),
jjg@1455 204 real(8476),
jjg@1455 205 trade(8482),
jjg@1455 206 alefsym(8501),
jjg@1455 207 larr(8592),
jjg@1455 208 uarr(8593),
jjg@1455 209 rarr(8594),
jjg@1455 210 darr(8595),
jjg@1455 211 harr(8596),
jjg@1455 212 crarr(8629),
jjg@1455 213 lArr(8656),
jjg@1455 214 uArr(8657),
jjg@1455 215 rArr(8658),
jjg@1455 216 dArr(8659),
jjg@1455 217 hArr(8660),
jjg@1455 218 forall(8704),
jjg@1455 219 part(8706),
jjg@1455 220 exist(8707),
jjg@1455 221 empty(8709),
jjg@1455 222 nabla(8711),
jjg@1455 223 isin(8712),
jjg@1455 224 notin(8713),
jjg@1455 225 ni(8715),
jjg@1455 226 prod(8719),
jjg@1455 227 sum(8721),
jjg@1455 228 minus(8722),
jjg@1455 229 lowast(8727),
jjg@1455 230 radic(8730),
jjg@1455 231 prop(8733),
jjg@1455 232 infin(8734),
jjg@1455 233 ang(8736),
jjg@1455 234 and(8743),
jjg@1455 235 or(8744),
jjg@1455 236 cap(8745),
jjg@1455 237 cup(8746),
jjg@1455 238 _int(8747),
jjg@1455 239 there4(8756),
jjg@1455 240 sim(8764),
jjg@1455 241 cong(8773),
jjg@1455 242 asymp(8776),
jjg@1455 243 ne(8800),
jjg@1455 244 equiv(8801),
jjg@1455 245 le(8804),
jjg@1455 246 ge(8805),
jjg@1455 247 sub(8834),
jjg@1455 248 sup(8835),
jjg@1455 249 nsub(8836),
jjg@1455 250 sube(8838),
jjg@1455 251 supe(8839),
jjg@1455 252 oplus(8853),
jjg@1455 253 otimes(8855),
jjg@1455 254 perp(8869),
jjg@1455 255 sdot(8901),
jjg@1455 256 lceil(8968),
jjg@1455 257 rceil(8969),
jjg@1455 258 lfloor(8970),
jjg@1455 259 rfloor(8971),
jjg@1455 260 lang(9001),
jjg@1455 261 rang(9002),
jjg@1455 262 loz(9674),
jjg@1455 263 spades(9824),
jjg@1455 264 clubs(9827),
jjg@1455 265 hearts(9829),
jjg@1455 266 diams(9830),
jjg@1455 267 quot(34),
jjg@1455 268 amp(38),
jjg@1455 269 lt(60),
jjg@1455 270 gt(62),
jjg@1455 271 OElig(338),
jjg@1455 272 oelig(339),
jjg@1455 273 Scaron(352),
jjg@1455 274 scaron(353),
jjg@1455 275 Yuml(376),
jjg@1455 276 circ(710),
jjg@1455 277 tilde(732),
jjg@1455 278 ensp(8194),
jjg@1455 279 emsp(8195),
jjg@1455 280 thinsp(8201),
jjg@1455 281 zwnj(8204),
jjg@1455 282 zwj(8205),
jjg@1455 283 lrm(8206),
jjg@1455 284 rlm(8207),
jjg@1455 285 ndash(8211),
jjg@1455 286 mdash(8212),
jjg@1455 287 lsquo(8216),
jjg@1455 288 rsquo(8217),
jjg@1455 289 sbquo(8218),
jjg@1455 290 ldquo(8220),
jjg@1455 291 rdquo(8221),
jjg@1455 292 bdquo(8222),
jjg@1455 293 dagger(8224),
jjg@1455 294 Dagger(8225),
jjg@1455 295 permil(8240),
jjg@1455 296 lsaquo(8249),
jjg@1455 297 rsaquo(8250),
jjg@1455 298 euro(8364);
jjg@1455 299
jjg@1455 300 int code;
jjg@1455 301
jjg@1455 302 private Entity(int code) {
jjg@1455 303 this.code = code;
jjg@1455 304 }
jjg@1455 305
jjg@1455 306 static boolean isValid(String name) {
jjg@1455 307 return names.containsKey(name);
jjg@1455 308 }
jjg@1455 309
jjg@1455 310 static boolean isValid(int code) {
jjg@1455 311 // allow numeric codes for standard ANSI characters
jjg@1455 312 return codes.containsKey(code) || ( 32 <= code && code < 2127);
jjg@1455 313 }
jjg@1455 314
jjg@1455 315 private static final Map<String,Entity> names = new HashMap<String,Entity>();
jjg@1455 316 private static final Map<Integer,Entity> codes = new HashMap<Integer,Entity>();
jjg@1455 317 static {
jjg@1455 318 for (Entity e: values()) {
jjg@1455 319 String name = e.name();
jjg@1455 320 int code = e.code;
jjg@1455 321 if (name.startsWith("_")) name = name.substring(1);
jjg@1455 322 names.put(name, e);
jjg@1455 323 codes.put(code, e);
jjg@1455 324 }
jjg@1455 325 }
jjg@1455 326 }

mercurial