Author: [EMAIL PROTECTED]
Date: Wed Sep 3 17:41:24 2008
New Revision: 3613
Modified:
changes/jat/ucd/user/src/com/google/gwt/i18n/tools/GenerateCharTables.java
changes/jat/ucd/user/test/com/google/gwt/i18n/client/impl/ucd/CharacterTableTest.java
Log:
Checkpoint work cleaning up UCD compression code.
Modified:
changes/jat/ucd/user/src/com/google/gwt/i18n/tools/GenerateCharTables.java
==============================================================================
---
changes/jat/ucd/user/src/com/google/gwt/i18n/tools/GenerateCharTables.java
(original)
+++
changes/jat/ucd/user/src/com/google/gwt/i18n/tools/GenerateCharTables.java
Wed Sep 3 17:41:24 2008
@@ -17,7 +17,9 @@
import com.google.gwt.compression.common.Huffman;
import com.google.gwt.compression.common.StringBitWriter;
+import com.google.gwt.compression.common.Huffman.Encode;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
@@ -321,7 +323,15 @@
public int hashCode() {
return ((lastChar - firstChar) * 17) ^ (value * 11);
}
-
+
+ public boolean isFullBlock() {
+ return lastChar - firstChar + 1 == COMPRESSION_BLOCK_SIZE;
+ }
+
+ public boolean startsBlock() {
+ return (firstChar & (COMPRESSION_BLOCK_SIZE - 1)) == 0;
+ }
+
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
@@ -333,10 +343,14 @@
buf.append(lastChar - firstChar + 1);
buf.append(") value=");
buf.append(value);
+ buf.append(", metaRepeat=");
+ buf.append(metaCount);
return buf.toString();
}
}
+ private static final int COMPRESSION_BLOCK_SIZE = 8192;
+
public static CharResults measureProperty(CharProperty prop) {
CharResults results = new CharResults();
for (int c = Character.MIN_CODE_POINT; c <=
Character.MAX_CODE_POINT; ++c) {
@@ -368,10 +382,13 @@
return "U+" + ("000000".substring(buf.length()) + buf);
}
- private ArrayList<CharRange> ranges = new ArrayList<CharRange>();
- @SuppressWarnings("unused")
+ private ArrayList<CharRange> ranges;
+
private boolean isBinary = true;
private boolean details = false;
+ public CharResults() {
+ ranges = new ArrayList<CharRange>();
+ }
public void dump(PrintStream out) {
for (CharRange range : ranges) {
@@ -403,7 +420,8 @@
buf.append("Table");
String className = buf.toString();
try {
- out = new PrintStream("/tmp/" + className + ".java");
+ out = new PrintStream(outputDirectory + File.separator + className
+ + ".java");
} catch (FileNotFoundException e) {
// TODO(jat): Auto-generated catch block
e.printStackTrace();
@@ -423,7 +441,7 @@
minDelta = range.value;
}
int count = range.lastChar - range.firstChar + 1;
- if (count == 8192 && range.value == 0) {
+ if (count == COMPRESSION_BLOCK_SIZE && range.value == 0) {
// empty blocks are handled specially, so don't count them
continue;
}
@@ -436,65 +454,19 @@
prevCount++;
continue;
}
- EncodedSymbol sym = new EncodedSymbol(prevCount,
- prevRange.lastChar - prevRange.firstChar + 1, isBinary ? 0 :
prevRange.value);
- int histCount = 0;
- if (histogram.containsKey(sym)) {
- histCount = histogram.get(sym);
- }
- histogram.put(sym, histCount + 1);
- if (symIdx.containsKey(sym)) {
- prevRange.sym = symIdx.get(sym);
- } else {
- prevRange.sym = symbols.size();
- symIdx.put(sym, prevRange.sym);
- symbols.add(sym);
- }
- prevRange.metaCount = prevCount;
+ createRangeSymbol(histogram, symIdx, symbols, prevRange,
prevCount);
prevRange = range;
prevCount = 1;
}
if (prevRange != null) {
- EncodedSymbol sym = new EncodedSymbol(prevCount,
- prevRange.lastChar - prevRange.firstChar + 1, isBinary ? 0 :
prevRange.value);
- int histCount = 0;
- if (histogram.containsKey(sym)) {
- histCount = histogram.get(sym);
- }
- histogram.put(sym, histCount + 1);
- if (symIdx.containsKey(sym)) {
- prevRange.sym = symIdx.get(sym);
- } else {
- prevRange.sym = symbols.size();
- symIdx.put(sym, prevRange.sym);
- symbols.add(sym);
- }
- prevRange.metaCount = prevCount;
+ createRangeSymbol(histogram, symIdx, symbols, prevRange,
prevCount);
}
- out.println("/*");
- out.println(" * Copyright 2008 Google Inc.");
- out.println(" * ");
- out.println(" * Licensed under the Apache License, Version 2.0 (the
\"License\"); you may not");
- out.println(" * use this file except in compliance with the License.
You may obtain a copy of");
- out.println(" * the License at");
- out.println(" * ");
- out.println(" * http://www.apache.org/licenses/LICENSE-2.0");
- out.println(" * ");
- out.println(" * Unless required by applicable law or agreed to in
writing, software");
- out.println(" * distributed under the License is distributed on an
\"AS IS\" BASIS, WITHOUT");
- out.println(" * WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the");
- out.println(" * License for the specific language governing
permissions and limitations under");
- out.println(" * the License.");
- out.println(" */");
- out.println();
- out.println("// Generated file -- DO NOT EDIT");
- out.println();
- out.println("package com.google.gwt.i18n.client.impl.ucd;");
- out.println();
+ writeFileHeader(out);
out.println("/**");
- out.println(" * Encodes " + methodDesc);
+ out.println(" * Compressed table for " + methodDesc + ".");
out.println(" */");
- out.println("public class " + className + " extends CodePointTable
{");
+ out.println("public class " + className + " {");
+ out.println(" // Compression block size is " +
COMPRESSION_BLOCK_SIZE);
out.println(" // Total delta range = " + minDelta + " to " +
maxDelta);
int[] histArray = new int[histogram.size()];
int idx = 0;
@@ -515,79 +487,22 @@
out.println(" " + sym + " - " + codeLengths[i]);
}
}
- StringBitWriter writer = new StringBitWriter();
- writer.put(1, isBinary ? 1 : 0);
- int numNonZero = encodeTable.getNumNonZero();
- assert numNonZero == symbols.size();
- writer.put(16, numNonZero);
- int deltaBits = 0;
- if (!isBinary) {
- deltaBits = log2ceil(maxDelta - minDelta);
- writer.put(5, deltaBits);
- writer.put(16, minDelta & 0xffff); // write as a signed short
- }
- int[] codeLengths = encodeTable.getCodeLength();
- int[] codeWords = encodeTable.getCodeWord();
- for (int i = 0; i < numNonZero; ++i) {
- writer.put(5, codeLengths[i]);
- EncodedSymbol sym = symbols.get(i);
- if (isBinary) {
- writeVarNumber(writer, sym.getMetaCount());
- }
- writeVarNumber(writer, sym.getCount());
- if (!isBinary) {
- writer.put(deltaBits, sym.getDelta() - minDelta);
- }
- }
- writer.finish();
- out.println(" private static String symbolTable = \"" +
writer.toString() + "\";");
- int numBlocks = (Character.MAX_CODE_POINT + 1) / 8192;
- int nextRange = 0;
-
- // trim ranges which are full empty blocks from the end
- int lastRange = ranges.size();
- while (lastRange > 0) {
- CharRange range = ranges.get(lastRange - 1);
- if (range.lastChar - range.firstChar != 8191 || range.value !=
0) {
- break;
- }
- --lastRange;
- }
- out.println(" private static String[] compressedTable = new
String[] {");
- for (int block = 0; nextRange < lastRange && block < numBlocks;
++block) {
- int blockStart = block * 8192;
- CharRange range = ranges.get(nextRange);
- if (range.firstChar == blockStart && range.lastChar ==
blockStart + 8191
- && range.value == 0) {
- out.println(" /* Block " + block + " */ null,");
- ++nextRange;
- continue;
- }
- writer = new StringBitWriter();
- if (isBinary) {
- writer.put(1, ranges.get(nextRange).value);
- }
- do {
- range = ranges.get(nextRange);
- int sym = range.sym;
- if (sym < 0) {
- throw new RuntimeException("No encoding symbol for " +
range);
- }
- writer.put(codeLengths[sym], codeWords[sym]);
- nextRange += range.metaCount;
- } while (range.lastChar != blockStart + 8191);
- out.println(" /* Block " + block + " */ \"" +
writer.toString() + "\",");
- }
- out.println(" };");
+ out.println(" private static class Instance {");
+ out.println(" private static CodePointTable instance = new
CodePointTable(symbolTable, compressedTable);");
+ out.println(" }");
out.println();
- out.println(" public " + className + "() {");
- out.println(" super(symbolTable, compressedTable);");
+ writeSymbolTable(out, encodeTable, maxDelta, minDelta, symbols);
+ out.println(" private static String[] compressedTable = new
String[] {");
+ writeCompressedBlocks(out, encodeTable);
out.println(" };");
out.println();
- out.println(" public " + (isBinary ? "boolean" : "int") + " " +
methodName
+ out.println("/**");
+ out.println(" * Returns " + methodDesc + " for a given
codePoint.");
+ out.println(" */");
+ out.println(" public static " + (isBinary ? "boolean" : "int")
+ " " + methodName
+ "(int codePoint) {");
- out.println(" return lookup" + (isBinary ? "Binary" :
isDelta ? "Delta" : "Value")
- + "Property(codePoint);");
+ out.println(" return Instance.instance.lookup" +
(isBinary ? "Binary" : isDelta
+ ? "Delta" : "Value") + "Property(codePoint);");
out.println(" }");
}
out.println("}");
@@ -596,11 +511,54 @@
}
}
+ private void writeFileHeader(PrintStream out) {
+ out.println("/*");
+ out.println(" * Copyright 2008 Google Inc.");
+ out.println(" * ");
+ out.println(" * Licensed under the Apache License, Version 2.0 (the
\"License\"); you may not");
+ out.println(" * use this file except in compliance with the License.
You may obtain a copy of");
+ out.println(" * the License at");
+ out.println(" * ");
+ out.println(" * http://www.apache.org/licenses/LICENSE-2.0");
+ out.println(" * ");
+ out.println(" * Unless required by applicable law or agreed to in
writing, software");
+ out.println(" * distributed under the License is distributed on an
\"AS IS\" BASIS, WITHOUT");
+ out.println(" * WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the");
+ out.println(" * License for the specific language governing
permissions and limitations under");
+ out.println(" * the License.");
+ out.println(" */");
+ out.println();
+ out.println("// File generated by GenerateCharTables -- DO NOT
EDIT");
+ out.println();
+ out.println("package com.google.gwt.i18n.client.impl.ucd;");
+ out.println();
+ }
+
+ private void createRangeSymbol(Map<EncodedSymbol, Integer> histogram,
+ Map<EncodedSymbol, Integer> symIdx, ArrayList<EncodedSymbol>
symbols,
+ CharRange range, int count) {
+ EncodedSymbol sym = new EncodedSymbol(count,
+ range.lastChar - range.firstChar + 1, isBinary ? 0 :
range.value);
+ int histCount = 0;
+ if (histogram.containsKey(sym)) {
+ histCount = histogram.get(sym);
+ }
+ histogram.put(sym, histCount + 1);
+ if (symIdx.containsKey(sym)) {
+ range.sym = symIdx.get(sym);
+ } else {
+ range.sym = symbols.size();
+ symIdx.put(sym, range.sym);
+ symbols.add(sym);
+ }
+ range.metaCount = count;
+ }
+
/**
* Computes the log2(i), rounded up to the nearest integer.
*
* @param i
- * @return
+ * @return int(ceil(log2(i)))
*/
private int log2ceil(int i) {
// TODO(jat): more efficient way to do this in Java?
@@ -633,7 +591,7 @@
ranges.add(new CharRange(c, delta));
} else {
CharRange range = ranges.get(ranges.size() - 1);
- if (range.value != delta || (c & 8191) == 0) {
+ if (range.value != delta || (c & (COMPRESSION_BLOCK_SIZE - 1)) ==
0) {
range.lastChar = c - 1;
ranges.add(new CharRange(c, delta));
} else {
@@ -642,15 +600,108 @@
}
}
+ private void writeCompressedBlocks(PrintStream out, Huffman.Encode
encodeTable) {
+ int[] codeLengths = encodeTable.getCodeLength();
+ int[] codeWords = encodeTable.getCodeWord();
+ StringBitWriter writer = new StringBitWriter();
+ int numBlocks = (Character.MAX_CODE_POINT + 1) /
COMPRESSION_BLOCK_SIZE;
+ int nextRange = 0;
+
+ // trim ranges which are full empty blocks from the end
+ int lastRange = ranges.size();
+ while (lastRange > 0) {
+ CharRange range = ranges.get(lastRange - 1);
+ if (range.lastChar - range.firstChar != (COMPRESSION_BLOCK_SIZE -
1)
+ || range.value != 0) {
+ break;
+ }
+ --lastRange;
+ }
+ for (int block = 0; nextRange < lastRange && block < numBlocks;
++block) {
+ int blockStart = block * COMPRESSION_BLOCK_SIZE;
+ CharRange range = ranges.get(nextRange);
+ // empty blocks are represented by null strings
+ if (range.isFullBlock() && range.value == 0) {
+ out.println(" /* Block " + block + " */ null,");
+ ++nextRange;
+ continue;
+ }
+ writer = new StringBitWriter();
+ if (isBinary) {
+ writer.put(1, ranges.get(nextRange).value);
+ }
+ for (boolean firstRange = true; nextRange < ranges.size();
nextRange += range.metaCount) {
+ range = ranges.get(nextRange);
+ if (firstRange) {
+ firstRange = false;
+ } else if (range.startsBlock()) {
+ break;
+ }
+ int sym = range.sym;
+ if (sym < 0) {
+ throw new RuntimeException("No encoding symbol for " + range);
+ }
+ writer.put(codeLengths[sym], codeWords[sym]);
+ }
+ out.println(" /* Block " + block + " */ \"" + writer.toString()
+ + "\",");
+ }
+ }
+
+ private void writeSymbolTable(PrintStream out, Encode encodeTable,
+ int maxDelta, int minDelta, ArrayList<EncodedSymbol> symbols) {
+ StringBitWriter writer = new StringBitWriter();
+ writer.put(1, isBinary ? 1 : 0);
+ int numNonZero = encodeTable.getNumNonZero();
+ assert numNonZero == symbols.size();
+ writer.put(16, numNonZero);
+ int deltaBits = 0;
+ if (!isBinary) {
+ deltaBits = log2ceil(maxDelta - minDelta);
+ writer.put(5, deltaBits);
+ writer.put(16, minDelta & 0xffff); // write as a signed short
+ }
+ int[] codeLengths = encodeTable.getCodeLength();
+ int[] codeWords = encodeTable.getCodeWord();
+ for (int i = 0; i < numNonZero; ++i) {
+ writer.put(5, codeLengths[i]);
+ EncodedSymbol sym = symbols.get(i);
+ if (isBinary) {
+ writeVarNumber(writer, sym.getMetaCount());
+ }
+ writeVarNumber(writer, sym.getCount());
+ if (!isBinary) {
+ writer.put(deltaBits, sym.getDelta() - minDelta);
+ }
+ }
+ writer.finish();
+ out.println(" private static String symbolTable = \"" +
writer.toString() + "\";");
+ }
+
+ /**
+ * Encode a value with a variable-length bit sequence.
+ *
+ * <table>
+ * <tr><th>Count</th><th>Encoding</th></tr>
+ * <tr><td align="center">1</td><td>00</td></tr>
+ * <tr><td align="center">2 - 17</td><td>01xxxx (count - 2)</td></tr>
+ * <tr><td align="center">18 - 4113</td><td>10xxxxxxxxxxxx (count -
18)</td></tr>
+ * <tr><td align="center">4114+</td><td>11xxxxxxxxxxxxxxxxxxxxxxxx
(count)</td></tr>
+ * </table>
+ *
+ * @param writer bit stream writer for output
+ * @param count count to encode, from 1 .. 2^20-1
+ */
private void writeVarNumber(StringBitWriter writer, int count) {
+ assert count > 0 && count < 0x100000;
if (count == 1) {
writer.put(2, 0);
- } else if (count < 17) {
+ } else if (count < 18) {
writer.put(2, 1);
- writer.put(4, count - 1);
- } else if (count < 4096 + 17) {
+ writer.put(4, count - 2);
+ } else if (count < 4096 + 18) {
writer.put(2, 2);
- writer.put(12, count - 17);
+ writer.put(12, count - 18);
} else {
writer.put(2, 3);
writer.put(20, count);
@@ -669,10 +720,6 @@
this(count, delta, true);
}
- public EncodedSymbol(int metaCount, int count, int delta) {
- this(metaCount, count, delta, true);
- }
-
public EncodedSymbol(int count, int delta, boolean literal) {
this.count = count;
this.delta = delta;
@@ -680,6 +727,10 @@
metaCount = 1;
}
+ public EncodedSymbol(int metaCount, int count, int delta) {
+ this(metaCount, count, delta, true);
+ }
+
public EncodedSymbol(int metaCount, int count, int delta, boolean
literal) {
this.count = count;
this.delta = delta;
@@ -731,76 +782,33 @@
}
}
- /**
- * @param args
- */
- public static void main(String[] args) {
- testBinary("isLowerCase");
- testBinary("isUpperCase");
-// testBinary("isTitleCase");
-// testBinary("isDigit");
-// testBinary("isLetter", false);
-// testBinary("isLetterOrDigit");
-// testBinaryDiffOr("isLetterOrDigit", "isLetter", "isDigit");
-// testBinary("isJavaIdentifierStart");
-// testBinaryXor("isJavaIdentifierStart", "isLetter");
-// testBinary("isJavaIdentifierPart");
-// testBinaryXor("isJavaIdentifierPart", "isLetterOrDigit");
-// testBinaryXor("isUnicodeIdentifierStart", "isLetter");
-// testBinaryXor("isUnicodeIdentifierPart", "isLetterOrDigit");
-// testBinary("isIdentifierIgnorable");
-// testBinary("isSpaceChar");
-// testBinary("isWhitespace");
-// testBinary("isISOControl", true);
-// testBinary("isMirrored");
-// testDelta("toLowerCase");
-// testDelta("toUpperCase");
-// testDelta("toTitleCase");
-// testValue("getDirectionality");
-// testValue("getNumericValue");
-// testValue("getType");
- }
+ private static String outputDirectory = "/tmp";
- public static void testBinary(CharProperty property, boolean details) {
- CharResults results = CharResults.measureProperty(property);
- results.setDetails(details);
- String propName = property.getName();
- System.out.println(propName);
- if (details) {
- results.dump(System.out);
- }
- results.writeSourceFile(System.out, propName, false);
- }
-
- public static void testBinary(String method) {
- testBinary(method, false);
- }
-
- public static void testBinary(String method, boolean details) {
+ public static void generateBinary(String method) {
CharProperty property = new ReflectiveCharProperty(method);
- testBinary(property, details);
+ generateProperty(property, false);
}
- public static void testBinaryDiffOr(String primaryMethod, String...
methods) {
+ public static void generateBinaryDiffOr(String primaryMethod, String...
methods) {
CharProperty property = new
ReflectiveCharPropertyDiffOr(primaryMethod, methods);
- testBinary(property, false);
+ generateProperty(property, false);
}
-
- public static void testBinaryOr(String... methods) {
+
+ public static void generateBinaryOr(String... methods) {
CharProperty property = new ReflectiveCharPropertyOr(methods);
- testBinary(property, false);
+ generateProperty(property, false);
}
- public static void testBinaryXor(String primaryMethod, String
secondaryMethod) {
+ public static void generateBinaryXor(String primaryMethod, String
secondaryMethod) {
CharProperty property = new ReflectiveCharPropertyXor(primaryMethod,
secondaryMethod);
- testBinary(property, false);
+ generateProperty(property, false);
}
- public static void testDelta(String method) {
- testDelta(method, false);
+ public static void generateDelta(String method) {
+ generateDelta(method, false);
}
- public static void testDelta(String method, boolean details) {
+ public static void generateDelta(String method, boolean details) {
CharTransform transform = new ReflectiveCharTransform(method);
CharResults results = CharResults.measureTransform(transform);
results.setDetails(details);
@@ -812,11 +820,22 @@
results.writeSourceFile(System.out, name, true);
}
- public static void testValue(String method) {
- testValue(method, false);
+ public static void generateProperty(CharProperty property, boolean
details) {
+ CharResults results = CharResults.measureProperty(property);
+ results.setDetails(details);
+ String propName = property.getName();
+ System.out.println(propName);
+ if (details) {
+ results.dump(System.out);
+ }
+ results.writeSourceFile(System.out, propName, false);
+ }
+
+ public static void generateValue(String method) {
+ generateValue(method, false);
}
- public static void testValue(String method, boolean details) {
+ public static void generateValue(String method, boolean details) {
CharTransform transform = new ReflectiveCharTransform(method);
CharResults results = CharResults.measureValue(transform);
results.setDetails(details);
@@ -824,6 +843,45 @@
System.out.println(name);
// results.dump(System.out);
results.writeSourceFile(System.out, name, false);
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ for (int i = 0; i < args.length; ++i) {
+ if ("-out".equals(args[i])) {
+ outputDirectory = args[++i];
+ new File(outputDirectory).mkdirs();
+ } else {
+ System.err.println(
+ "Usage: GenerateCharTables [-out outputdir]");
+ System.exit(1);
+ }
+ }
+ generateBinary("isLowerCase");
+ generateBinary("isUpperCase");
+ generateBinary("isTitleCase");
+ generateBinary("isDigit");
+ generateBinary("isLetter");
+ generateBinary("isLetterOrDigit");
+ generateBinary("isJavaIdentifierStart");
+ generateBinaryXor("isJavaIdentifierStart", "isLetter");
+ generateBinary("isJavaIdentifierPart");
+ generateBinaryXor("isJavaIdentifierPart", "isLetterOrDigit");
+ generateBinaryXor("isUnicodeIdentifierStart", "isLetter");
+ generateBinaryXor("isUnicodeIdentifierPart", "isLetterOrDigit");
+ generateBinary("isIdentifierIgnorable");
+ generateBinary("isSpaceChar");
+ generateBinary("isWhitespace");
+ generateBinary("isISOControl");
+ generateBinary("isMirrored");
+ generateDelta("toLowerCase");
+ generateDelta("toUpperCase");
+ generateDelta("toTitleCase");
+ generateValue("getDirectionality");
+ generateValue("getNumericValue");
+ generateValue("getType");
}
}
Modified:
changes/jat/ucd/user/test/com/google/gwt/i18n/client/impl/ucd/CharacterTableTest.java
==============================================================================
---
changes/jat/ucd/user/test/com/google/gwt/i18n/client/impl/ucd/CharacterTableTest.java
(original)
+++
changes/jat/ucd/user/test/com/google/gwt/i18n/client/impl/ucd/CharacterTableTest.java
Wed Sep 3 17:41:24 2008
@@ -25,28 +25,28 @@
public void testGetDirectionality() {
DirectionalityTable table = new DirectionalityTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
- assertEquals("codePoint " + i, Character.getDirectionality(i),
table.getDirectionality(i));
+ assertEquals("codePoint " + i, Character.getDirectionality(i),
DirectionalityTable.getDirectionality(i));
}
}
public void testGetNumericValue() {
NumericValueTable table = new NumericValueTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
- assertEquals("codePoint " + i, Character.getNumericValue(i),
table.getNumericValue(i));
+ assertEquals("codePoint " + i, Character.getNumericValue(i),
NumericValueTable.getNumericValue(i));
}
}
public void testGetType() {
TypeTable table = new TypeTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
- assertEquals("codePoint " + i, Character.getType(i),
table.getType(i));
+ assertEquals("codePoint " + i, Character.getType(i),
TypeTable.getType(i));
}
}
public void testIsDigit() {
DigitTable table = new DigitTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
- assertEquals("codePoint " + i, Character.isDigit(i),
table.isDigit(i));
+ assertEquals("codePoint " + i, Character.isDigit(i),
DigitTable.isDigit(i));
}
}
@@ -54,7 +54,7 @@
ISOControlTable table = new ISOControlTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isISOControl(i),
- table.isISOControl(i));
+ ISOControlTable.isISOControl(i));
}
}
@@ -62,7 +62,7 @@
IdentifierIgnorableTable table = new IdentifierIgnorableTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isIdentifierIgnorable(i),
- table.isIdentifierIgnorable(i));
+ IdentifierIgnorableTable.isIdentifierIgnorable(i));
}
}
@@ -70,8 +70,7 @@
JavaIdentifierPartTable table = new JavaIdentifierPartTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isJavaIdentifierPart(i),
- table.isJavaIdentifierPartXORisLetterOrDigit(i)
- ^ Character.isLetterOrDigit(i));
+ JavaIdentifierPartTable.isJavaIdentifierPart(i) ^
Character.isLetterOrDigit(i));
}
}
@@ -79,14 +78,14 @@
JavaIdentifierStartTable table = new JavaIdentifierStartTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isJavaIdentifierStart(i),
- table.isJavaIdentifierStartXORisLetter(i) ^
Character.isLetter(i));
+ JavaIdentifierStartTable.isJavaIdentifierStart(i) ^
Character.isLetter(i));
}
}
public void testIsLetter() {
LetterTable table = new LetterTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
- assertEquals("codePoint " + i, Character.isLetter(i),
table.isLetter(i));
+ assertEquals("codePoint " + i, Character.isLetter(i),
LetterTable.isLetter(i));
}
}
@@ -94,7 +93,7 @@
LowerCaseTable table = new LowerCaseTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isLowerCase(i),
- table.isLowerCase(i));
+ LowerCaseTable.isLowerCase(i));
}
}
@@ -102,7 +101,7 @@
MirroredTable table = new MirroredTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isMirrored(i),
- table.isMirrored(i));
+ MirroredTable.isMirrored(i));
}
}
@@ -110,7 +109,7 @@
SpaceCharTable table = new SpaceCharTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isSpaceChar(i),
- table.isSpaceChar(i));
+ SpaceCharTable.isSpaceChar(i));
}
}
@@ -118,7 +117,7 @@
TitleCaseTable table = new TitleCaseTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isTitleCase(i),
- table.isTitleCase(i));
+ TitleCaseTable.isTitleCase(i));
}
}
@@ -126,7 +125,7 @@
UnicodeIdentifierPartTable table = new UnicodeIdentifierPartTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isUnicodeIdentifierPart(i),
- table.isUnicodeIdentifierPartXORisLetterOrDigit(i)
+ UnicodeIdentifierPartTable.isUnicodeIdentifierPart(i)
^ Character.isLetterOrDigit(i));
}
}
@@ -135,7 +134,7 @@
UnicodeIdentifierStartTable table = new UnicodeIdentifierStartTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isUnicodeIdentifierStart(i),
- table.isUnicodeIdentifierStartXORisLetter(i) ^
Character.isLetter(i));
+ UnicodeIdentifierStartTable.isUnicodeIdentifierStart(i) ^
Character.isLetter(i));
}
}
@@ -143,7 +142,7 @@
UpperCaseTable table = new UpperCaseTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isUpperCase(i),
- table.isUpperCase(i));
+ UpperCaseTable.isUpperCase(i));
}
}
@@ -151,7 +150,7 @@
WhitespaceTable table = new WhitespaceTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.isWhitespace(i),
- table.isWhitespace(i));
+ WhitespaceTable.isWhitespace(i));
}
}
@@ -159,7 +158,7 @@
ToLowerCaseTable table = new ToLowerCaseTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.toLowerCase(i),
- table.toLowerCase(i));
+ ToLowerCaseTable.toLowerCase(i));
}
}
@@ -167,7 +166,7 @@
ToTitleCaseTable table = new ToTitleCaseTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.toTitleCase(i),
- table.toTitleCase(i));
+ ToTitleCaseTable.toTitleCase(i));
}
}
@@ -175,7 +174,7 @@
ToUpperCaseTable table = new ToUpperCaseTable();
for (int i = 0; i < Character.MAX_CODE_POINT; ++i) {
assertEquals("codePoint " + i, Character.toUpperCase(i),
- table.toUpperCase(i));
+ ToUpperCaseTable.toUpperCase(i));
}
}
}
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---