cleanup for 3.2

X-SVN-Rev: 7318
This commit is contained in:
Mark Davis 2001-12-05 02:41:23 +00:00
parent 9b103e24a0
commit 250fd0c22d
12 changed files with 656 additions and 309 deletions

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/DerivedProperty.java,v $
* $Date: 2001/12/03 19:29:35 $
* $Revision: 1.7 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.8 $
*
*******************************************************************************
*/
@ -16,20 +16,40 @@ import com.ibm.text.utility.*;
import com.ibm.text.*;
import java.util.*;
public class DerivedProperty implements UCD_Types {
public final class DerivedProperty implements UCD_Types {
UCD ucdData;
// ADD CONSTANT to UCD_TYPES
static public UnicodeProperty getProperty(int derivedPropertyID, UCD ucd) {
return new DerivedProperty(ucd).dprops[derivedPropertyID];
static public UnicodeProperty make(int derivedPropertyID, UCD ucd) {
if (derivedPropertyID < 0 || derivedPropertyID >= DERIVED_PROPERTY_LIMIT) return null;
DerivedProperty dp = getCached(ucd);
return dp.dprops[derivedPropertyID];
}
public DerivedProperty(UCD ucd) {
///////////////////////////////////////////////////////////
private DerivedProperty(UCD ucd) {
ucdData = ucd;
}
static Map cache = new HashMap();
static UCD lastUCD = null;
static DerivedProperty lastValue = null;
private static DerivedProperty getCached(UCD ucd) {
if (ucd.equals(lastUCD)) return lastValue;
DerivedProperty dp = (DerivedProperty) cache.get(ucd);
if (dp == null) {
dp = new DerivedProperty(ucd);
cache.put(ucd, dp);
}
lastUCD = ucd;
lastValue = dp;
return dp;
}
/*
public String getHeader(int propNumber) {
UnicodeProperty dp = dprops[propNumber];
if (dp != null) return dp.getHeader();
@ -42,17 +62,12 @@ public class DerivedProperty implements UCD_Types {
else return "Unimplemented!!";
}
public String getProperty(int cp, int propNumber) {
public String getValue(int cp, int propNumber) {
UnicodeProperty dp = dprops[propNumber];
if (dp != null) return dp.getProperty(cp);
if (dp != null) return dp.getValue(cp);
else return "Unimplemented!!";
}
public boolean isDefined(int propNumber) {
if (propNumber < 0 || propNumber >= dprops.length) return false;
return dprops[propNumber] != null;
}
public boolean isTest(int propNumber) {
if (!isDefined(propNumber)) return false;
return dprops[propNumber].isTest();
@ -63,12 +78,12 @@ public class DerivedProperty implements UCD_Types {
return dprops[propNumber].hasProperty(cp);
}
public boolean propertyVaries(int propNumber) {
return dprops[propNumber].propertyVaries();
public boolean valueVaries(int propNumber) {
return dprops[propNumber].valueVaries();
}
/*
public String getProperty(int cp, int propNumber) {
return dprops[propNumber].getProperty(int cp);
public String getValue(int cp, int propNumber) {
return dprops[propNumber].getValue(int cp);
}
*/
private UnicodeProperty[] dprops = new UnicodeProperty[50];
@ -80,23 +95,6 @@ public class DerivedProperty implements UCD_Types {
"Lowercase",
"Mixedcase"};
/*
private abstract static class UnicodeProperty {
boolean testStatus = false;
byte defaultStyle = LONG;
String name, shortName, header;
String getName(byte style) {
if (style == NORMAL) style = defaultStyle;
return style < LONG ? shortName : name;
}
String getHeader() { return header; }
boolean isTest() { return testStatus; }
abstract boolean hasProperty(int cp);
public boolean propertyVaries() { return false; }
public String getProperty(int cp) { return hasProperty(cp) ? name : ""; }
}
*/
class ExDProp extends UnicodeProperty {
Normalizer nfx;
ExDProp(int i) {
@ -109,7 +107,7 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# WARNING: Normalization of STRINGS must use the algorithm in UAX #15 because characters may interact."
+ "\r\n# The length of a normalized string is not necessarily the sum of the lengths of the normalized characters!";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
if (ucdData.getDecompositionType(cp) == NONE) return false;
String norm = nfx.normalize(cp);
if (UTF16.countCodePoint(norm) != 1) return true;
@ -131,13 +129,13 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# Characters that are cc==0, BUT which may interact with previous characters."
;
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
if (ucdData.getCombiningClass(cp) != 0) return false;
String norm = nfx.normalize(cp);
int first = UTF16.charAt(norm, 0);
if (ucdData.getCombiningClass(first) != 0) return true;
if (nfx.isComposition()
&& dprops[NFC_TrailingZero].hasProperty(first)) return true; // 1,3 == composing
&& dprops[NFC_TrailingZero].hasValue(first)) return true; // 1,3 == composing
return false;
}
};
@ -169,7 +167,7 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# WARNING: Normalization of STRINGS must use the algorithm in UAX #15 because characters may interact."
+ "\r\n# The length of a normalized string is not necessarily the sum of the lengths of the normalized characters!";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
boolean result = bitset.get(cp);
if (result && filter) {
result = (ucdData.getCombiningClass(cp) != 0) == keepNonZero;
@ -191,7 +189,8 @@ public class DerivedProperty implements UCD_Types {
Normalizer nfComp = null;
GenDProp (int i) {
isStandard = false;
isStandard = false;
valueVaries = true;
nfx = nf[i];
name = nfx.getName();
String compName = "the character itself";
@ -211,12 +210,11 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# WARNING: Normalization of STRINGS must use the algorithm in UAX #15 because characters may interact."
+ "\r\n# It is NOT sufficient to replace characters one-by-one with these results!";
}
public boolean propertyVaries() {return true;} // default
int cacheCp = 0;
String cacheStr = "";
public String getProperty(int cp) {
public String getValue(int cp) {
if (cacheCp == cp) return cacheStr;
cacheCp = cp;
cacheStr = "";
@ -239,7 +237,7 @@ public class DerivedProperty implements UCD_Types {
//if (cp >= 0xAC00 && cp <= 0xD7A3) return true;
//System.out.println(Utility.hex(cps) + " => " + Utility.hex(nf[i-4].normalize(cps)));
} // default
boolean hasProperty(int cp) { return getProperty(cp).length() != 0; }
boolean hasValue(int cp) { return getValue(cp).length() != 0; }
};
class CaseDProp extends UnicodeProperty {
@ -251,7 +249,7 @@ public class DerivedProperty implements UCD_Types {
header = "# Derived Property: " + name
+ "\r\n# Generated from: NFKD has >0 " + CaseNames[i-Missing_Uppercase] + ", no other cases";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
byte cat = ucdData.getCategory(cp);
if (cat == val
|| val != Lt && ucdData.getBinaryProperty(cp, Other_Uppercase)) return false;
@ -266,6 +264,7 @@ public class DerivedProperty implements UCD_Types {
String MAYBE;
Normalizer nfx;
QuickDProp (int i) {
valueVaries = true;
nfx = nf[i];
NO = nfx.getName() + "_NO";
MAYBE = nfx.getName() + "_MAYBE";
@ -277,13 +276,12 @@ public class DerivedProperty implements UCD_Types {
? " (and characters that may compose with previous ones)" : "");
}
public boolean propertyVaries() {return true;}
public String getProperty(int cp) {
public String getValue(int cp) {
if (nfx.normalizationDiffers(cp)) return NO;
else if (nfx.isTrailing(cp)) return MAYBE;
else return "";
}
boolean hasProperty(int cp) { return getProperty(cp).length() != 0; }
boolean hasValue(int cp) { return getValue(cp).length() != 0; }
};
{
@ -316,7 +314,7 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# Characters that can start an identifier."
+ "\r\n# Generated from Lu+Ll+Lt+Lm+Lo+Nl";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
return ucdData.isIdentifierStart(cp, false);
}
};
@ -330,7 +328,7 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# Generated from: ID_Start + Mn+Mc+Nd+Pc"
+ "\r\n# NOTE: Cf characters should be filtered out.";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
return ucdData.isIdentifierContinue_NO_Cf(cp, false);
}
};
@ -345,7 +343,7 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# NOTE: Does NOT remove the non-NFKx characters."
+ "\r\n# Merely ensures that if isIdentifer(string) then isIdentifier(NFKx(string))";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
return ucdData.isIdentifierStart(cp, true);
}
};
@ -361,7 +359,7 @@ public class DerivedProperty implements UCD_Types {
+ "\r\n# NOTE: Does NOT remove the non-NFKx characters."
+ "\r\n# Merely ensures that if isIdentifer(string) then isIdentifier(NFKx(string))";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
return ucdData.isIdentifierContinue_NO_Cf(cp, true);
}
};
@ -373,7 +371,7 @@ public class DerivedProperty implements UCD_Types {
header = "# Derived Property: " + name
+ "\r\n# Generated from: Sm + Other_Math";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
byte cat = ucdData.getCategory(cp);
if (cat == Sm
|| ucdData.getBinaryProperty(cp,Math_Property)) return true;
@ -388,7 +386,7 @@ public class DerivedProperty implements UCD_Types {
header = "# Derived Property: " + name
+ "\r\n# Generated from: Lu+Ll+Lt+Lm+Lo+Nl + Other_Alphabetic";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
byte cat = ucdData.getCategory(cp);
if (cat == Lu || cat == Ll || cat == Lt || cat == Lm || cat == Lo || cat == Nl
|| ucdData.getBinaryProperty(cp, Alphabetic)) return true;
@ -403,7 +401,7 @@ public class DerivedProperty implements UCD_Types {
header = "# Derived Property: " + name
+ "\r\n# Generated from: Ll + Other_Lowercase";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
byte cat = ucdData.getCategory(cp);
if (cat == Ll
|| ucdData.getBinaryProperty(cp, Other_Lowercase)) return true;
@ -418,7 +416,7 @@ public class DerivedProperty implements UCD_Types {
header = "# Derived Property: " + name
+ "\r\n# Generated from: Lu + Other_Uppercase";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
byte cat = ucdData.getCategory(cp);
if (cat == Lu
|| ucdData.getBinaryProperty(cp, Other_Uppercase)) return true;
@ -441,12 +439,12 @@ of characters, the first of which has a non-zero combining class.
{
name = "Full_Composition_Exclusion";
shortName = "Comp_Ex";
defaultStyle = SHORT;
defaultValueStyle = SHORT;
header = "# Derived Property: " + name
+ ": Full Composition Exclusion"
+ "\r\n# Generated from: Composition Exclusions + Singletons + Non-Starter Decompositions";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
if (!ucdData.isRepresented(cp)) return false;
byte dtype = ucdData.getDecompositionType(cp);
if (dtype != CANONICAL) return false;
@ -461,12 +459,12 @@ of characters, the first of which has a non-zero combining class.
isStandard = false;
name = "Full_Composition_Inclusion";
shortName = "Comp_In";
defaultStyle = SHORT;
defaultValueStyle = SHORT;
header = "# Derived Property: " + name
+ ": Full Composition Inclusion"
+ "\r\n# characters with Canonical Decompositions MINUS Full Composition Exclusion";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
if (!ucdData.isRepresented(cp)) return false;
byte dtype = ucdData.getDecompositionType(cp);
if (dtype != CANONICAL) return false;
@ -478,6 +476,7 @@ of characters, the first of which has a non-zero combining class.
dprops[FC_NFKC_Closure] = new UnicodeProperty() {
{
valueVaries = true;
name = "FC_NFKC_Closure";
shortName = "FC_NFKC";
header = "# Derived Property: " + name
@ -485,35 +484,34 @@ of characters, the first of which has a non-zero combining class.
+ "\r\n# Then if (c != b) add the mapping from a to c to the set of"
+ "\r\n# mappings that constitute the FC_NFKC_Closure list";
}
public boolean propertyVaries() {return true;} // default
public String getProperty(int cp) {
public String getValue(int cp) {
if (!ucdData.isRepresented(cp)) return "";
String b = nfkc.normalize(fold(cp));
String c = nfkc.normalize(fold(b));
if (c.equals(b)) return "";
return "FNC; " + Utility.hex(c);
} // default
boolean hasProperty(int cp) { return getProperty(cp).length() != 0; }
boolean hasValue(int cp) { return getValue(cp).length() != 0; }
};
dprops[FC_NFC_Closure] = new UnicodeProperty() {
{
name = "FC_NFC_Closure";
valueVaries = true;
shortName = "FC_NFC";
header = "# Derived Property: " + name
+ "\r\n# Generated from computing: b = NFC(Fold(a)); c = NFC(Fold(b));"
+ "\r\n# Then if (c != b) add the mapping from a to c to the set of"
+ "\r\n# mappings that constitute the FC_NFC_Closure list";
}
public boolean propertyVaries() {return true;} // default
public String getProperty(int cp) {
public String getValue(int cp) {
if (!ucdData.isRepresented(cp)) return "";
String b = nfc.normalize(fold(cp));
String c = nfc.normalize(fold(b));
if (c.equals(b)) return "";
return "FN; " + Utility.hex(c);
} // default
boolean hasProperty(int cp) { return getProperty(cp).length() != 0; }
boolean hasValue(int cp) { return getValue(cp).length() != 0; }
};
for (int i = QuickNFD; i <= QuickNFKC; ++i) {
@ -523,11 +521,12 @@ of characters, the first of which has a non-zero combining class.
dprops[DefaultIgnorable] = new UnicodeProperty() {
{
name = "Default_Ignorable_Code_Point";
hasUnassigned = true;
shortName = "DI";
header = header = "# Derived Property: " + name
+ "\r\n# Generated from Other_Default_Ignorable_Code_Point + Cf + Cc + Cs - White_Space";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
if (ucdData.getBinaryProperty(cp, White_space)) return false;
byte cat = ucdData.getCategory(cp);
if (cat == Cf || cat == Cs || cat == Cc
@ -548,11 +547,9 @@ of characters, the first of which has a non-zero combining class.
name = "Grapheme_Extend";
shortName = "GrExt";
header = header = "# Derived Property: " + name
+ "\r\n# Generated from: Me + Mn + Mc + Other_Grapheme_Extend - Grapheme_Link"
+ "\r\n# Used in the definition of GraphemeCluster: "
+ "\r\n# GraphemeCluster ::= GraphameBase? ( Grapheme_Extend | Grapheme_Link Join_Control? Grapheme_Base? )*";
+ "\r\n# Generated from: Me + Mn + Mc + Other_Grapheme_Extend - Grapheme_Link";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
if (ucdData.getBinaryProperty(cp, GraphemeExtend)) return false;
byte cat = ucdData.getCategory(cp);
if (cat == Me || cat == Mn || cat == Mc
@ -568,7 +565,7 @@ of characters, the first of which has a non-zero combining class.
header = header = "# Binary Property";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
switch(cp) {
case 0x27: case 0x2019: case 0xAD: return true;
// case 0x2d: case 0x2010: case 0x2011:
@ -593,7 +590,7 @@ of characters, the first of which has a non-zero combining class.
+ "\r\n# - has no combining marks with zero canonical combining class"
;
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
if (cp == 'i' || cp == 'j') return true;
if (!nfkd.hasDecomposition(cp)) return false;
String decomp = nfd.normalize(cp);
@ -618,10 +615,10 @@ of characters, the first of which has a non-zero combining class.
header = header = "# Derived Property: " + name
+ "\r\n# Generated from: Other_Case_Ignorable + Lm + Mn + Me + Cf";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
byte cat = ucdData.getCategory(cp);
if (cat == Lm || cat == Cf || cat == Mn || cat == Me) return true;
if (dprops[Other_Case_Ignorable].hasProperty(cp)) return true;
if (dprops[Other_Case_Ignorable].hasValue(cp)) return true;
return false;
}
};
@ -632,15 +629,13 @@ of characters, the first of which has a non-zero combining class.
shortName = "GrBase";
header = header = "# Derived Property: " + name
+ "\r\n# Generated from: [0..10FFFF] - Cc - Cf - Cs - Co - Cn - Zl - Zp - Grapheme_Link - Grapheme_Extend"
+ "\r\n# Used in the definition of GraphemeCluster: "
+ "\r\n# GraphemeCluster ::= GraphameBase? ( Grapheme_Extend | Grapheme_Link Join_Control? Grapheme_Base? )*";
+ "\r\n# Generated from: [0..10FFFF] - Cc - Cf - Cs - Co - Cn - Zl - Zp - Grapheme_Link - Grapheme_Extend";
}
boolean hasProperty(int cp) {
boolean hasValue(int cp) {
byte cat = ucdData.getCategory(cp);
if (cat == Cc || cat == Cf || cat == Cs || cat == Co || cat == Cn || cat == Zl || cat == Zp
|| ucdData.getBinaryProperty(cp,GraphemeLink)) return false;
if (dprops[GraphemeExtend].hasProperty(cp)) return false;
if (dprops[GraphemeExtend].hasValue(cp)) return false;
return true;
}
};
@ -709,8 +704,8 @@ of characters, the first of which has a non-zero combining class.
for (int cp = 0xA0; cp < 0xFF; ++cp) {
System.out.println();
System.out.println(ucd.getCodeAndName(cp));
for (int j = 0; j < LIMIT; ++j) {
String prop = dprop.getProperty(cp, j);
for (int j = 0; j < DERIVED_PROPERTY_LIMIT; ++j) {
String prop = make(j, ucd).getValue(cp);
if (prop.length() != 0) System.out.println("\t" + prop);
}
}

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/DerivedPropertyLister.java,v $
* $Date: 2001/09/19 23:33:16 $
* $Revision: 1.5 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.6 $
*
*******************************************************************************
*/
@ -22,17 +22,19 @@ final class DerivedPropertyLister extends PropertyLister {
static int enum = 0;
private int propMask;
private DerivedProperty dprop;
//private int propMask;
//private DerivedProperty dprop;
private UnicodeProperty uprop;
int width;
boolean varies;
public DerivedPropertyLister(UCD ucd, int propMask, PrintWriter output) {
this.propMask = propMask;
//this.propMask = propMask;
this.output = output;
this.ucdData = ucd;
this.dprop = new DerivedProperty(ucd);
varies = dprop.propertyVaries(propMask);
// this.dprop = new DerivedProperty(ucd);
uprop = DerivedProperty.make(propMask, ucd);
varies = uprop.valueVaries();
width = super.minPropertyWidth();
switch (propMask) {
@ -50,11 +52,12 @@ final class DerivedPropertyLister extends PropertyLister {
}
public String headerString() {
return dprop.getHeader(propMask);
return uprop.getHeader();
}
public String propertyName(int cp) {
return dprop.getProperty(cp, propMask);
if (uprop.valueVaries()) return uprop.getValue(cp, LONG);
return uprop.getProperty(LONG);
}
//public String optionalComment(int cp) {
@ -87,11 +90,11 @@ final class DerivedPropertyLister extends PropertyLister {
String last;
public byte status(int cp) {
if (!ucdData.isAssigned(cp) && propMask != DerivedProperty.DefaultIgnorable) return EXCLUDE;
if (!uprop.hasUnassigned() && !ucdData.isAssigned(cp)) return EXCLUDE;
if (!varies) {
return dprop.hasProperty(cp, propMask) ? INCLUDE : EXCLUDE;
return uprop.hasValue(cp) ? INCLUDE : EXCLUDE;
}
String prop = dprop.getProperty(cp, propMask);
String prop = uprop.getValue(cp);
if (prop.length() == 0) return EXCLUDE;
if (prop.equals(last)) return INCLUDE;
last = prop;

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/GenerateData.java,v $
* $Date: 2001/11/13 02:31:55 $
* $Revision: 1.10 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.11 $
*
*******************************************************************************
*/
@ -24,14 +24,39 @@ import com.ibm.text.UTF16;
public class GenerateData implements UCD_Types {
static final boolean DEBUG = false;
static final String HORIZONTAL_LINE = "# ================================================";
static UnifiedBinaryProperty ubp;
//static UnifiedBinaryProperty ubp;
static final String[] ALL = {
"CaseFolding",
"CompositionExclusions",
"DerivedBidiClass",
"DerivedBinaryProperties",
"DerivedCombiningClass",
"DerivedCoreProperties",
"DerivedDecompositionType",
"DerivedEastAsianWidth",
"DerivedGeneralCategory",
"DerivedJoiningGroup",
"DerivedJoiningType",
"DerivedLineBreak",
"DerivedNormalizationProperties",
"DerivedNumericType",
"DerivedNumericValues",
"NormalizationTest",
"PropList",
"Scripts",
"DerivedAge",
};
public static void main (String inVersion, String[] args) throws IOException {
System.out.println("START");
ucd = UCD.make(inVersion);
ubp = new UnifiedBinaryProperty(ucd);
//ubp = new UnifiedBinaryProperty(ucd);
System.out.println("Loaded UCD " + ucd.getVersion() + " " + (new Date(ucd.getDate())));
String version = ucd.getVersion();
@ -46,6 +71,12 @@ public class GenerateData implements UCD_Types {
if (arg.equalsIgnoreCase("partition")) {
partitionProperties();
} else if (arg.equalsIgnoreCase("All")) {
// Append all args at end
String[] temp = new String[args.length + ALL.length];
System.arraycopy(args, 0, temp, 0, args.length);
System.arraycopy(ALL, 0, temp, args.length, ALL.length);
args = temp;
} else if (arg.equalsIgnoreCase("PropertyAliases")) {
listProperties();
} else if (arg.equalsIgnoreCase("listAccents")) {
@ -61,52 +92,55 @@ public class GenerateData implements UCD_Types {
listDifferences();
} else if (arg.equalsIgnoreCase("DerivedBidiClass")) {
generateVerticalSlice(BIDI_CLASS, BIDI_CLASS+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedBidiClass-" + version );
"DerivedData/DerivedBidiClass-" + version );
} else if (arg.equalsIgnoreCase("DerivedNormalizationProperties")) {
mask = Utility.setBits(0, DerivedProperty.FC_NFKC_Closure, DerivedProperty.ExpandsOnNFKC);
mask = Utility.clearBit(mask, DerivedProperty.FullCompInclusion);
generateDerived(mask, HEADER_DERIVED, "DerivedNormalizationProperties-" + version );
generateDerived(mask, HEADER_DERIVED, "DerivedData/DerivedNormalizationProperties-" + version );
} else if (arg.equalsIgnoreCase("DerivedFullNormalization")) {
mask = Utility.setBits(0, DerivedProperty.GenNFD, DerivedProperty.GenNFKC);
generateDerived(mask, HEADER_DERIVED, "DerivedFullNormalization-" + version );
generateDerived(mask, HEADER_DERIVED, "DerivedData/DerivedFullNormalization-" + version );
} else if (arg.equalsIgnoreCase("DerivedEastAsianWidth")) {
generateVerticalSlice(EAST_ASIAN_WIDTH, EAST_ASIAN_WIDTH+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedEastAsianWidth-" + version );
"DerivedData/DerivedEastAsianWidth-" + version );
} else if (arg.equalsIgnoreCase("DerivedGeneralCategory")) {
generateVerticalSlice(CATEGORY, CATEGORY+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedGeneralCategory-" + version );
"DerivedData/DerivedGeneralCategory-" + version );
} else if (arg.equalsIgnoreCase("DerivedGeneralCategoryTEST")) {
generateVerticalSlice(CATEGORY+29, CATEGORY+32, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedData/DerivedGeneralCategory-" + version );
} else if (arg.equalsIgnoreCase("DerivedCombiningClass")) {
generateVerticalSlice(COMBINING_CLASS, COMBINING_CLASS+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedCombiningClass-" + version );
"DerivedData/DerivedCombiningClass-" + version );
} else if (arg.equalsIgnoreCase("DerivedDecompositionType")) {
generateVerticalSlice(DECOMPOSITION_TYPE, DECOMPOSITION_TYPE+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedDecompositionType-" + version );
"DerivedData/DerivedDecompositionType-" + version );
} else if (arg.equalsIgnoreCase("DerivedNumericType")) {
generateVerticalSlice(NUMERIC_TYPE, NUMERIC_TYPE+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedNumericType-" + version );
"DerivedData/DerivedNumericType-" + version );
} else if (arg.equalsIgnoreCase("DerivedEastAsianWidth")) {
generateVerticalSlice(EAST_ASIAN_WIDTH, EAST_ASIAN_WIDTH+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedEastAsianWidth-" + version );
"DerivedData/DerivedEastAsianWidth-" + version );
} else if (arg.equalsIgnoreCase("DerivedJoiningType")) {
generateVerticalSlice(JOINING_TYPE, JOINING_TYPE+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedJoiningType-" + version );
"DerivedData/DerivedJoiningType-" + version );
} else if (arg.equalsIgnoreCase("DerivedJoiningGroup")) {
generateVerticalSlice(JOINING_GROUP, JOINING_GROUP+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedJoiningGroup-" + version );
"DerivedData/DerivedJoiningGroup-" + version );
} else if (arg.equalsIgnoreCase("DerivedBinaryProperties")) {
generateVerticalSlice(BINARY_PROPERTIES, BINARY_PROPERTIES+1, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedBinaryProperties-" + version );
"DerivedData/DerivedBinaryProperties-" + version );
} else if (arg.equalsIgnoreCase("DerivedNumericValues")) {
generateVerticalSlice(LIMIT_ENUM, LIMIT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedNumericValues-" + version );
"DerivedData/DerivedNumericValues-" + version );
} else if (arg.equalsIgnoreCase("DerivedCoreProperties")) {
mask = Utility.setBits(0, DerivedProperty.PropMath, DerivedProperty.Mod_ID_Continue_NO_Cf);
mask = Utility.setBits(mask, DerivedProperty.DefaultIgnorable, DerivedProperty.FC_NFC_Closure-1);
generateDerived(mask, HEADER_DERIVED, "DerivedCoreProperties-" + version );
generateDerived(mask, HEADER_DERIVED, "DerivedData/DerivedCoreProperties-" + version );
} else if (arg.equalsIgnoreCase("caseignorable")) {
mask = Utility.setBits(0, DerivedProperty.Other_Case_Ignorable, DerivedProperty.Type_i);
@ -121,23 +155,24 @@ public class GenerateData implements UCD_Types {
generateDerived(mask, HEADER_DERIVED, "NFUnsafeStart-" + version);
} else if (arg.equalsIgnoreCase("DerivedAge")) {
generateAge("DerivedAge-" + version );
generateAge("DerivedData/DerivedAge-" + version);
} else if (arg.equalsIgnoreCase("DerivedLineBreak")) {
generateVerticalSlice(LINE_BREAK, LINE_BREAK+NEXT_ENUM, KEEP_SPECIAL, HEADER_DERIVED,
"DerivedLineBreak-" + version );
"DerivedData/DerivedLineBreak-" + version );
} else if (arg.equalsIgnoreCase("Scripts")) {
generateVerticalSlice(SCRIPT+1, SCRIPT + NEXT_ENUM, KEEP_SPECIAL, HEADER_SCRIPTS, "Scripts-");
generateVerticalSlice(SCRIPT+1, SCRIPT + NEXT_ENUM,
KEEP_SPECIAL, HEADER_SCRIPTS, "DerivedData/Scripts-" + version);
} else if (arg.equalsIgnoreCase("PropList")) {
generateVerticalSlice(BINARY_PROPERTIES + White_space, BINARY_PROPERTIES + NEXT_ENUM,
KEEP_SPECIAL, HEADER_EXTEND, "PropList-" + version);
KEEP_SPECIAL, HEADER_EXTEND, "DerivedData/PropList-" + version);
} else if (arg.equalsIgnoreCase("AllBinary")) {
generateVerticalSlice(BINARY_PROPERTIES, BINARY_PROPERTIES + NEXT_ENUM,
KEEP_SPECIAL, HEADER_EXTEND, "AllBinary-" + version);
} else if (arg.equalsIgnoreCase("NormalizationTest")) {
writeNormalizerTestSuite("NormalizationTest-" + version + ".txt" );
} else if (arg.equalsIgnoreCase("generateCompExclusions")) {
generateCompExclusions();
writeNormalizerTestSuite("DerivedData/NormalizationTest-" + version + "dX.txt" );
} else if (arg.equalsIgnoreCase("CompositionExclusions")) {
generateCompExclusions(version);
}else {
System.out.println(" ! Unknown option -- must be one of the following (case-insensitive)");
System.out.println(" ! generateCompExclusions,...");
@ -149,10 +184,10 @@ public class GenerateData implements UCD_Types {
//generateDerived(Utility.setBits(0, DerivedProperty.PropMath, DerivedProperty.Mod_ID_Continue_NO_Cf),
// HEADER_DERIVED, "DerivedPropData2-" + version );
// HEADER_DERIVED, "DerivedData/DerivedPropData2-" + version );
//generateVerticalSlice(SCRIPT, SCRIPT+1, KEEP_SPECIAL, "ScriptCommon-" + version );
//listStrings("LowerCase-" + version , 0,0);
//generateVerticalSlice(0, LIMIT_ENUM, SKIP_SPECIAL, PROPLIST1, "DerivedPropData1-" + version );
//generateVerticalSlice(0, LIMIT_ENUM, SKIP_SPECIAL, PROPLIST1, "DerivedData/DerivedPropData1-" + version );
// AGE stuff
//UCD ucd = UCD.make();
@ -234,7 +269,7 @@ public class GenerateData implements UCD_Types {
public static void generateDerived (long bitMask, int headerChoice, String fileName) throws IOException {
PrintWriter output = Utility.openPrintWriter(fileName + "dX.txt");
doHeader(fileName, output, headerChoice);
for (int i = 0; i < DerivedProperty.LIMIT; ++i) {
for (int i = 0; i < DERIVED_PROPERTY_LIMIT; ++i) {
if ((bitMask & (1L<<i)) == 0) continue;
System.out.print('.');
output.println(HORIZONTAL_LINE);
@ -266,35 +301,102 @@ public class GenerateData implements UCD_Types {
}
*/
public static void generateCompExclusions() throws IOException {
PrintWriter output = Utility.openPrintWriter("CompositionExclusionsDelta.txt");
new CompLister(output).print();
public static void generateCompExclusions(String version) throws IOException {
PrintWriter output = Utility.openPrintWriter("DerivedData/CompositionExclusions-" + version + "dX.txt" );
output.println("# CompositionExclusions-" + version + ".txt");
output.println("#");
output.println("# Composition Exclusions");
output.println("# This file lists the characters from the UAX #15 Composition Exclusion Table.");
output.println("#");
output.println("# For more information, see");
output.println("# http://www.unicode.org/unicode/reports/tr15/#Primary Exclusion List Table");
output.println("# Generated: " + new Date() + ", MD");
output.println(HORIZONTAL_LINE);
output.println();
output.println("# (1) Script Specifics");
output.println("# This list of characters cannot be derived from the UnicodeData file.");
output.println(HORIZONTAL_LINE);
output.println();
new CompLister(output, ucd, 1).print();
output.println(HORIZONTAL_LINE);
output.println("# (2) Post Composition Version precomposed characters");
output.println("# These characters can be derived from a post-3.0.0 UnicodeData file");
output.println("# by comparison to the 3.0.0 UnicodeData file.");
output.println(HORIZONTAL_LINE);
output.println();
new CompLister(output, ucd, 2).print();
output.println(HORIZONTAL_LINE);
output.println("# (3) Singleton Decompositions");
output.println("# These characters can be derived from the UnicodeData file");
output.println("# by including all characters whose canonical decomposition");
output.println("# consists of a single character.");
output.println("# These characters are simply quoted here for reference.");
output.println(HORIZONTAL_LINE);
output.println();
new CompLister(output, ucd, 3).print();
output.println(HORIZONTAL_LINE);
output.println("# (4) Non-Starter Decompositions");
output.println("# These characters can be derived from the UnicodeData file");
output.println("# by including all characters whose canonical decomposition consists");
output.println("# of a sequence of characters, the first of which has a non-zero");
output.println("# combining class.");
output.println("# These characters are simply quoted here for reference.");
output.println(HORIZONTAL_LINE);
output.println();
new CompLister(output, ucd, 4).print();
output.close();
}
static class CompLister extends PropertyLister {
UCD oldUCD;
int oldLength = 0;
int type;
public CompLister(PrintWriter output) {
public CompLister(PrintWriter output, UCD ucd, int type) {
this.output = output;
ucdData = UCD.make("3.1.0");
oldUCD = UCD.make("3.0.0");
showOnConsole = true;
ucdData = ucd;
oldUCD = UCD.make("3.0.1");
// showOnConsole = true;
alwaysBreaks = type <= 2; // CHANGE LATER
commentOut = type > 2;
this.type = type;
}
public String optionalComment(int cp) { return ""; }
/*
public String propertyName(int cp) {
return UTF32.length32(ucdData.getDecompositionMapping(cp)) + "";
}
*/
public byte status(int cp) {
if (ucdData.getDecompositionType(cp) == CANONICAL
&& oldUCD.getDecompositionType(cp) != CANONICAL) {
int temp = oldLength;
oldLength = UTF32.length32(ucdData.getDecompositionMapping(cp));
if (temp != oldLength) return BREAK;
return INCLUDE;
}
if (getType(cp) == type) return INCLUDE;
return EXCLUDE;
}
public int getType(int cp) {
if (!ucdData.isAssigned(cp)) return -1;
if (ucdData.getDecompositionType(cp) != CANONICAL) return -1;
if (oldUCD.getBinaryProperty(cp, CompositionExclusion)) return 1;
if (cp == 0xFB1D) return 1; // special
String decomp = ucdData.getDecompositionMapping(cp);
int len = UTF32.length32(decomp);
if (len == 1) return 3;
int first = UTF32.char32At(decomp,0);
if (ucdData.getCombiningClass(first) != 0) return 4;
if (oldUCD.getDecompositionType(cp) == CANONICAL) return -1;
if (ucdData.getDecompositionType(cp) == CANONICAL) return 2;
return -1;
}
}
public static void partitionProperties() throws IOException {
@ -306,7 +408,7 @@ public class GenerateData implements UCD_Types {
for (int i = 1; i < LIMIT_ENUM; ++i) { // || iType == SCRIPT
int iType = i & 0xFF00;
if (iType == JOINING_GROUP || iType == AGE || iType == COMBINING_CLASS) continue;
if (!ubp.isDefined(i)) continue;
if (UnifiedBinaryProperty.make(i, ucd) == null) continue;
props[count++] = i;
}
System.out.println("props: " + count);
@ -321,7 +423,8 @@ public class GenerateData implements UCD_Types {
if (!ucd.isAllocated(cp)) continue;
for (int i = 0; i < count; ++i) {
boolean iProp = ubp.get(cp, props[i]);
UnicodeProperty up = UnifiedBinaryProperty.make(props[i], ucd);
boolean iProp = up.hasValue(cp);
if (iProp) probe.set(i); else probe.clear(i);
}
@ -344,9 +447,11 @@ public class GenerateData implements UCD_Types {
for (int i = 1; i < LIMIT_ENUM; ++i) {
int iType = i & 0xFF00;
if (iType == JOINING_GROUP || iType == AGE || iType == COMBINING_CLASS || iType == SCRIPT) continue;
if (!ubp.isDefined(i)) continue;
String iNameShort = ubp.getFullID(i, SHORT);
String iNameLong = ubp.getFullID(i, LONG);
UnicodeProperty upi = UnifiedBinaryProperty.make(i, ucd);
if (upi == null) continue;
String iNameShort = upi.getFullName(SHORT);
String iNameLong = upi.getFullName(LONG);
System.out.println();
System.out.println();
@ -358,7 +463,8 @@ public class GenerateData implements UCD_Types {
int jType = j & 0xFF00;
if (jType == JOINING_GROUP || jType == AGE || jType == COMBINING_CLASS || jType == SCRIPT
|| (jType == iType && jType != BINARY_PROPERTIES)) continue;
if (!ubp.isDefined(j)) continue;
UnicodeProperty upj = UnifiedBinaryProperty.make(j, ucd);
if (upj == null) continue;
if ((j >> 8) != last) {
last = j >> 8;
@ -378,8 +484,8 @@ public class GenerateData implements UCD_Types {
if (cat == UNASSIGNED || cat == PRIVATE_USE || cat == SURROGATE) continue;
if (!ucd.isAllocated(cp)) continue;
boolean iProp = ubp.get(cp, i);
boolean jProp = ubp.get(cp, j);
boolean iProp = upi.hasValue(cp);
boolean jProp = upj.hasValue(cp);
if (jProp) ++jCount;
if (iProp) {
@ -390,7 +496,7 @@ public class GenerateData implements UCD_Types {
}
if (iCount == 0 || jCount == 0) continue;
String jNameShort = ubp.getFullID(j, SHORT);
String jNameShort = upj.getFullName(SHORT);
//String jNameLong = ubp.getFullID(j, LONG);
String rel = bothCount == 0 ? "DISJOINT"
@ -484,19 +590,21 @@ public class GenerateData implements UCD_Types {
if (type == AGE) continue;
if (i == (BINARY_PROPERTIES | CaseFoldTurkishI)) continue;
UnicodeProperty up = UnifiedBinaryProperty.make(i, ucd);
if (up == null) continue;
if (!up.isStandard()) continue;
if (type == i && type != BINARY_PROPERTIES && type != DERIVED) {
propAbb = fixGaps(ubp.getPropertyName(i, SHORT), false);
prop = fixGaps(ubp.getPropertyName(i, LONG), true);
propAbb = fixGaps(up.getProperty(SHORT), false);
prop = fixGaps(up.getProperty(LONG), true);
spacing = Utility.repeat(" ", 10-propAbb.length());
sorted.add("BB; " + propAbb + spacing + "; " + prop);
checkDuplicate(duplicates, accumulation, propAbb, prop);
if (!prop.equals(propAbb)) checkDuplicate(duplicates, accumulation, prop, prop);
}
if (!ubp.isDefined(i)) continue;
if (ubp.isTest(i)) continue;
value = ubp.getID(i, LONG);
value = up.getValue(LONG);
if (value.length() == 0) value = "none";
else if (value.equals("<unused>")) continue;
value = fixGaps(value, true);
@ -505,7 +613,7 @@ public class GenerateData implements UCD_Types {
value = ucd.getCase(value, FULL, TITLE);
}
valueAbb = ubp.getID(i, SHORT);
valueAbb = up.getValue(SHORT);
if (valueAbb.length() == 0) valueAbb = "no";
valueAbb = fixGaps(valueAbb, false);
@ -720,7 +828,9 @@ public class GenerateData implements UCD_Types {
doHeader(file, output, headerChoice);
int last = -1;
for (int i = startEnum; i < endEnum; ++i) {
if (!ubp.isDefined(i)) continue;
UnicodeProperty up = UnifiedBinaryProperty.make(i, ucd);
if (up == null) continue;
if (i == DECOMPOSITION_TYPE || i == NUMERIC_TYPE
|| i == (BINARY_PROPERTIES | Non_break)
|| i == (BINARY_PROPERTIES | CaseFoldTurkishI)
@ -733,18 +843,20 @@ public class GenerateData implements UCD_Types {
if ((last & 0xFF00) != (i & 0xFF00) && (i <= BINARY_PROPERTIES || i >= SCRIPT)) {
output.println();
output.println(HORIZONTAL_LINE);
output.println("# " + UCD_Names.UNIFIED_PROPERTIES[i>>8]);
output.println("# " + up.getHeader());
output.println(HORIZONTAL_LINE);
output.println();
System.out.println();
System.out.println(UCD_Names.UNIFIED_PROPERTIES[i>>8]);
System.out.println(up.getHeader());
last = i;
} else {
output.println(HORIZONTAL_LINE);
output.println();
}
System.out.print(".");
if (DEBUG) System.out.println(i);
new MyPropertyLister(ucd, i, output).print();
output.flush();
}
if (endEnum == LIMIT_ENUM) {
output.println();

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/MyPropertyLister.java,v $
* $Date: 2001/10/25 20:33:46 $
* $Revision: 1.4 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.5 $
*
*******************************************************************************
*/
@ -22,13 +22,13 @@ final class MyPropertyLister extends PropertyLister {
private int propMask;
UnifiedBinaryProperty ubp;
UnicodeProperty up;
public MyPropertyLister(UCD ucd, int propMask, PrintWriter output) {
this.propMask = propMask;
this.output = output;
this.ucdData = ucd;
ubp = new UnifiedBinaryProperty(ucd);
up = UnifiedBinaryProperty.make(propMask, ucd);
if (propMask < COMBINING_CLASS) usePropertyComment = false; // skip gen cat
}
@ -43,14 +43,17 @@ final class MyPropertyLister extends PropertyLister {
} else if (main == JOINING_GROUP) {
return "";
} else {
String shortID = ubp.getID(propMask, SHORT);
String longID = ubp.getID(propMask, LONG);
return "# " + shortID + (shortID.equals(longID) ? "" : "\t(" + longID + ")");
return "";
/*
String shortID = up.getName(SHORT);
String longID = up.getName(LONG);
return "# ???? " + shortID + (shortID.equals(longID) ? "" : "\t(" + longID + ")");
*/
}
}
public String propertyName(int cp) {
return ubp.getID(propMask);
return up.getValue(cp);
}
public String optionalComment(int cp) {
@ -87,7 +90,7 @@ final class MyPropertyLister extends PropertyLister {
else return EXCLUDE;
}
boolean inSet = ubp.get(cp, propMask);
boolean inSet = up.hasValue(cp);
/*
if (cp >= 0x1D400 && cp <= 0x1D7C9 && cat != Cn) {
if (propMask == (SCRIPT | LATIN_SCRIPT)) inSet = cp <= 0x1D6A3;

View file

@ -61,7 +61,7 @@ public final class NFSkippable extends UnicodeProperty {
String cause = "";
public boolean hasProperty(int cp) {
public boolean hasValue(int cp) {
// quick check on some special classes
if (DEBUG) cause = "\t\tunassigned";
if (!ucd.isAssigned(cp)) return true;
@ -196,7 +196,7 @@ public final class NFSkippable extends UnicodeProperty {
PrintWriter out = Utility.openPrintWriter("NFSafeSets.txt");
for (int mode = NFD_UnsafeStart; mode <= NFKC_UnsafeStart; ++mode) {
UnicodeProperty up = DerivedProperty.getProperty(mode, UCD.make(version));
UnicodeProperty up = DerivedProperty.make(mode, UCD.make(version));
generateSet(out, "UNSAFE[" + Normalizer.getName((byte)(mode-NFD_UnsafeStart)) + "]", up);
}
@ -213,7 +213,7 @@ public final class NFSkippable extends UnicodeProperty {
UnicodeSet result = new UnicodeSet();
for (int cp = 0; cp <= limit; ++cp) {
Utility.dot(cp);
if (up.hasProperty(cp)) result.add(cp);
if (up.hasValue(cp)) result.add(cp);
}
Utility.fixDot();

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/PropertyLister.java,v $
* $Date: 2001/12/03 19:29:35 $
* $Revision: 1.4 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.5 $
*
*******************************************************************************
*/
@ -33,6 +33,7 @@ abstract public class PropertyLister implements UCD_Types {
protected int firstRealCp = -2;
protected int lastRealCp = -2;
protected boolean alwaysBreaks = false; // set to true if property only breaks
protected boolean commentOut = false;
private UnicodeSet set = new UnicodeSet();
public static final byte INCLUDE = 0, BREAK = 1, CONTINUE = 2, EXCLUDE = 3;
@ -69,11 +70,17 @@ abstract public class PropertyLister implements UCD_Types {
try {
set.add(startCp, endCp);
String prop = propertyName(startCp);
String opt = "";
String optCom = "";
String commentSep = " # ";
if (commentOut) commentSep = "";
if (prop.length() > 0) prop = "; " + prop;
String opt = optionalName(startCp);
opt = optionalName(startCp);
if (opt.length() > 0) opt = "; " + opt;
String optCom = optionalComment(startCp);
optCom = optionalComment(startCp);
if (optCom.length() > 0) optCom += " ";
String startName = getKenName(startCp);
String line;
String pgap = Utility.repeat(" ", minPropertyWidth() - prop.length() - opt.length());
@ -85,7 +92,7 @@ abstract public class PropertyLister implements UCD_Types {
String gap = Utility.repeat(" ", 12 - width(startCp) - width(endCp));
line = Utility.hex(startCp,4) + ".." + Utility.hex(endCp,4) + gap
+ prop + opt + pgap + " # " + optCom
+ prop + opt + pgap + commentSep + optCom
+ countStr;
if (startName.length() != 0 || endName.length() != 0) {
int com = 0;
@ -105,9 +112,12 @@ abstract public class PropertyLister implements UCD_Types {
? " "
: " ";
line = Utility.hex(startCp,4) + gap
+ prop + opt + pgap + " # " + optCom + gap2
+ prop + opt + pgap + commentSep + optCom + gap2
+ startName;
}
if (commentOut) {
line = "# " + line;
}
output.println(line);
if (showOnConsole) System.out.println(line);
} catch (Exception e) {
@ -170,6 +180,7 @@ abstract public class PropertyLister implements UCD_Types {
}
for (int cp = 0; cp <= 0x10FFFF; ++cp) {
byte s = status(cp);
if (alwaysBreaks && s == INCLUDE) s = BREAK;
if (s == INCLUDE && firstRealCp != -1) {
byte cat = ucdData.getCategory(cp);
if (cat == Lt || cat == Ll) cat = Lu;
@ -216,11 +227,12 @@ abstract public class PropertyLister implements UCD_Types {
if (count == 0) System.out.println("WARNING -- ZERO COUNT FOR " + header);
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(0);
nf.setGroupingUsed(false);
output.println();
output.println("# Total code points: " + nf.format(count));
output.println();
System.out.println(headerString());
System.out.println(set.toPattern(true));
//System.out.println(headerString());
//System.out.println(set.toPattern(true));
return count;
}

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/TestData.java,v $
* $Date: 2001/10/25 20:33:46 $
* $Revision: 1.5 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.6 $
*
*******************************************************************************
*/
@ -172,7 +172,7 @@ public class TestData implements UCD_Types {
doHeader(fileName, output, headerChoice);
for (int i = 0; i < 32; ++i) {
if ((bitMask & (1<<i)) == 0) continue;
if (i >= DerivedProperty.LIMIT) break;
if (i >= DERIVED_PROPERTY_LIMIT) break;
System.out.print('.');
output.println("# ================================================");
output.println();
@ -251,11 +251,12 @@ public class TestData implements UCD_Types {
PrintWriter output = Utility.openPrintWriter(file);
doHeader(file, output, headerChoice);
UnifiedBinaryProperty ubp = new UnifiedBinaryProperty(ucd);
int last = -1;
for (int i = startEnum; i < endEnum; ++i) {
if (!ubp.isDefined(i)) continue;
UnicodeProperty up = UnifiedBinaryProperty.make(i, ucd);
if (up == null) continue;
if (i == DECOMPOSITION_TYPE || i == NUMERIC_TYPE
|| i == (CATEGORY | UNUSED_CATEGORY)
|| i == (BINARY_PROPERTIES | Non_break)

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/UCD.java,v $
* $Date: 2001/12/03 19:29:35 $
* $Revision: 1.6 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.7 $
*
*******************************************************************************
*/
@ -25,6 +25,9 @@ import com.ibm.text.utility.*;
public final class UCD implements UCD_Types {
static final boolean DEBUG = false;
/**
* Used for the default version.
*/
@ -306,7 +309,7 @@ public final class UCD implements UCD_Types {
StringBuffer result = new StringBuffer();
int cp;
byte currentCaseType = caseType;
DerivedProperty dp = new DerivedProperty(this);
UnicodeProperty defaultIgnorable = DerivedProperty.make(DerivedProperty.DefaultIgnorable, this);
for (int i = 0; i < s.length(); i += UTF32.count16(cp)) {
cp = UTF32.char32At(s, i);
@ -318,7 +321,7 @@ public final class UCD implements UCD_Types {
if (cp == SHY || cp == '\'' || cp == APOSTROPHE) continue;
byte cat = getCategory(cp);
if (cat == Mn || cat == Me || cat == Cf || cat == Lm) continue;
if (dp.hasProperty(cp, DerivedProperty.DefaultIgnorable)) continue;
if (defaultIgnorable.hasValue(cp)) continue;
// if DefaultIgnorable is not supported, then
// check for (Cf + Cc + Cs) - White_Space
// if (cat == Cs && cp != 0x85 && (cp < 9 || cp > 0xD)) continue;
@ -543,6 +546,10 @@ public final class UCD implements UCD_Types {
return UCD_Names.GC[prop];
}
public static String getCategoryID_fromIndex(byte prop, byte style) {
return (style != LONG) ? UCD_Names.GC[prop] : UCD_Names.LONG_GC[prop];
}
public String getCombiningID(int codePoint, byte style) {
return getCombiningID_fromIndex(getCombiningClass(codePoint), style);
}
@ -585,7 +592,11 @@ public final class UCD implements UCD_Types {
}
public static String getBidiClassID_fromIndex(byte prop) {
return UCD_Names.BC[prop];
return getBidiClassID_fromIndex(prop, NORMAL);
}
public static String getBidiClassID_fromIndex(byte prop, byte style) {
return style == SHORT ? UCD_Names.BC[prop] : UCD_Names.LONG_BC[prop];
}
public String getCombiningClassID(int codePoint) {
@ -601,7 +612,10 @@ public final class UCD implements UCD_Types {
}
public static String getDecompositionTypeID_fromIndex(byte prop) {
return UCD_Names.DT[prop];
return getDecompositionTypeID_fromIndex(NORMAL);
}
public static String getDecompositionTypeID_fromIndex(byte prop, byte style) {
return style == SHORT ? UCD_Names.SHORT_DT[prop] : UCD_Names.DT[prop];
}
public String getNumericTypeID(int codePoint) {
@ -665,7 +679,11 @@ public final class UCD implements UCD_Types {
}
public static String getBinaryPropertiesID_fromIndex(byte bit) {
return UCD_Names.BP[bit];
return getBinaryPropertiesID_fromIndex(bit, NORMAL);
}
public static String getBinaryPropertiesID_fromIndex(byte bit, byte style) {
return style == SHORT ? UCD_Names.SHORT_BP[bit] : UCD_Names.BP[bit];
}
public static int mapToRepresentative(int ch, boolean old) {
@ -832,6 +850,9 @@ to guarantee identifier closure.
// access data for codepoint
UData get(int codePoint, boolean fixStrings) {
if (codePoint < 0 || codePoint > 0x10FFFF) {
throw new IllegalArgumentException("Illegal Code Point: " + Utility.hex(codePoint));
}
//if (codePoint == lastCode && fixStrings <= lastCodeFixed) return lastResult;
/*
// we play some funny tricks for performance
@ -1026,7 +1047,7 @@ to guarantee identifier closure.
UData uData = new UData();
uData.readBytes(dataIn);
if (uData.codePoint == 0x2801) {
if (DEBUG && uData.codePoint == 0x2801) {
System.out.println("SPOT-CHECK: " + uData);
}

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/UCD_Names.java,v $
* $Date: 2001/12/03 19:29:35 $
* $Revision: 1.8 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.9 $
*
*******************************************************************************
*/
@ -264,7 +264,11 @@ final class UCD_Names implements UCD_Types {
"OLD-ITALIC",
"GOTHIC",
"DESERET",
"INHERITED",
"INHERITED", // nonspacing marks
"TAGALOG",
"HANUNOO",
"BUHID",
"TAGBANWA",
};
public static final String[] ABB_SCRIPT = {
@ -310,6 +314,10 @@ final class UCD_Names implements UCD_Types {
"Goth",
"Dsrt",
"Qaai",
"Taga",
"Hanu",
"Buhi",
"Tagb",
};
@ -521,16 +529,16 @@ final class UCD_Names implements UCD_Types {
};
static {
if (LIMIT_CATEGORY != GC.length) {
if (LIMIT_CATEGORY != GC.length || LIMIT_CATEGORY != LONG_GC.length) {
System.err.println("!! ERROR !! UnicodeTypes and UInfo out of sync: category");
}
if (LIMIT_BIDI_CLASS != BC.length) {
System.err.println("!! ERROR !! UnicodeTypes and UInfo out of sync: bidi");
}
if (LIMIT_LINE_BREAK != LB.length) {
if (LIMIT_LINE_BREAK != LB.length || LIMIT_LINE_BREAK != LONG_LB.length) {
System.err.println("!! ERROR !! UnicodeTypes and UInfo out of sync: linebreak");
}
if (LIMIT_DECOMPOSITION_TYPE != DT.length) {
if (LIMIT_DECOMPOSITION_TYPE != DT.length || LIMIT_DECOMPOSITION_TYPE != SHORT_DT.length) {
System.err.println("!! ERROR !! UnicodeTypes and UInfo out of sync: compat type");
}
if (MIRRORED_LIMIT != MIRRORED_TABLE.length) {

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/UCD_Types.java,v $
* $Date: 2001/12/03 19:29:34 $
* $Revision: 1.5 $
* $Date: 2001/12/05 02:41:23 $
* $Revision: 1.6 $
*
*******************************************************************************
*/
@ -315,7 +315,11 @@ public interface UCD_Types {
GOTHIC_SCRIPT = 39,
DESERET_SCRIPT = 40,
INHERITED_SCRIPT = 41,
LIMIT_SCRIPT = 42;
TAGALOG_SCRIPT = 42,
HANUNOO_SCRIPT = 43,
BUHID_SCRIPT = 44,
TAGBANWA_SCRIPT = 45,
LIMIT_SCRIPT = 46;
static final int
UNKNOWN = 0,
@ -458,6 +462,6 @@ public static byte
NFKD_Skippable = 43,
NFKC_Skippable = 44,
LIMIT = 41;
DERIVED_PROPERTY_LIMIT = 41;
}

View file

@ -1,44 +1,118 @@
package com.ibm.text.UCD;
public abstract class UnicodeProperty implements UCD_Types {
protected UCD ucd;
protected boolean isStandard = true;
protected byte defaultStyle = LONG;
protected String name, shortName, header;
protected UCD ucd;
protected boolean isStandard = true;
protected boolean hasUnassigned = false;
protected boolean valueVaries = false;
protected byte defaultValueStyle = SHORT;
protected byte defaultPropertyStyle = LONG;
protected String valueName = "YES";
protected String shortValueName = "Y";
protected String header;
protected String subheader;
protected String name;
protected String shortName;
// Old Names for compatibility
boolean isTest() { return isStandard(); }
/**
* Return the UCD in use
*/
public UCD getUCD() { return ucd; }
/**
* Is it part of the standard, or just for my testing?
*/
public boolean isStandard() { return isStandard; }
public void setStandard(boolean in) { isStandard = in; }
/**
* Get the property name. Style is SHORT, NORMAL, LONG
* Does it apply to any unassigned characters?
*/
public String getName(byte style) {
if (style == NORMAL) style = defaultStyle;
return style < LONG ? shortName : name;
}
public boolean hasUnassigned() { return hasUnassigned; }
public void setHasUnassigned(boolean in) { hasUnassigned = in; }
/** Header used in DerivedXXX files
*/
public String getHeader() { return header; }
public void setHeader(String in) { header = in; }
/** Header used in DerivedXXX files
*/
public String getSubHeader() { return subheader; }
public void setSubHeader(String in) { subheader = in; }
/**
* Get the full name. Style is SHORT, NORMAL, LONG
*/
public String getFullName(byte style) {
return getProperty(style) + "=" + getValue(style);
}
public String getFullName() {
return getFullName(NORMAL);
}
/**
* Get the property name. Style is SHORT, NORMAL, LONG
*/
public String getProperty(byte style) {
if (style == NORMAL) style = defaultPropertyStyle;
return style < LONG ? shortName : name;
}
public String getProperty() { return getProperty(NORMAL); }
public void setProperty(byte style, String in) {
switch (style) {
case LONG: name = in; break;
case SHORT: shortName = in; break;
default: throw new IllegalArgumentException("Bad property: " + style);
}
}
/**
* Get the value name. Style is SHORT, NORMAL, LONG
* "" if hasValue is false
* MUST OVERRIDE getValue(cp...) if valueVaries
*/
public String getValue(int cp, byte style) {
if (!hasValue(cp)) return "";
return getValue(style);
}
public String getValue(int cp) { return getValue(cp, NORMAL); }
public void setValue(byte style, String in) {
if (valueVaries) throw new IllegalArgumentException("Can't set varying value: " + style);
switch (style) {
case LONG: valueName = in; break;
case SHORT: shortValueName = in; break;
default: throw new IllegalArgumentException("Bad value: " + style);
}
}
public String getValue(byte style) {
if (valueVaries) throw new IllegalArgumentException("Value varies; call getValue(cp)");
if (style == NORMAL) style = defaultValueStyle;
return style < LONG ? shortValueName : valueName;
}
/**
* Does getProperty vary in contents?
*/
public boolean propertyVaries() { return false; }
public boolean valueVaries() { return valueVaries; }
public void setValueVaries(boolean in) { valueVaries = in; }
/**
* Get the property value as a string, or "" if hasProperty is false
* Does it have the propertyValue?
*/
public String getProperty(int cp) { return hasProperty(cp) ? name : ""; }
abstract boolean hasValue(int cp);
///////////////////////////////////////////
// Old Name for compatibility
boolean isTest() { return isStandard(); }
String getName(byte style) { return getProperty(style); }
String getName() { return getProperty(); }
/**
* Does it have the propertyValue
*/
abstract boolean hasProperty(int cp);
}

View file

@ -5,41 +5,92 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/UCD/UnifiedBinaryProperty.java,v $
* $Date: 2001/10/25 20:37:09 $
* $Revision: 1.1 $
* $Date: 2001/12/05 02:41:22 $
* $Revision: 1.2 $
*
*******************************************************************************
*/
package com.ibm.text.UCD;
import java.io.*;
import java.util.*;
import com.ibm.text.utility.*;
final class UnifiedBinaryProperty implements UCD_Types {
UCD ucd;
DerivedProperty dp;
final class UnifiedBinaryProperty extends UnicodeProperty {
int majorProp;
int propValue;
// DerivedProperty dp;
UnifiedBinaryProperty(UCD ucdin) {
public static UnicodeProperty make(int propMask, UCD ucd) {
if ((propMask & 0xFF00) == DERIVED) {
return DerivedProperty.make(propMask & 0xFF, ucd);
}
if (!isDefined(propMask, ucd)) return null;
return getCached(propMask, ucd);
}
static Map cache = new HashMap();
static UCD lastUCD = null;
static int lastPropMask = -1;
static UnifiedBinaryProperty lastValue = null;
static Clump probeClump = new Clump();
static class Clump {
int prop;
UCD ucd;
public boolean equals(Object other) {
Clump that = (Clump) other;
return (that.prop != prop || !ucd.equals(that));
}
}
private static UnifiedBinaryProperty getCached(int propMask, UCD ucd) {
if (ucd.equals(lastUCD) && propMask == lastPropMask) return lastValue;
probeClump.prop = propMask;
probeClump.ucd = ucd;
UnifiedBinaryProperty dp = (UnifiedBinaryProperty) cache.get(probeClump);
if (dp == null) {
dp = new UnifiedBinaryProperty(propMask, ucd);
cache.put(probeClump, dp);
probeClump = new Clump();
}
lastUCD = ucd;
lastValue = dp;
lastPropMask = propMask;
return dp;
}
/////////////////////////////////
private UnifiedBinaryProperty(int propMask, UCD ucdin) {
ucd = ucdin;
dp = new DerivedProperty(ucd);
}
public String getPropertyName(int propMask, byte style) {
if (style < LONG) return UCD_Names.ABB_UNIFIED_PROPERTIES[propMask>>8];
else return UCD_Names.SHORT_UNIFIED_PROPERTIES[propMask>>8];
majorProp = propMask >> 8;
propValue = propMask & 0xFF;
header = UCD_Names.UNIFIED_PROPERTIES[majorProp];
name = UCD_Names.ABB_UNIFIED_PROPERTIES[majorProp];
shortName = UCD_Names.SHORT_UNIFIED_PROPERTIES[majorProp];
valueName = _getValue(LONG);
shortValueName = _getValue(SHORT);
defaultValueStyle = _getDefaultStyle();
System.out.println("Value = " + getValue(defaultValueStyle));
// System.out.println(majorProp + ", " + propValue + ", " + name);
// dp = new DerivedProperty(ucd);
}
/*
public boolean isTest(int propMask) {
int enum = propMask >> 8;
propMask &= 0xFF;
if (enum != (DERIVED>>8)) return false;
return dp.isTest(propMask);
return DerivedProperty.make(propMask, ucd).isTest();
}
*/
/**
* @return unified property number
*/
/*
public boolean isDefined(int propMask) {
int enum = propMask >> 8;
propMask &= 0xFF;
@ -58,48 +109,85 @@ final class UnifiedBinaryProperty implements UCD_Types {
case BINARY_PROPERTIES>>8: return propMask < LIMIT_BINARY_PROPERTIES;
case SCRIPT>>8: return propMask != UNUSED_SCRIPT && propMask < LIMIT_SCRIPT;
case AGE>>8: return propMask < LIMIT_AGE;
case DERIVED>>8: return dp.isDefined(propMask);
case DERIVED>>8:
UnicodeProperty up = DerivedProperty.make(propMask, ucd);
return (up != null);
default: return false;
}
}
public boolean get(int cp, int propMask) {
int enum = propMask >> 8;
propMask &= 0xFF;
switch (enum) {
case CATEGORY>>8: if (propMask >= LIMIT_CATEGORY) break;
return ucd.getCategory(cp) == propMask;
case COMBINING_CLASS>>8: if (propMask >= LIMIT_COMBINING_CLASS) break;
return ucd.getCombiningClass(cp) == propMask;
case BIDI_CLASS>>8: if (propMask >= LIMIT_BIDI_CLASS) break;
return ucd.getBidiClass(cp) == propMask;
case DECOMPOSITION_TYPE>>8: if (propMask >= LIMIT_DECOMPOSITION_TYPE) break;
return ucd.getDecompositionType(cp) == propMask;
case NUMERIC_TYPE>>8: if (propMask >= LIMIT_NUMERIC_TYPE) break;
return ucd.getNumericType(cp) == propMask;
case EAST_ASIAN_WIDTH>>8: if (propMask >= LIMIT_EAST_ASIAN_WIDTH) break;
return ucd.getEastAsianWidth(cp) == propMask;
case LINE_BREAK>>8: if (propMask >= LIMIT_LINE_BREAK) break;
return ucd.getLineBreak(cp) == propMask;
case JOINING_TYPE>>8: if (propMask >= LIMIT_JOINING_TYPE) break;
return ucd.getJoiningType(cp) == propMask;
case JOINING_GROUP>>8: if (propMask >= LIMIT_JOINING_GROUP) break;
return ucd.getJoiningGroup(cp) == propMask;
case BINARY_PROPERTIES>>8: if (propMask >= LIMIT_BINARY_PROPERTIES) break;
return ucd.getBinaryProperty(cp, propMask);
case SCRIPT>>8: if (propMask >= LIMIT_SCRIPT) break;
return ucd.getScript(cp) == propMask;
case AGE>>8: if (propMask >= LIMIT_AGE) break;
return ucd.getAge(cp) == propMask;
case DERIVED>>8: if (!dp.isDefined(propMask)) break;
return dp.hasProperty(cp, propMask);
*/
static private boolean isDefined(int propMask, UCD ucd) {
int majorProp = propMask >> 8;
int propValue = propMask & 0xFF;
switch (majorProp) {
case CATEGORY>>8: if (propValue >= LIMIT_CATEGORY) break;
if (propValue == UNUSED_CATEGORY) break;
return true;
case COMBINING_CLASS>>8: if (propValue >= LIMIT_COMBINING_CLASS) break;
return ucd.isCombiningClassUsed((byte)propValue);
case BIDI_CLASS>>8: if (propValue >= LIMIT_BIDI_CLASS) break;
if (propValue == BIDI_UNUSED) break;
return true;
case DECOMPOSITION_TYPE>>8: if (propValue >= LIMIT_DECOMPOSITION_TYPE) break;
return true;
case NUMERIC_TYPE>>8: if (propValue >= LIMIT_NUMERIC_TYPE) break;
return true;
case EAST_ASIAN_WIDTH>>8: if (propValue >= LIMIT_EAST_ASIAN_WIDTH) break;
return true;
case LINE_BREAK>>8: if (propValue >= LIMIT_LINE_BREAK) break;
return true;
case JOINING_TYPE>>8: if (propValue >= LIMIT_JOINING_TYPE) break;
return true;
case JOINING_GROUP>>8: if (propValue >= LIMIT_JOINING_GROUP) break;
return true;
case BINARY_PROPERTIES>>8: if (propValue >= LIMIT_BINARY_PROPERTIES) break;
return true;
case SCRIPT>>8: if (propValue >= LIMIT_SCRIPT) break;
if (propValue == UNUSED_SCRIPT) break;
return true;
case AGE>>8: if (propValue >= LIMIT_AGE) break;
return true;
/*
case DERIVED>>8:
UnicodeProperty up = DerivedProperty.make(propValue, ucd);
if (up == null) break;
return up.hasValue(cp);
*/
}
return false;
}
public boolean hasValue(int cp) {
try {
switch (majorProp) {
case CATEGORY>>8: return ucd.getCategory(cp) == propValue;
case COMBINING_CLASS>>8: return ucd.getCombiningClass(cp) == propValue;
case BIDI_CLASS>>8: return ucd.getBidiClass(cp) == propValue;
case DECOMPOSITION_TYPE>>8: return ucd.getDecompositionType(cp) == propValue;
case NUMERIC_TYPE>>8: return ucd.getNumericType(cp) == propValue;
case EAST_ASIAN_WIDTH>>8: return ucd.getEastAsianWidth(cp) == propValue;
case LINE_BREAK>>8: return ucd.getLineBreak(cp) == propValue;
case JOINING_TYPE>>8: return ucd.getJoiningType(cp) == propValue;
case JOINING_GROUP>>8: return ucd.getJoiningGroup(cp) == propValue;
case BINARY_PROPERTIES>>8: return ucd.getBinaryProperty(cp, propValue);
case SCRIPT>>8: return ucd.getScript(cp) == propValue;
case AGE>>8: return ucd.getAge(cp) == propValue;
/*
case DERIVED>>8:
UnicodeProperty up = DerivedProperty.make(propValue, ucd);
if (up == null) break;
return up.hasValue(cp);
*/
}
throw new ChainException("Illegal property Number {0}, {1}", new Object[]{
new Integer(majorProp), new Integer(propValue)});
} catch (RuntimeException e) {
throw new ChainException("Illegal property Number {0}, {1}", new Object[]{
new Integer(majorProp), new Integer(propValue)}, e);
}
throw new ChainException("Illegal property Number {0}", new Object[]{new Integer(propMask)});
}
public String getID(int unifiedPropMask) {
return getID(unifiedPropMask, NORMAL);
}
/*
public static String getID(UCD ucd, int unifiedPropMask) {
String longOne = getID(ucd, unifiedPropMask, LONG);
@ -108,18 +196,18 @@ final class UnifiedBinaryProperty implements UCD_Types {
return shortOne + "(" + longOne + ")";
}
*/
public String getFullID(int unifiedPropMask, byte style) {
public String getFullName(byte style) {
String pre = "";
if ((unifiedPropMask & 0xFF00) != BINARY_PROPERTIES) {
String preShort = UCD_Names.ABB_UNIFIED_PROPERTIES[unifiedPropMask>>8] + "=";
String preLong = UCD_Names.SHORT_UNIFIED_PROPERTIES[unifiedPropMask>>8] + "=";
if ((majorProp) != BINARY_PROPERTIES>>8) {
String preShort = UCD_Names.ABB_UNIFIED_PROPERTIES[majorProp] + "=";
String preLong = UCD_Names.SHORT_UNIFIED_PROPERTIES[majorProp] + "=";
if (style < LONG) pre = preShort;
else if (style == LONG || preShort.equals(preLong)) pre = preLong;
else pre = preShort + "(" + preLong + ")";
}
String shortOne = getID(unifiedPropMask, SHORT);
String shortOne = getValue(SHORT);
if (shortOne.length() == 0) shortOne = "xx";
String longOne = getID(unifiedPropMask, LONG);
String longOne = getValue(LONG);
if (longOne.length() == 0) longOne = "none";
String post;
@ -135,46 +223,72 @@ final class UnifiedBinaryProperty implements UCD_Types {
return pre + post;
}
public String getID(int unifiedPropMask, byte style) {
int enum = unifiedPropMask >> 8;
byte propMask = (byte)unifiedPropMask;
switch (enum) {
case CATEGORY>>8: if (propMask >= LIMIT_CATEGORY) break;
if (style != LONG) return ucd.getCategoryID_fromIndex(propMask);
return UCD_Names.LONG_GC[propMask];
case COMBINING_CLASS>>8: if (propMask >= LIMIT_COMBINING_CLASS) break;
return UCD.getCombiningID_fromIndex((short)(unifiedPropMask & 0xFF), style);
case BIDI_CLASS>>8: if (propMask >= LIMIT_BIDI_CLASS) break;
if (style != LONG) return ucd.getBidiClassID_fromIndex(propMask);
return UCD_Names.LONG_BC[propMask];
case DECOMPOSITION_TYPE>>8: if (propMask >= LIMIT_DECOMPOSITION_TYPE) break;
if (style != SHORT) return ucd.getDecompositionTypeID_fromIndex(propMask);
return UCD_Names.SHORT_DT[propMask];
case NUMERIC_TYPE>>8: if (propMask >= LIMIT_NUMERIC_TYPE) break;
if (style != SHORT) return ucd.getNumericTypeID_fromIndex(propMask);
return UCD_Names.SHORT_NT[propMask];
case EAST_ASIAN_WIDTH>>8: if (propMask >= LIMIT_EAST_ASIAN_WIDTH) break;
if (style != LONG) return ucd.getEastAsianWidthID_fromIndex(propMask);
return UCD_Names.SHORT_EA[propMask];
case LINE_BREAK>>8: if (propMask >= LIMIT_LINE_BREAK) break;
if (style != LONG) return ucd.getLineBreakID_fromIndex(propMask);
return UCD_Names.LONG_LB[propMask];
case JOINING_TYPE>>8: if (propMask >= LIMIT_JOINING_TYPE) break;
if (style != LONG) return ucd.getJoiningTypeID_fromIndex(propMask);
return UCD_Names.LONG_JOINING_TYPE[propMask];
case JOINING_GROUP>>8: if (propMask >= LIMIT_JOINING_GROUP) break;
return ucd.getJoiningGroupID_fromIndex(propMask);
case BINARY_PROPERTIES>>8: if (propMask >= LIMIT_BINARY_PROPERTIES) break;
if (style != SHORT) return ucd.getBinaryPropertiesID_fromIndex(propMask);
return UCD_Names.SHORT_BP[propMask];
case SCRIPT>>8: if (propMask >= LIMIT_SCRIPT) break;
if (style != SHORT) return ucd.getScriptID_fromIndex(propMask);
return UCD_Names.ABB_SCRIPT[propMask];
case AGE>>8: if (propMask >= LIMIT_AGE) break;
return ucd.getAgeID_fromIndex(propMask);
case DERIVED>>8: if (!dp.isDefined(propMask)) break;
return dp.getName(propMask, style);
public String _getValue(byte style) {
try {
switch (majorProp) {
case CATEGORY>>8: return ucd.getCategoryID_fromIndex((byte)propValue, style);
case COMBINING_CLASS>>8: return String.valueOf(propValue);
case BIDI_CLASS>>8: return ucd.getBidiClassID_fromIndex((byte)propValue, style);
case DECOMPOSITION_TYPE>>8: return ucd.getDecompositionTypeID_fromIndex((byte)propValue, style);
case NUMERIC_TYPE>>8: if (propValue >= LIMIT_NUMERIC_TYPE) break;
if (style != SHORT) return ucd.getNumericTypeID_fromIndex((byte)propValue);
return UCD_Names.SHORT_NT[propValue];
case EAST_ASIAN_WIDTH>>8: if (propValue >= LIMIT_EAST_ASIAN_WIDTH) break;
if (style != LONG) return ucd.getEastAsianWidthID_fromIndex((byte)propValue);
return UCD_Names.SHORT_EA[propValue];
case LINE_BREAK>>8: if (propValue >= LIMIT_LINE_BREAK) break;
if (style != LONG) return ucd.getLineBreakID_fromIndex((byte)propValue);
return UCD_Names.LONG_LB[propValue];
case JOINING_TYPE>>8: if (propValue >= LIMIT_JOINING_TYPE) break;
if (style != LONG) return ucd.getJoiningTypeID_fromIndex((byte)propValue);
return UCD_Names.LONG_JOINING_TYPE[propValue];
case JOINING_GROUP>>8: if (propValue >= LIMIT_JOINING_GROUP) break;
return ucd.getJoiningGroupID_fromIndex((byte)propValue);
case BINARY_PROPERTIES>>8: if (propValue >= LIMIT_BINARY_PROPERTIES) break;
if (style != SHORT) return ucd.getBinaryPropertiesID_fromIndex((byte)propValue);
return UCD_Names.SHORT_BP[propValue];
case SCRIPT>>8: if (propValue >= LIMIT_SCRIPT) break;
if (style != SHORT) return ucd.getScriptID_fromIndex((byte)propValue);
return UCD_Names.ABB_SCRIPT[propValue];
case AGE>>8: if (propValue >= LIMIT_AGE) break;
return ucd.getAgeID_fromIndex((byte)propValue);
/*
case DERIVED>>8:
UnicodeProperty up = DerivedProperty.make(propValue, ucd);
if (up == null) break;
return up.getName(style);
*/
}
} catch (RuntimeException e) {
throw new ChainException("Illegal property Number {0}, {1}", new Object[]{
new Integer(majorProp), new Integer(propValue)}, e);
}
throw new ChainException("Illegal property Number {0}", new Object[]{new Integer(propMask)});
throw new ChainException("Illegal property Number {0}, {1}", new Object[]{
new Integer(majorProp), new Integer(propValue)});
}
public byte _getDefaultStyle() {
try {
switch (majorProp) {
case CATEGORY>>8: return SHORT;
case COMBINING_CLASS>>8: return SHORT;
case BIDI_CLASS>>8: return SHORT;
case DECOMPOSITION_TYPE>>8: return LONG;
case NUMERIC_TYPE>>8: return LONG;
case EAST_ASIAN_WIDTH>>8: return SHORT;
case LINE_BREAK>>8: return SHORT;
case JOINING_TYPE>>8: return SHORT;
case JOINING_GROUP>>8: return LONG;
case BINARY_PROPERTIES>>8: return LONG;
case SCRIPT>>8: return LONG;
case AGE>>8: return LONG;
}
} catch (RuntimeException e) {
throw new ChainException("Illegal property Number {0}, {1}", new Object[]{
new Integer(majorProp), new Integer(propValue)}, e);
}
throw new ChainException("Illegal property Number {0}, {1}", new Object[]{
new Integer(majorProp), new Integer(propValue)});
}
}