Declare variables final, and rename to capitals

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137516 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-07-26 15:34:19 +00:00
parent bdbdb49ace
commit a86463bcc2
1 changed files with 15 additions and 14 deletions

View File

@ -69,24 +69,23 @@
* @author <a href="mailto:alex@purpletech.com">Alexander Day Chaffee</a> * @author <a href="mailto:alex@purpletech.com">Alexander Day Chaffee</a>
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a> * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @since 2.0 * @since 2.0
* @version $Id: Entities.java,v 1.11 2003/07/26 00:32:19 ggregory Exp $ * @version $Id: Entities.java,v 1.12 2003/07/26 15:34:19 scolebourne Exp $
*/ */
class Entities { class Entities {
static private String[][] basic = { private static final String[][] BASIC_ARRAY = {
{"quot", "34"}, // " - double-quote {"quot", "34"}, // " - double-quote
{"amp", "38"}, // & - ampersand {"amp", "38"}, // & - ampersand
{"lt", "60"}, // < - less-than {"lt", "60"}, // < - less-than
{"gt", "62"}, // > - greater-than {"gt", "62"}, // > - greater-than
}; };
static String[][] apos = { private static final String[][] APOS_ARRAY = {
{"apos", "39"}, // XML apostrophe {"apos", "39"}, // XML apostrophe
}; };
//todo: load these from a DTD file // package scoped for testing
static final String[][] ISO8859_1_ARRAY = {
static String[][] iso8859_1 = {
{"nbsp", "160"}, // non-breaking space {"nbsp", "160"}, // non-breaking space
{"iexcl", "161"}, //inverted exclamation mark {"iexcl", "161"}, //inverted exclamation mark
{"cent", "162"}, //cent sign {"cent", "162"}, //cent sign
@ -186,7 +185,8 @@ class Entities {
}; };
// http://www.w3.org/TR/REC-html40/sgml/entities.html // http://www.w3.org/TR/REC-html40/sgml/entities.html
static String[][] html40 = { // package scoped for testing
static final String[][] HTML40_ARRAY = {
// <!-- Latin Extended-B --> // <!-- Latin Extended-B -->
{"fnof", "402"}, //latin small f with hook = function= florin, U+0192 ISOtech --> {"fnof", "402"}, //latin small f with hook = function= florin, U+0192 ISOtech -->
// <!-- Greek --> // <!-- Greek -->
@ -387,14 +387,14 @@ class Entities {
static { static {
XML = new Entities(); XML = new Entities();
XML.addEntities(basic); XML.addEntities(BASIC_ARRAY);
XML.addEntities(apos); XML.addEntities(APOS_ARRAY);
} }
static { static {
HTML32 = new Entities(); HTML32 = new Entities();
HTML32.addEntities(basic); HTML32.addEntities(BASIC_ARRAY);
HTML32.addEntities(iso8859_1); HTML32.addEntities(ISO8859_1_ARRAY);
} }
static { static {
@ -403,9 +403,9 @@ class Entities {
} }
static void fillWithHtml40Entities(Entities entities) { static void fillWithHtml40Entities(Entities entities) {
entities.addEntities(basic); entities.addEntities(BASIC_ARRAY);
entities.addEntities(iso8859_1); entities.addEntities(ISO8859_1_ARRAY);
entities.addEntities(html40); entities.addEntities(HTML40_ARRAY);
} }
static interface EntityMap { static interface EntityMap {
@ -601,6 +601,7 @@ public String name(int value) {
} }
} }
// package scoped for testing
EntityMap map = new Entities.LookupEntityMap(); EntityMap map = new Entities.LookupEntityMap();
public void addEntities(String[][] entityArray) { public void addEntities(String[][] entityArray) {