1/*
2 * Copyright (C) 1996-2004, International Business Machines Corporation and
3 * others. All Rights Reserved.
4 *
5 */
6package com.ibm.icu.text;
7//import java.util.*;
8
9abstract class TransformTransliterator {
10    // Currently unused
11}
12
13///**
14// * An abstract class for transliterators based on a transform
15// * operation.  To create a transliterator that implements a
16// * transformation, create a subclass of this class and implement the
17// * abstract <code>transform()</code> and <code>hasTransform()</code>
18// * methods.
19// * @author Alan Liu
20// */
21//abstract class TransformTransliterator extends Transliterator {
22//
23//    /**
24//     * Constructs a transliterator.  For use by subclasses.
25//     */
26//    protected TransformTransliterator(String id, UnicodeFilter f) {
27//        super(id, f);
28//    }
29//
30//    /**
31//     * Implements {@link Transliterator#handleTransliterate}.
32//     */
33//    protected void handleTransliterate(Replaceable text,
34//                                       Position offsets, boolean incremental) {
35//
36//        int start;
37//        for (start = offsets.start; start < offsets.limit; ++start) {
38//            // Scan for the first character that is != its transform.
39//            // If there are none, we fall out without doing anything.
40//            char c = text.charAt(start);
41//            if (hasTransform(c)) {
42//                // There is a transforming character at start.  Break
43//                // up the remaining string, from start to
44//                // offsets.limit, into segments of unfiltered and
45//                // filtered characters.  Only transform the unfiltered
46//                // characters.  As always, minimize the number of
47//                // calls to Replaceable.replace().
48//
49//                int len = offsets.limit - start;
50//                // assert(len >= 1);
51//
52//                char[] buf = new char[len];
53//                text.getChars(start, offsets.limit, buf, 0);
54//
55//                int segStart = 0;
56//                int segLimit;
57//                UnicodeFilter filt = getFilter();
58//
59//                // lenDelta is the accumulated length difference for
60//                // all transformed segments.  It is new length - old
61//                // length.
62//                int lenDelta = 0;
63//
64//                // Set segStart, segLimit to the unfiltered segment
65//                // starting with start.  If the filter is null, then
66//                // segStart/Limit will be set to the whole string,
67//                // that is, 0/len.
68//                do {
69//                    // Set segLimit to the first filtered char at or
70//                    // after segStart.
71//                    segLimit = len;
72//                    if (filt != null) {
73//                        segLimit = segStart;
74//                        while (segLimit < len && filt.contains(buf[segLimit])) {
75//                             ++segLimit;
76//                        }
77//                    }
78//
79//                    // Transform the unfiltered chars between segStart
80//                    // and segLimit.
81//                    int segLen = segLimit - segStart;
82//                    if (segLen != 0) {
83//                        String newStr = transform(
84//                            new String(buf, segStart, segLen));
85//                        text.replace(start, start + segLen, newStr);
86//                        start += newStr.length();
87//                        lenDelta += newStr.length() - segLen;
88//                    }
89//
90//                    // Set segStart to the first unfiltered char at or
91//                    // after segLimit.
92//                    segStart = segLimit;
93//                    if (filt != null) {
94//                        while (segStart < len && !filt.contains(buf[segStart])) {
95//                            ++segStart;
96//                        }
97//                    }
98//                    start += segStart - segLimit;
99//
100//                } while (segStart < len);
101//
102//                offsets.limit += lenDelta;
103//                offsets.contextLimit += lenDelta;
104//                offsets.start = offsets.limit;
105//                return;
106//            }
107//        }
108//        // assert(start == offsets.limit);
109//        offsets.start = start;
110//    }
111//
112//    /**
113//     * Subclasses must implement this method to determine whether a
114//     * given character has a transform that is not equal to itself.
115//     * This is approximately equivalent to <code>c !=
116//     * transform(String.valueOf(c))</code>, where
117//     * <code>String.valueOf(c)</code> returns a String containing the
118//     * single character (not integer) <code>c</code>.  Subclasses that
119//     * transform all their input can simply return <code>true</code>.
120//     */
121//    protected abstract boolean hasTransform(int c);
122//
123//    /**
124//     * Subclasses must implement this method to transform a string.
125//     */
126//    protected abstract String transform(String s);
127//}
128