From: Yoshito Umaoka Date: Fri, 20 Jan 2012 05:23:37 +0000 (+0000) Subject: ICU-8991 A new tool for building ISO 4217 currency numeric code mapping data. X-Git-Tag: milestone-59-0-1~4136 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2027e719ec900685a7634a51e4d72af7e1bb8b44;p=icu ICU-8991 A new tool for building ISO 4217 currency numeric code mapping data. X-SVN-Rev: 31235 --- diff --git a/.gitattributes b/.gitattributes index c0bb002ff5c..ac9eec4caea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -728,6 +728,11 @@ icu4j/tools/build/icu4j48.api2.gz -text icu4j/tools/build/manifest.stub -text icu4j/tools/misc/.settings/org.eclipse.core.resources.prefs -text icu4j/tools/misc/manifest.stub -text +tools/currency/.classpath -text +tools/currency/.project -text +tools/currency/.settings/org.eclipse.core.resources.prefs -text +tools/currency/.settings/org.eclipse.jdt.core.prefs -text +tools/currency/.settings/org.eclipse.jdt.ui.prefs -text tools/multi/c/Makefile-c.inc -text tools/multi/c/patch/3_0 -text tools/multi/c/patch/3_2 -text diff --git a/tools/currency/.classpath b/tools/currency/.classpath new file mode 100644 index 00000000000..17d748da2d6 --- /dev/null +++ b/tools/currency/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/tools/currency/.project b/tools/currency/.project new file mode 100644 index 00000000000..d380ad16fa5 --- /dev/null +++ b/tools/currency/.project @@ -0,0 +1,17 @@ + + + currency-numeric + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/tools/currency/.settings/org.eclipse.core.resources.prefs b/tools/currency/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..2201c347cb1 --- /dev/null +++ b/tools/currency/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Fri Jan 20 00:09:53 EST 2012 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/tools/currency/.settings/org.eclipse.jdt.core.prefs b/tools/currency/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..1dc7e58f361 --- /dev/null +++ b/tools/currency/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,347 @@ +#Thu Jan 19 10:20:40 EST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/tools/currency/.settings/org.eclipse.jdt.ui.prefs b/tools/currency/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..72fef40d4d3 --- /dev/null +++ b/tools/currency/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,10 @@ +#Thu Jan 19 10:20:39 EST 2012 +eclipse.preferences.version=1 +formatter_profile=_ICU4J Standard +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/tools/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataEntry.java b/tools/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataEntry.java new file mode 100644 index 00000000000..69dfc40339c --- /dev/null +++ b/tools/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataEntry.java @@ -0,0 +1,141 @@ +/* + ******************************************************************************* + * Copyright (C) 2012, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +package com.ibm.icu.dev.tool.currency; + +/** + * Currency data entry corresponding to the XML data distributed by SIX Interbank Clearing + * (The ISO 4217 maintenance agency). + */ +public class CurrencyDataEntry { + private String entity; + private String currency; + private String alphabeticCode; + private Integer numericCode; + private Integer minorUnit; + private String withdrawalDate; + private String remark; + private boolean historic; + + private CurrencyDataEntry(String entity, String currency, String alphabeticCode, Integer numericCode, Integer minorUnit, String withdrawalDate, String remark, boolean historic) { + this.entity = entity; + this.currency = currency; + this.alphabeticCode = alphabeticCode; + this.numericCode = numericCode; + this.minorUnit = minorUnit; + this.withdrawalDate = withdrawalDate; + this.remark = remark; + this.historic = historic; + } + + public String entity() { + return entity; + } + + public String currency() { + return currency; + } + + public String alphabeticCode() { + return alphabeticCode; + } + + public Integer numericCode() { + return numericCode; + } + + public Integer minorUnit() { + return minorUnit; + } + + public String withdrawalDate() { + return withdrawalDate; + } + + public String remark() { + return remark; + } + + public boolean historic() { + return historic; + } + + public static class Builder { + private String entity_; + private String currency_; + private String alphabeticCode_; + private Integer numericCode_; + private Integer minorUnit_; + + private String withdrawalDate_; + private String remark_; + private boolean historic_ = false; + + public Builder setEntity(String entity) { + entity_ = entity; + return this; + } + + public Builder setCurrency(String currency) { + currency_ = currency; + return this; + } + + public Builder setAlphabeticCode(String alphabeticCode) { + alphabeticCode_ = alphabeticCode; + return this; + } + + public Builder setNumericCode(String numericCode) { + try { + numericCode_ = Integer.parseInt(numericCode); + } catch (NumberFormatException e) { + // ignore + } + return this; + } + + public Builder setMinorUnit(String minorUnit) { + try { + minorUnit_ = Integer.parseInt(minorUnit); + } catch (NumberFormatException e) { + // ignore + } + return this; + } + + public Builder setWithdrawalDate(String withdrawalDate) { + withdrawalDate_ = withdrawalDate; + return this; + } + + public Builder setRemark(String remark) { + remark_ = remark; + return this; + } + + public Builder setHistoric() { + historic_ = true; + return this; + } + + public CurrencyDataEntry build() { + return new CurrencyDataEntry(entity_, currency_, alphabeticCode_, numericCode_, minorUnit_, withdrawalDate_, remark_, historic_); + } + + public Builder reset() { + entity_ = null; + currency_ = null; + alphabeticCode_ = null; + numericCode_ = null; + minorUnit_ = null; + withdrawalDate_ = null; + remark_ = null; + historic_ = false; + return this; + } + } +} diff --git a/tools/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataParser.java b/tools/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataParser.java new file mode 100644 index 00000000000..ad73d001a73 --- /dev/null +++ b/tools/currency/src/com/ibm/icu/dev/tool/currency/CurrencyDataParser.java @@ -0,0 +1,130 @@ +/* + ******************************************************************************* + * Copyright (C) 2012, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +package com.ibm.icu.dev.tool.currency; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.LinkedList; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import com.ibm.icu.dev.tool.currency.CurrencyDataEntry.Builder; + +/** + * Parser for ISO 4217 data file in XML format distributed by SIX Interbank Clearing + * (The ISO 4217 maintenance agency). + */ +public class CurrencyDataParser { + + public static Collection parse(File dataFile, boolean historic) throws IOException { + Collection result = null; + try { + SAXParserFactory factory = SAXParserFactory.newInstance(); + SAXParser parser; + parser = factory.newSAXParser(); + Handler handler = new Handler(historic); + parser.parse(new FileInputStream(dataFile), handler); + result = handler.getParsedISOCurrencies(); + } catch (SAXException e) { + throw new RuntimeException(e); + } catch (ParserConfigurationException e) { + throw new RuntimeException(e); + } + return result; + } + + private static class Handler extends DefaultHandler { + private enum ElementType { + ENTITY, + CURRENCY, + ALPHABETIC_CODE, + NUMERIC_CODE, + MINOR_UNIT, + WITHDRAWAL_DATE, + REMARK, + OTHER + }; + + Collection isoCurrencies = new LinkedList(); + ElementType elem = ElementType.OTHER; + Builder currBld = new Builder(); + + private final boolean historic; + private final String currElemName; + + public Handler(boolean historic) { + this.historic = historic; + currElemName = historic ? "ISO_CURRENCY_HISTORIC" : "ISO_CURRENCY"; + } + + public Collection getParsedISOCurrencies() { + return isoCurrencies; + } + + public void startElement(String uri, String localName, String qName, Attributes attributes) { + if (qName.equals(currElemName)) { + currBld.reset(); + elem = ElementType.OTHER; + } else { + try { + elem = ElementType.valueOf(qName); + } catch (IllegalArgumentException e) { + elem = ElementType.OTHER; + } + } + } + + public void endElement(String uri, String localName, String qName) { + // emit a currency data + if (qName.equals(currElemName)) { + if (historic) { + currBld.setHistoric(); + } + isoCurrencies.add(currBld.build()); + currBld.reset(); + } + elem = ElementType.OTHER; + } + + public void characters(char[] ch, int start, int length) { + switch (elem) { + case ENTITY: + currBld.setEntity(new String(ch, start, length).trim()); + break; + case CURRENCY: + currBld.setCurrency(new String(ch, start, length).trim()); + break; + case ALPHABETIC_CODE: + currBld.setAlphabeticCode(new String(ch, start, length).trim()); + break; + case NUMERIC_CODE: + currBld.setNumericCode(new String(ch, start, length).trim()); + break; + case MINOR_UNIT: + currBld.setMinorUnit(new String(ch, start, length).trim()); + break; + case WITHDRAWAL_DATE: + currBld.setWithdrawalDate(new String(ch, start, length).trim()); + break; + case REMARK: + currBld.setRemark(new String(ch, start, length).trim()); + break; + default: + // NOOP + break; + } + } + } +} diff --git a/tools/currency/src/com/ibm/icu/dev/tool/currency/Main.java b/tools/currency/src/com/ibm/icu/dev/tool/currency/Main.java new file mode 100644 index 00000000000..6bbc1b63af2 --- /dev/null +++ b/tools/currency/src/com/ibm/icu/dev/tool/currency/Main.java @@ -0,0 +1,181 @@ +/* + ******************************************************************************* + * Copyright (C) 2012, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +package com.ibm.icu.dev.tool.currency; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.Collection; +import java.util.Map.Entry; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeSet; + +/** + * The tool used for ISO 4217 alpha3-numeric3 code mapping data maintenance. + * This code is used for synchronizing ICU alpha3-numeric3 mapping data with + * the data distributed by SIX Interbank Clearing. + */ +public class Main { + private enum Command { + CHECK, + PRINT, + BUILD, + }; + + private static final String RESNAME = "currencyNumericCodes"; + + public static void main(String... args) { + if (args.length == 0) { + printUsage(); + System.exit(1); + } + + Command cmd = null; + + // 1st argument must be command + if (args[0].equalsIgnoreCase(Command.CHECK.name())) { + if (args.length == 3) { + cmd = Command.CHECK; + } + } else if (args[0].equalsIgnoreCase(Command.PRINT.name())) { + if (args.length == 3) { + cmd = Command.PRINT; + } + } else if (args[0].equalsIgnoreCase(Command.BUILD.name())) { + if (args.length == 2) { + cmd = Command.BUILD; + } + } + + if (cmd == null) { + printUsage(); + System.exit(1); + } + + int status = 0; + + if (cmd == Command.BUILD) { + File outfile = new File(args[1], RESNAME + ".txt"); + try { + OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8"); + NumericCodeData.getDefaultInstance().writeResource(osw, RESNAME); + } catch (IOException e) { + e.printStackTrace(); + status = 1; + } + } else { + // 2nd argument is current data xml file + // 3rd argument is historic data xml file + File currentXml = new File(args[1]); + File historicXml = new File(args[2]); + Collection currentDataEntries = null; + Collection historicDataEntries = null; + + try { + currentDataEntries = CurrencyDataParser.parse(currentXml, false); + historicDataEntries = CurrencyDataParser.parse(historicXml, true); + } catch (IOException e) { + e.printStackTrace(); + status = 1; + } + + if (status == 0) { + NumericCodeData numCodeData = NumericCodeData.createInstance(currentDataEntries); + numCodeData.merge(NumericCodeData.createInstance(historicDataEntries)); + + if (cmd == Command.PRINT) { + numCodeData.printArray(); + } else { + assert(cmd == Command.CHECK); + boolean isOK = checkData(numCodeData); + if (isOK) { + System.out.println("[OK] ICU data is synchronized with the reference data"); + } else { + status = 1; + } + } + } + } + + System.exit(status); + } + + private static void printUsage() { + System.out.println("[Usage]"); + System.out.println(""); + System.out.println(" 1) java com.ibm.icu.dev.tool.currency.Main check "); + System.out.println(""); + System.out.println(" Verifies the ICU data (table in NumericCodeData) with the reference data."); + System.out.println(""); + System.out.println(" Argument(s):"); + System.out.println(" - Current currencies & funds data (Table A.1) in XML format"); + System.out.println(" - Historic denominations data (Table A.3) in XML format"); + System.out.println(""); + System.out.println(" 2) java com.ibm.icu.dev.tool.currency.Main print "); + System.out.println(""); + System.out.println(" Prints out the alpha-numeric code mapping imported from the reference data."); + System.out.println(""); + System.out.println(" Argument(s):"); + System.out.println(" - Current currencies & funds data (Table A.1) in XML format"); + System.out.println(" - Historic denominations data (Table A.3) in XML format"); + System.out.println(""); + System.out.println(" 3) java com.ibm.icu.dev.tool.currency.Main build "); + System.out.println(""); + System.out.println(" Writes out the alpha-numeric in NumericCodeData into ICU resource bundle source"); + System.out.println(" (.txt) format."); + System.out.println(""); + System.out.println(" Argument(s):"); + System.out.println(" - Output directory of the ICU resource bundle source (.txt) format"); + System.out.println(""); + System.out.println("[Note]"); + System.out.println(" Reference XML files are distributed by the ISO 4217 maintenance agency at"); + System.out.println(" [http://www.currency-iso.org/iso_index/iso_tables.htm]."); + } + + private static boolean checkData(NumericCodeData refData) { + boolean isOK = true; + + SortedMap icuMap = NumericCodeData.getDefaultInstance().getAlphaNumericCodeMap(); + SortedMap refMap = refData.getAlphaNumericCodeMap(); + + for (Entry refEntry : refMap.entrySet()) { + String refAlpha = refEntry.getKey(); + String refNumeric = refEntry.getValue(); + + String icuNumeric = icuMap.get(refAlpha); + if (icuNumeric == null) { + System.out.println("Missing alpha code in ICU map [" + refAlpha + "]"); + isOK = false; + } else if (!icuNumeric.equals(refNumeric)) { + System.out.println("Numeric code mismatch [" + refAlpha + "] ICU=" + icuNumeric + " - Reference=" + refNumeric); + isOK = false; + } + } + + Set icuKeySet = icuMap.keySet(); + Set refKeySet = refMap.keySet(); + if (!refKeySet.containsAll(icuKeySet)) { + isOK = false; + Set tmp = new TreeSet(icuKeySet); + tmp.removeAll(refKeySet); + + StringBuilder buf = new StringBuilder(); + for (String alpha : tmp) { + if (buf.length() != 0) { + buf.append(", "); + } + buf.append(alpha); + } + + System.out.println("Codes not found in the reference data: " + buf); + } + + return isOK; + } +} diff --git a/tools/currency/src/com/ibm/icu/dev/tool/currency/NumericCodeData.java b/tools/currency/src/com/ibm/icu/dev/tool/currency/NumericCodeData.java new file mode 100644 index 00000000000..15ddaf6a4ca --- /dev/null +++ b/tools/currency/src/com/ibm/icu/dev/tool/currency/NumericCodeData.java @@ -0,0 +1,374 @@ +/* + ******************************************************************************* + * Copyright (C) 2012, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +package com.ibm.icu.dev.tool.currency; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Collection; +import java.util.Collections; +import java.util.GregorianCalendar; +import java.util.Map.Entry; +import java.util.SortedMap; +import java.util.TimeZone; +import java.util.TreeMap; + +/** + * Container of ISO 4217 alpha3 - numeric3 code mapping data + */ +public class NumericCodeData { + private SortedMap _codeMap; + + private NumericCodeData(SortedMap codeMap) { + _codeMap = codeMap; + } + + public static NumericCodeData getDefaultInstance() { + SortedMap map = new TreeMap(); + for (String[] dataEntry : CODE_MAP_DATA) { + map.put(dataEntry[0], dataEntry[1]); + } + return new NumericCodeData(map); + } + + public static NumericCodeData createInstance(Collection dataEntries) { + SortedMap map = new TreeMap(); + for (CurrencyDataEntry dataEntry : dataEntries) { + String alphaCode = dataEntry.alphabeticCode(); + Integer numCode = dataEntry.numericCode(); + if (alphaCode == null || numCode == null) { + continue; + } + map.put(alphaCode, String.format("%03d", numCode)); + } + return new NumericCodeData(map); + } + + public NumericCodeData merge(NumericCodeData anotherData) { + SortedMap codeMap = anotherData.getAlphaNumericCodeMap(); + for (Entry codeMapEntry : codeMap.entrySet()) { + String alphaCode = codeMapEntry.getKey(); + String numCode = codeMapEntry.getValue(); + if (!_codeMap.containsKey(alphaCode)) { + _codeMap.put(alphaCode, numCode); + } else { + String existingValue = _codeMap.get(alphaCode); + if (!existingValue.equals(numCode)) { + throw new RuntimeException("Duplicated definition for " + alphaCode + ": value=" + existingValue + "/another value=" + numCode); + } + } + } + return this; + } + + public SortedMap getAlphaNumericCodeMap() { + return Collections.unmodifiableSortedMap(_codeMap); + } + + public void printArray() { + for (Entry entry : getAlphaNumericCodeMap().entrySet()) { + System.out.println(" {\"" + entry.getKey() + "\", \"" + entry.getValue() + "\"},"); + } + } + + public void writeResource(OutputStreamWriter osw, String resName) throws IOException { + GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT")); + + PrintWriter pw = new PrintWriter(osw, true); + + // Header + pw.println("//---------------------------------------------------------"); + pw.println(String.format("// Copyright (C) %1$tY, International Business Machines", cal)); + pw.println("// Corporation and others. All Rights Reserved."); + pw.println("//---------------------------------------------------------"); + pw.println("// Build tool: com.ibm.icu.dev.tool.currency.NumericCodeData"); + pw.println(String.format("// Build date: %1$tFT%1$tTZ", cal)); + pw.println("//---------------------------------------------------------"); + pw.println("// >> !!! >> THIS IS A MACHINE-GENERATED FILE << !!! <<"); + pw.println("// >> !!! >>> DO NOT EDIT <<< !!! <<"); + pw.println("//---------------------------------------------------------"); + pw.println(""); + + // Resource root + pw.println(resName + ":table(nofallback){"); + + // Map data + pw.println(" codeMap{"); + + for (Entry mapEntry : _codeMap.entrySet()) { + String alphaCode = mapEntry.getKey(); + int numericCodeVal = Integer.parseInt(mapEntry.getValue()); + pw.println(String.format(" %1$s:int{%2$d}", alphaCode, numericCodeVal)); + } + + pw.println(" }"); + + pw.println("}"); + } + + private static final String[][] CODE_MAP_DATA = { + {"ADP", "020"}, + {"AED", "784"}, + {"AFA", "004"}, + {"AFN", "971"}, + {"ALL", "008"}, + {"AMD", "051"}, + {"ANG", "532"}, + {"AOA", "973"}, + {"AON", "024"}, + {"AOR", "982"}, + {"ARA", "032"}, + {"ARP", "032"}, + {"ARS", "032"}, + {"ATS", "040"}, + {"AUD", "036"}, + {"AWG", "533"}, + {"AYM", "945"}, + {"AZM", "031"}, + {"AZN", "944"}, + {"BAD", "070"}, + {"BAM", "977"}, + {"BBD", "052"}, + {"BDT", "050"}, + {"BEC", "993"}, + {"BEF", "056"}, + {"BEL", "992"}, + {"BGL", "100"}, + {"BGN", "975"}, + {"BHD", "048"}, + {"BIF", "108"}, + {"BMD", "060"}, + {"BND", "096"}, + {"BOB", "068"}, + {"BOV", "984"}, + {"BRC", "076"}, + {"BRE", "076"}, + {"BRL", "986"}, + {"BRN", "076"}, + {"BRR", "987"}, + {"BSD", "044"}, + {"BTN", "064"}, + {"BWP", "072"}, + {"BYB", "112"}, + {"BYR", "974"}, + {"BZD", "084"}, + {"CAD", "124"}, + {"CDF", "976"}, + {"CHC", "948"}, + {"CHE", "947"}, + {"CHF", "756"}, + {"CHW", "948"}, + {"CLF", "990"}, + {"CLP", "152"}, + {"CNY", "156"}, + {"COP", "170"}, + {"COU", "970"}, + {"CRC", "188"}, + {"CSD", "891"}, + {"CSK", "200"}, + {"CUC", "931"}, + {"CUP", "192"}, + {"CVE", "132"}, + {"CYP", "196"}, + {"CZK", "203"}, + {"DDM", "278"}, + {"DEM", "276"}, + {"DJF", "262"}, + {"DKK", "208"}, + {"DOP", "214"}, + {"DZD", "012"}, + {"ECS", "218"}, + {"ECV", "983"}, + {"EEK", "233"}, + {"EGP", "818"}, + {"ERN", "232"}, + {"ESA", "996"}, + {"ESB", "995"}, + {"ESP", "724"}, + {"ETB", "230"}, + {"EUR", "978"}, + {"FIM", "246"}, + {"FJD", "242"}, + {"FKP", "238"}, + {"FRF", "250"}, + {"GBP", "826"}, + {"GEK", "268"}, + {"GEL", "981"}, + {"GHC", "288"}, + {"GHP", "939"}, + {"GHS", "936"}, + {"GIP", "292"}, + {"GMD", "270"}, + {"GNF", "324"}, + {"GQE", "226"}, + {"GRD", "300"}, + {"GTQ", "320"}, + {"GWP", "624"}, + {"GYD", "328"}, + {"HKD", "344"}, + {"HNL", "340"}, + {"HRD", "191"}, + {"HRK", "191"}, + {"HTG", "332"}, + {"HUF", "348"}, + {"IDR", "360"}, + {"IEP", "372"}, + {"ILS", "376"}, + {"INR", "356"}, + {"IQD", "368"}, + {"IRR", "364"}, + {"ISK", "352"}, + {"ITL", "380"}, + {"JMD", "388"}, + {"JOD", "400"}, + {"JPY", "392"}, + {"KES", "404"}, + {"KGS", "417"}, + {"KHR", "116"}, + {"KMF", "174"}, + {"KPW", "408"}, + {"KRW", "410"}, + {"KWD", "414"}, + {"KYD", "136"}, + {"KZT", "398"}, + {"LAK", "418"}, + {"LBP", "422"}, + {"LKR", "144"}, + {"LRD", "430"}, + {"LSL", "426"}, + {"LTL", "440"}, + {"LTT", "440"}, + {"LUC", "989"}, + {"LUF", "442"}, + {"LUL", "988"}, + {"LVL", "428"}, + {"LVR", "428"}, + {"LYD", "434"}, + {"MAD", "504"}, + {"MDL", "498"}, + {"MGA", "969"}, + {"MGF", "450"}, + {"MKD", "807"}, + {"MLF", "466"}, + {"MMK", "104"}, + {"MNT", "496"}, + {"MOP", "446"}, + {"MRO", "478"}, + {"MTL", "470"}, + {"MUR", "480"}, + {"MVR", "462"}, + {"MWK", "454"}, + {"MXN", "484"}, + {"MXV", "979"}, + {"MYR", "458"}, + {"MZM", "508"}, + {"MZN", "943"}, + {"NAD", "516"}, + {"NGN", "566"}, + {"NIO", "558"}, + {"NLG", "528"}, + {"NOK", "578"}, + {"NPR", "524"}, + {"NZD", "554"}, + {"OMR", "512"}, + {"PAB", "590"}, + {"PEI", "604"}, + {"PEN", "604"}, + {"PES", "604"}, + {"PGK", "598"}, + {"PHP", "608"}, + {"PKR", "586"}, + {"PLN", "985"}, + {"PLZ", "616"}, + {"PTE", "620"}, + {"PYG", "600"}, + {"QAR", "634"}, + {"ROL", "642"}, + {"RON", "946"}, + {"RSD", "941"}, + {"RUB", "643"}, + {"RUR", "810"}, + {"RWF", "646"}, + {"SAR", "682"}, + {"SBD", "090"}, + {"SCR", "690"}, + {"SDD", "736"}, + {"SDG", "938"}, + {"SEK", "752"}, + {"SGD", "702"}, + {"SHP", "654"}, + {"SIT", "705"}, + {"SKK", "703"}, + {"SLL", "694"}, + {"SOS", "706"}, + {"SRD", "968"}, + {"SRG", "740"}, + {"SSP", "728"}, + {"STD", "678"}, + {"SVC", "222"}, + {"SYP", "760"}, + {"SZL", "748"}, + {"THB", "764"}, + {"TJR", "762"}, + {"TJS", "972"}, + {"TMM", "795"}, + {"TMT", "934"}, + {"TND", "788"}, + {"TOP", "776"}, + {"TPE", "626"}, + {"TRL", "792"}, + {"TRY", "949"}, + {"TTD", "780"}, + {"TWD", "901"}, + {"TZS", "834"}, + {"UAH", "980"}, + {"UAK", "804"}, + {"UGX", "800"}, + {"USD", "840"}, + {"USN", "997"}, + {"USS", "998"}, + {"UYI", "940"}, + {"UYU", "858"}, + {"UZS", "860"}, + {"VEB", "862"}, + {"VEF", "937"}, + {"VND", "704"}, + {"VUV", "548"}, + {"WST", "882"}, + {"XAF", "950"}, + {"XAG", "961"}, + {"XAU", "959"}, + {"XBA", "955"}, + {"XBB", "956"}, + {"XBC", "957"}, + {"XBD", "958"}, + {"XCD", "951"}, + {"XDR", "960"}, + {"XEU", "954"}, + {"XOF", "952"}, + {"XPD", "964"}, + {"XPF", "953"}, + {"XPT", "962"}, + {"XSU", "994"}, + {"XTS", "963"}, + {"XUA", "965"}, + {"XXX", "999"}, + {"YDD", "720"}, + {"YER", "886"}, + {"YUM", "891"}, + {"YUN", "890"}, + {"ZAL", "991"}, + {"ZAR", "710"}, + {"ZMK", "894"}, + {"ZRN", "180"}, + {"ZRZ", "180"}, + {"ZWD", "716"}, + {"ZWL", "932"}, + {"ZWN", "942"}, + {"ZWR", "935"}, + }; +}