]> granicus.if.org Git - icu/commitdiff
ICU-12450 move com.ibm.icu.dev.util.UnicodeTransform & IcuUnicodeNormalizerFactory...
authorMarkus Scherer <markus.icu@gmail.com>
Mon, 25 Apr 2016 23:31:12 +0000 (23:31 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Mon, 25 Apr 2016 23:31:12 +0000 (23:31 +0000)
X-SVN-Rev: 38648

icu4j/main/tests/framework/src/com/ibm/icu/dev/util/IcuUnicodeNormalizerFactory.java [deleted file]
icu4j/main/tests/framework/src/com/ibm/icu/dev/util/UnicodeTransform.java [deleted file]

diff --git a/icu4j/main/tests/framework/src/com/ibm/icu/dev/util/IcuUnicodeNormalizerFactory.java b/icu4j/main/tests/framework/src/com/ibm/icu/dev/util/IcuUnicodeNormalizerFactory.java
deleted file mode 100644 (file)
index 43c3eb4..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (C) 2011-2012, International Business Machines Corporation and         *
- * others. All Rights Reserved.                                                *
- *******************************************************************************
- */
-package com.ibm.icu.dev.util;
-
-import com.ibm.icu.dev.util.UnicodeTransform.Type;
-import com.ibm.icu.lang.UCharacter;
-import com.ibm.icu.text.Normalizer2;
-
-/**
- * @author markdavis
- *
- */
-public class IcuUnicodeNormalizerFactory implements UnicodeTransform.Factory {
-
-    public UnicodeTransform getInstance(Type type) {
-        switch (type) {
-        case NFC:
-            return new IcuUnicodeNormalizer(Normalizer2.getNFCInstance());
-        case NFKC:
-            return new IcuUnicodeNormalizer(Normalizer2.getNFKCInstance());
-        case NFD:
-            return new IcuUnicodeNormalizer(Normalizer2.getNFDInstance());
-        case NFKD:
-            return new IcuUnicodeNormalizer(Normalizer2.getNFKDInstance());
-        case CASEFOLD:
-            return new CaseFolder();
-        default:
-            throw new IllegalArgumentException();
-        }
-    }
-
-    private static class CaseFolder extends UnicodeTransform {
-        @Override
-        public String transform(String source) {
-            return UCharacter.foldCase(source.toString(), true);
-        }
-    }
-
-    private static class IcuUnicodeNormalizer extends UnicodeTransform {
-        private Normalizer2 normalizer;
-
-        private IcuUnicodeNormalizer(Normalizer2 normalizer) {
-            this.normalizer = normalizer;
-        }
-
-        public String transform(String src) {
-            return normalizer.normalize(src);
-        }
-
-        public boolean isTransformed(String s) {
-            return normalizer.isNormalized(s);
-        }
-    }
-}
diff --git a/icu4j/main/tests/framework/src/com/ibm/icu/dev/util/UnicodeTransform.java b/icu4j/main/tests/framework/src/com/ibm/icu/dev/util/UnicodeTransform.java
deleted file mode 100644 (file)
index c063645..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (C) 2011-2012, Google, International Business Machines Corporation and         *
- * others. All Rights Reserved.                                                *
- *******************************************************************************
- */
-package com.ibm.icu.dev.util;
-
-import com.ibm.icu.text.Transform;
-import com.ibm.icu.text.UTF16;
-
-/**
- * Simple wrapping for normalizer that allows for both the standard ICU normalizer, and one built directly from the UCD.
- */
-public abstract class UnicodeTransform implements Transform<String,String> {
-    public enum Type {
-        NFD, NFC, NFKD, NFKC, CASEFOLD
-    }
-    
-    public interface Factory {
-        public UnicodeTransform getInstance(Type type);
-    }
-    
-    private static Factory factory = new IcuUnicodeNormalizerFactory();
-    
-    public static synchronized Factory getFactory() {
-        return factory;
-    }
-
-    public static synchronized void setFactory(Factory factory) {
-        UnicodeTransform.factory = factory;
-    }
-
-    public static synchronized UnicodeTransform getInstance(Type type) {
-        return factory.getInstance(type);
-    }
-    
-    public abstract String transform(String source);
-    
-    /**
-     * Can be overridden for performance.
-     */
-    public boolean isTransformed(String source) {
-        return source.equals(transform(source));
-    }
-    /**
-     * Can be overridden for performance.
-     */
-    public String transform(int source) {
-        return transform(UTF16.valueOf(source));
-    }
-    /**
-     * Can be overridden for performance.
-     */
-    public boolean isTransformed(int source) {
-        return isTransformed(UTF16.valueOf(source));
-    }
-}
-