@@ -592,7 +592,7 @@ static void generateDecompFile() throws IOException {
592592 out .println ("" );
593593 for (final UnicodeSetIterator usi = new UnicodeSetIterator (s ); usi .next (); ) {
594594 final String source = usi .getString ();
595- final String target = getModifiedNFKD (source );
595+ final String target = ModifiedNFKD . normalize (source );
596596 writeSourceTargetLine (out , source , "N" , target , value , ARROW );
597597 }
598598 // bf.showSetNames(out, s);
@@ -724,12 +724,12 @@ private static UnicodeSet getSkipNFKD() {
724724 }
725725 final String source = UTF16 .valueOf (cp );
726726 final String mapped = NFKD .normalize (cp );
727- String kmapped = getModifiedNFKD (source );
727+ String kmapped = ModifiedNFKD . normalize (source );
728728 if (!kmapped .equals (source ) && !kmapped .equals (nfc )) {
729729 if (kmapped .startsWith (" " ) || kmapped .startsWith ("\u0640 " )) {
730730 if (DEBUG ) System .out .println ("?? " + DEFAULT_UCD .getCodeAndName (cp ));
731731 if (DEBUG ) System .out .println ("\t " + DEFAULT_UCD .getCodeAndName (kmapped ));
732- kmapped = getModifiedNFKD (source ); // for debugging
732+ kmapped = ModifiedNFKD . normalize (source ); // for debugging
733733 }
734734 nfkdMap .put (cp , kmapped );
735735 }
@@ -2637,24 +2637,15 @@ private static String getReasonFromFilename(String type) {
26372637 return type .substring (dash + 1 , period );
26382638 }
26392639
2640- private static Normalizer modNFKD ;
2641-
2642- static String getModifiedNFKD (String cf ) {
2643- if (modNFKD == null ) {
2644- modNFKD = new Normalizer (UCD_Types .NFKD , Default .ucdVersion ());
2645- modNFKD .setSpacingSubstitute ();
2646- }
2647- return modNFKD .normalize (cf );
2648- }
2649-
2650- private static Normalizer modNFKC ;
2651-
2652- static String getModifiedNFKC (String cf ) {
2653- if (modNFKC == null ) {
2654- modNFKC = new Normalizer (UCD_Types .NFKC , Default .ucdVersion ());
2655- modNFKC .setSpacingSubstitute ();
2640+ private static final class ModifiedNFKD {
2641+ private static Normalizer INSTANCE ;
2642+ static String normalize (String cf ) {
2643+ if (INSTANCE == null ) {
2644+ INSTANCE = new Normalizer (UCD_Types .NFKD , Default .ucdVersion ());
2645+ INSTANCE .setSpacingSubstitute ();
2646+ }
2647+ return ModifiedNFKD .INSTANCE .normalize (cf );
26562648 }
2657- return modNFKC .normalize (cf );
26582649 }
26592650
26602651 static PrintWriter openAndWriteHeader (String dir , String filename , String title )
0 commit comments