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