< prev index next >

make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 119,129 **** private static int[] specialCaseOldCurrenciesNumericCode = new int[maxSpecialCases]; private static int[] specialCaseNewCurrenciesNumericCode = new int[maxSpecialCases]; private static final int maxOtherCurrencies = 128; private static int otherCurrenciesCount = 0; ! private static StringBuffer otherCurrencies = new StringBuffer(); private static int[] otherCurrenciesDefaultFractionDigits = new int[maxOtherCurrencies]; private static int[] otherCurrenciesNumericCode= new int[maxOtherCurrencies]; // date format for parsing cut-over times private static SimpleDateFormat format; --- 119,129 ---- private static int[] specialCaseOldCurrenciesNumericCode = new int[maxSpecialCases]; private static int[] specialCaseNewCurrenciesNumericCode = new int[maxSpecialCases]; private static final int maxOtherCurrencies = 128; private static int otherCurrenciesCount = 0; ! private static String[] otherCurrencies = new String[maxOtherCurrencies]; private static int[] otherCurrenciesDefaultFractionDigits = new int[maxOtherCurrencies]; private static int[] otherCurrenciesNumericCode= new int[maxOtherCurrencies]; // date format for parsing cut-over times private static SimpleDateFormat format;
*** 316,329 **** (tableEntry & SPECIAL_CASE_COUNTRY_MASK) != 0 || (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) != (currencyCode.charAt(2) - 'A')) { if (otherCurrenciesCount == maxOtherCurrencies) { throw new RuntimeException("too many other currencies"); } ! if (otherCurrencies.length() > 0) { ! otherCurrencies.append('-'); ! } ! otherCurrencies.append(currencyCode); otherCurrenciesDefaultFractionDigits[otherCurrenciesCount] = getDefaultFractionDigits(currencyCode); otherCurrenciesNumericCode[otherCurrenciesCount] = getNumericCode(currencyCode); otherCurrenciesCount++; } } --- 316,326 ---- (tableEntry & SPECIAL_CASE_COUNTRY_MASK) != 0 || (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) != (currencyCode.charAt(2) - 'A')) { if (otherCurrenciesCount == maxOtherCurrencies) { throw new RuntimeException("too many other currencies"); } ! otherCurrencies[otherCurrenciesCount] = currencyCode; otherCurrenciesDefaultFractionDigits[otherCurrenciesCount] = getDefaultFractionDigits(currencyCode); otherCurrenciesNumericCode[otherCurrenciesCount] = getNumericCode(currencyCode); otherCurrenciesCount++; } }
*** 348,384 **** out.writeInt(MAGIC_NUMBER); out.writeInt(Integer.parseInt(formatVersion)); out.writeInt(Integer.parseInt(dataVersion)); writeIntArray(mainTable, mainTable.length); out.writeInt(specialCaseCount); ! writeLongArray(specialCaseCutOverTimes, specialCaseCount); ! writeStringArray(specialCaseOldCurrencies, specialCaseCount); ! writeStringArray(specialCaseNewCurrencies, specialCaseCount); ! writeIntArray(specialCaseOldCurrenciesDefaultFractionDigits, specialCaseCount); ! writeIntArray(specialCaseNewCurrenciesDefaultFractionDigits, specialCaseCount); ! writeIntArray(specialCaseOldCurrenciesNumericCode, specialCaseCount); ! writeIntArray(specialCaseNewCurrenciesNumericCode, specialCaseCount); out.writeInt(otherCurrenciesCount); ! out.writeUTF(otherCurrencies.toString()); ! writeIntArray(otherCurrenciesDefaultFractionDigits, otherCurrenciesCount); ! writeIntArray(otherCurrenciesNumericCode, otherCurrenciesCount); } private static void writeIntArray(int[] ia, int count) throws IOException { ! for (int i = 0; i < count; i ++) { out.writeInt(ia[i]); } } ! private static void writeLongArray(long[] la, int count) throws IOException { ! for (int i = 0; i < count; i ++) { ! out.writeLong(la[i]); } } ! private static void writeStringArray(String[] sa, int count) throws IOException { ! for (int i = 0; i < count; i ++) { ! String str = (sa[i] != null) ? sa[i] : ""; out.writeUTF(str); } } } --- 345,387 ---- out.writeInt(MAGIC_NUMBER); out.writeInt(Integer.parseInt(formatVersion)); out.writeInt(Integer.parseInt(dataVersion)); writeIntArray(mainTable, mainTable.length); out.writeInt(specialCaseCount); ! writeSpecialCaseEntries(); out.writeInt(otherCurrenciesCount); ! writeOtherCurrencies(); } private static void writeIntArray(int[] ia, int count) throws IOException { ! for (int i = 0; i < count; i++) { out.writeInt(ia[i]); } } ! private static void writeSpecialCaseEntries() throws IOException { ! for (int index = 0; index < specialCaseCount; index++) { ! out.writeLong(specialCaseCutOverTimes[index]); ! String str = (specialCaseOldCurrencies[index] != null) ! ? specialCaseOldCurrencies[index] : ""; ! out.writeUTF(str); ! str = (specialCaseNewCurrencies[index] != null) ! ? specialCaseNewCurrencies[index] : ""; ! out.writeUTF(str); ! out.writeInt(specialCaseOldCurrenciesDefaultFractionDigits[index]); ! out.writeInt(specialCaseNewCurrenciesDefaultFractionDigits[index]); ! out.writeInt(specialCaseOldCurrenciesNumericCode[index]); ! out.writeInt(specialCaseNewCurrenciesNumericCode[index]); } } ! private static void writeOtherCurrencies() throws IOException { ! for (int index = 0; index < otherCurrenciesCount; index++) { ! String str = (otherCurrencies[index] != null) ! ? otherCurrencies[index] : ""; out.writeUTF(str); + out.writeInt(otherCurrenciesDefaultFractionDigits[index]); + out.writeInt(otherCurrenciesNumericCode[index]); } } + }
< prev index next >