1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 // 2016 and later: Unicode, Inc. and others. 3 // License & terms of use: http://www.unicode.org/copyright.html#License 4 /* 5 ****************************************************************************** 6 * Copyright (C) 2007-2009, International Business Machines Corporation and * 7 * others. All Rights Reserved. * 8 ****************************************************************************** 9 */ 10 11 package android.icu.impl.duration.impl; 12 13 import java.util.ArrayList; 14 import java.util.List; 15 16 /** 17 * DataRecord contains the data used by PeriodFormatterData. Fields are 18 * package-private for ease of access. This is a struct, it knows how to read 19 * and write itself to/from simple XML, that's all. 20 * @hide Only a subset of ICU is exposed in Android 21 */ 22 public class DataRecord { 23 byte pl; 24 String[][] pluralNames; 25 byte[] genders; // EGender 26 String[] singularNames; 27 String[] halfNames; 28 String[] numberNames; 29 String[] mediumNames; 30 String[] shortNames; 31 String[] measures; 32 String[] rqdSuffixes; 33 String[] optSuffixes; 34 String[] halves; 35 byte[] halfPlacements; // EHalfPlacement 36 byte[] halfSupport; // EHalfSupport 37 String fifteenMinutes; 38 String fiveMinutes; 39 boolean requiresDigitSeparator; 40 String digitPrefix; 41 String countSep; 42 String shortUnitSep; 43 String[] unitSep; 44 boolean[] unitSepRequiresDP; 45 boolean[] requiresSkipMarker; 46 byte numberSystem; // ENumberSystem 47 char zero; 48 char decimalSep; 49 boolean omitSingularCount; 50 boolean omitDualCount; 51 byte zeroHandling; // EZeroHandling 52 byte decimalHandling; // EDecimalHandling 53 byte fractionHandling; // EFractionHandling 54 String skippedUnitMarker; 55 boolean allowZero; 56 boolean weeksAloneOnly; 57 byte useMilliseconds; // EMilliSupport 58 ScopeData[] scopeData; 59 60 public static DataRecord read(String ln, RecordReader in) { 61 if (in.open("DataRecord")) { 62 DataRecord record = new DataRecord(); 63 record.pl = in.namedIndex("pl", EPluralization.names); 64 record.pluralNames = in.stringTable("pluralName"); 65 record.genders = in.namedIndexArray("gender", EGender.names); 66 record.singularNames = in.stringArray("singularName"); 67 record.halfNames = in.stringArray("halfName"); 68 record.numberNames = in.stringArray("numberName"); 69 record.mediumNames = in.stringArray("mediumName"); 70 record.shortNames = in.stringArray("shortName"); 71 record.measures = in.stringArray("measure"); 72 record.rqdSuffixes = in.stringArray("rqdSuffix"); 73 record.optSuffixes = in.stringArray("optSuffix"); 74 record.halves = in.stringArray("halves"); 75 record.halfPlacements = in.namedIndexArray("halfPlacement", 76 EHalfPlacement.names); 77 record.halfSupport = in.namedIndexArray("halfSupport", 78 EHalfSupport.names); 79 record.fifteenMinutes = in.string("fifteenMinutes"); 80 record.fiveMinutes = in.string("fiveMinutes"); 81 record.requiresDigitSeparator = in.bool("requiresDigitSeparator"); 82 record.digitPrefix = in.string("digitPrefix"); 83 record.countSep = in.string("countSep"); 84 record.shortUnitSep = in.string("shortUnitSep"); 85 record.unitSep = in.stringArray("unitSep"); 86 record.unitSepRequiresDP = in.boolArray("unitSepRequiresDP"); 87 record.requiresSkipMarker = in.boolArray("requiresSkipMarker"); 88 record.numberSystem = in.namedIndex("numberSystem", 89 ENumberSystem.names); 90 record.zero = in.character("zero"); 91 record.decimalSep = in.character("decimalSep"); 92 record.omitSingularCount = in.bool("omitSingularCount"); 93 record.omitDualCount = in.bool("omitDualCount"); 94 record.zeroHandling = in.namedIndex("zeroHandling", 95 EZeroHandling.names); 96 record.decimalHandling = in.namedIndex("decimalHandling", 97 EDecimalHandling.names); 98 record.fractionHandling = in.namedIndex("fractionHandling", 99 EFractionHandling.names); 100 record.skippedUnitMarker = in.string("skippedUnitMarker"); 101 record.allowZero = in.bool("allowZero"); 102 record.weeksAloneOnly = in.bool("weeksAloneOnly"); 103 record.useMilliseconds = in.namedIndex("useMilliseconds", 104 EMilliSupport.names); 105 if (in.open("ScopeDataList")) { 106 List<ScopeData> list = new ArrayList<ScopeData>(); // of ScopeData 107 ScopeData data; 108 while (null != (data = ScopeData.read(in))) { 109 list.add(data); 110 } 111 if (in.close()) { 112 record.scopeData = list.toArray(new ScopeData[list.size()]); 113 } 114 } 115 116 if (in.close()) { 117 return record; 118 } 119 } else { 120 throw new InternalError("did not find DataRecord while reading " 121 + ln); 122 } 123 throw new InternalError("null data read while reading " + ln); 124 // Thread.dumpStack(); 125 // return null; 126 } 127 128 public void write(RecordWriter out) { 129 out.open("DataRecord"); 130 out.namedIndex("pl", EPluralization.names, pl); 131 out.stringTable("pluralName", pluralNames); 132 out.namedIndexArray("gender", EGender.names, genders); 133 out.stringArray("singularName", singularNames); 134 out.stringArray("halfName", halfNames); 135 out.stringArray("numberName", numberNames); 136 out.stringArray("mediumName", mediumNames); 137 out.stringArray("shortName", shortNames); 138 out.stringArray("measure", measures); 139 out.stringArray("rqdSuffix", rqdSuffixes); 140 out.stringArray("optSuffix", optSuffixes); 141 out.stringArray("halves", halves); 142 out.namedIndexArray("halfPlacement", EHalfPlacement.names, 143 halfPlacements); 144 out.namedIndexArray("halfSupport", EHalfSupport.names, halfSupport); 145 out.string("fifteenMinutes", fifteenMinutes); 146 out.string("fiveMinutes", fiveMinutes); 147 out.bool("requiresDigitSeparator", requiresDigitSeparator); 148 out.string("digitPrefix", digitPrefix); 149 out.string("countSep", countSep); 150 out.string("shortUnitSep", shortUnitSep); 151 out.stringArray("unitSep", unitSep); 152 out.boolArray("unitSepRequiresDP", unitSepRequiresDP); 153 out.boolArray("requiresSkipMarker", requiresSkipMarker); 154 out.namedIndex("numberSystem", ENumberSystem.names, numberSystem); 155 out.character("zero", zero); 156 out.character("decimalSep", decimalSep); 157 out.bool("omitSingularCount", omitSingularCount); 158 out.bool("omitDualCount", omitDualCount); 159 out.namedIndex("zeroHandling", EZeroHandling.names, zeroHandling); 160 out.namedIndex("decimalHandling", EDecimalHandling.names, 161 decimalHandling); 162 out.namedIndex("fractionHandling", EFractionHandling.names, 163 fractionHandling); 164 out.string("skippedUnitMarker", skippedUnitMarker); 165 out.bool("allowZero", allowZero); 166 out.bool("weeksAloneOnly", weeksAloneOnly); 167 out.namedIndex("useMilliseconds", EMilliSupport.names, useMilliseconds); 168 if (scopeData != null) { 169 out.open("ScopeDataList"); 170 for (int i = 0; i < scopeData.length; ++i) { 171 scopeData[i].write(out); 172 } 173 out.close(); 174 } 175 out.close(); 176 } 177 178 public static class ScopeData { 179 String prefix; 180 boolean requiresDigitPrefix; 181 String suffix; 182 183 public void write(RecordWriter out) { 184 out.open("ScopeData"); 185 out.string("prefix", prefix); 186 out.bool("requiresDigitPrefix", requiresDigitPrefix); 187 out.string("suffix", suffix); 188 out.close(); 189 } 190 191 public static ScopeData read(RecordReader in) { 192 if (in.open("ScopeData")) { 193 ScopeData scope = new ScopeData(); 194 scope.prefix = in.string("prefix"); 195 scope.requiresDigitPrefix = in.bool("requiresDigitPrefix"); 196 scope.suffix = in.string("suffix"); 197 if (in.close()) { 198 return scope; 199 } 200 } 201 return null; 202 } 203 } 204 205 public static interface ETimeLimit { 206 public static final byte NOLIMIT = 0; 207 public static final byte LT = 1; 208 public static final byte MT = 2; 209 public static final String[] names = { "NOLIMIT", "LT", "MT" }; 210 } 211 212 public static interface ETimeDirection { 213 public static final byte NODIRECTION = 0; 214 public static final byte PAST = 1; 215 public static final byte FUTURE = 2; 216 public static final String[] names = { "NODIRECTION", "PAST", "FUTURE" }; 217 } 218 219 public static interface EUnitVariant { 220 public static final byte PLURALIZED = 0; 221 public static final byte MEDIUM = 1; 222 public static final byte SHORT = 2; 223 public static final String[] names = { "PLURALIZED", "MEDIUM", "SHORT" }; 224 } 225 226 public static interface ECountVariant { 227 public static final byte INTEGER = 0; 228 public static final byte INTEGER_CUSTOM = 1; 229 public static final byte HALF_FRACTION = 2; 230 public static final byte DECIMAL1 = 3; 231 public static final byte DECIMAL2 = 4; 232 public static final byte DECIMAL3 = 5; 233 public static final String[] names = { "INTEGER", "INTEGER_CUSTOM", 234 "HALF_FRACTION", "DECIMAL1", "DECIMAL2", "DECIMAL3" }; 235 } 236 237 public static interface EPluralization { 238 public static final byte NONE = 0; 239 public static final byte PLURAL = 1; 240 public static final byte DUAL = 2; 241 public static final byte PAUCAL = 3; 242 public static final byte HEBREW = 4; 243 public static final byte ARABIC = 5; 244 public static final String[] names = { "NONE", "PLURAL", "DUAL", 245 "PAUCAL", "HEBREW", "ARABIC" }; 246 } 247 248 public static interface EHalfPlacement { 249 public static final byte PREFIX = 0; 250 public static final byte AFTER_FIRST = 1; 251 public static final byte LAST = 2; 252 public static final String[] names = { "PREFIX", "AFTER_FIRST", "LAST" }; 253 } 254 255 public static interface ENumberSystem { 256 public static final byte DEFAULT = 0; 257 public static final byte CHINESE_TRADITIONAL = 1; 258 public static final byte CHINESE_SIMPLIFIED = 2; 259 public static final byte KOREAN = 3; 260 public static final String[] names = { "DEFAULT", 261 "CHINESE_TRADITIONAL", "CHINESE_SIMPLIFIED", "KOREAN" }; 262 } 263 264 public static interface EZeroHandling { 265 public static final byte ZPLURAL = 0; 266 public static final byte ZSINGULAR = 1; 267 public static final String[] names = { "ZPLURAL", "ZSINGULAR" }; 268 } 269 270 public static interface EDecimalHandling { 271 public static final byte DPLURAL = 0; 272 public static final byte DSINGULAR = 1; 273 public static final byte DSINGULAR_SUBONE = 2; 274 public static final byte DPAUCAL = 3; 275 public static final String[] names = { "DPLURAL", "DSINGULAR", 276 "DSINGULAR_SUBONE", "DPAUCAL" }; 277 } 278 279 public static interface EFractionHandling { 280 public static final byte FPLURAL = 0; 281 public static final byte FSINGULAR_PLURAL = 1; 282 public static final byte FSINGULAR_PLURAL_ANDAHALF = 2; 283 public static final byte FPAUCAL = 3; 284 public static final String[] names = { "FPLURAL", "FSINGULAR_PLURAL", 285 "FSINGULAR_PLURAL_ANDAHALF", "FPAUCAL" }; 286 } 287 288 public static interface EHalfSupport { 289 public static final byte YES = 0; 290 public static final byte NO = 1; 291 public static final byte ONE_PLUS = 2; 292 public static final String[] names = { "YES", "NO", "ONE_PLUS" }; 293 } 294 295 public static interface EMilliSupport { 296 public static final byte YES = 0; 297 public static final byte NO = 1; 298 public static final byte WITH_SECONDS = 2; 299 public static final String[] names = { "YES", "NO", "WITH_SECONDS" }; 300 } 301 302 public static interface ESeparatorVariant { 303 public static final byte NONE = 0; 304 public static final byte SHORT = 1; 305 public static final byte FULL = 2; 306 public static final String[] names = { "NONE", "SHORT", "FULL" }; 307 } 308 309 public static interface EGender { 310 public static final byte M = 0; 311 public static final byte F = 1; 312 public static final byte N = 2; 313 public static final String[] names = { "M", "F", "N" }; 314 } 315 } 316