mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
Clean up Transliterator::Position - rename temporary names
X-SVN-Rev: 1672
This commit is contained in:
parent
c515e74056
commit
451cdc7bf9
17 changed files with 219 additions and 213 deletions
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/translit/TransliteratorTest.java,v $
|
||||
* $Date: 2000/06/28 20:31:27 $
|
||||
* $Revision: 1.21 $
|
||||
* $Date: 2000/06/28 20:36:59 $
|
||||
* $Revision: 1.22 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -293,12 +293,12 @@ public class TransliteratorTest extends TestFmwk {
|
|||
}
|
||||
String str = s.toString();
|
||||
// Show the start index '{' and the cursor '|'
|
||||
log.append(str.substring(0, index.__contextStart)).
|
||||
log.append(str.substring(0, index.contextStart)).
|
||||
append('{').
|
||||
append(str.substring(index.__contextStart,
|
||||
index.__start)).
|
||||
append(str.substring(index.contextStart,
|
||||
index.start)).
|
||||
append('|').
|
||||
append(str.substring(index.__start));
|
||||
append(str.substring(index.start));
|
||||
if (str.equals(DATA[i+1])) {
|
||||
logln(log.toString());
|
||||
} else {
|
||||
|
@ -599,9 +599,9 @@ public void TestJ277() {
|
|||
// Append the string buffer with a vertical bar '|' where
|
||||
// the committed index is.
|
||||
String s = rsource.toString();
|
||||
log.append(s.substring(0, index.__start)).
|
||||
log.append(s.substring(0, index.start)).
|
||||
append('|').
|
||||
append(s.substring(index.__start));
|
||||
append(s.substring(index.start));
|
||||
}
|
||||
|
||||
// As a final step in keyboard transliteration, we must call
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/CompoundTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.9 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.10 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ import java.util.Vector;
|
|||
* <p>Copyright © IBM Corporation 1999. All rights reserved.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: CompoundTransliterator.java,v $ $Revision: 1.9 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: CompoundTransliterator.java,v $ $Revision: 1.10 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class CompoundTransliterator extends Transliterator {
|
||||
|
||||
|
@ -273,23 +273,23 @@ public class CompoundTransliterator extends Transliterator {
|
|||
* abc/u0041/u0041/u
|
||||
* S C L
|
||||
*/
|
||||
int cursor = index.__start;
|
||||
int limit = index.__contextLimit;
|
||||
int cursor = index.start;
|
||||
int limit = index.contextLimit;
|
||||
int globalLimit = limit;
|
||||
/* globalLimit is the overall limit. We keep track of this
|
||||
* since we overwrite index.__contextLimit with the previous
|
||||
* index.__start. After each transliteration, we update
|
||||
* since we overwrite index.contextLimit with the previous
|
||||
* index.start. After each transliteration, we update
|
||||
* globalLimit for insertions or deletions that have happened.
|
||||
*/
|
||||
|
||||
for (int i=0; i<trans.length; ++i) {
|
||||
index.__start = cursor; // Reset cursor
|
||||
index.__contextLimit = limit;
|
||||
index.start = cursor; // Reset cursor
|
||||
index.contextLimit = limit;
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.print(Utility.escape(i + ": \"" +
|
||||
substring(text, index.__contextStart, index.__start) + '|' +
|
||||
substring(text, index.__start, index.__contextLimit) +
|
||||
substring(text, index.contextStart, index.start) + '|' +
|
||||
substring(text, index.start, index.contextLimit) +
|
||||
"\" -> \""));
|
||||
}
|
||||
|
||||
|
@ -297,19 +297,19 @@ public class CompoundTransliterator extends Transliterator {
|
|||
|
||||
if (DEBUG) {
|
||||
System.out.println(Utility.escape(
|
||||
substring(text, index.__contextStart, index.__start) + '|' +
|
||||
substring(text, index.__start, index.__contextLimit) +
|
||||
substring(text, index.contextStart, index.start) + '|' +
|
||||
substring(text, index.start, index.contextLimit) +
|
||||
'"'));
|
||||
}
|
||||
|
||||
// Adjust overall limit for insertions/deletions
|
||||
globalLimit += index.__contextLimit - limit;
|
||||
limit = index.__start; // Move limit to end of committed text
|
||||
globalLimit += index.contextLimit - limit;
|
||||
limit = index.start; // Move limit to end of committed text
|
||||
}
|
||||
// Cursor is good where it is -- where the last
|
||||
// transliterator left it. Limit needs to be put back
|
||||
// where it was, modulo adjustments for deletions/insertions.
|
||||
index.__contextLimit = globalLimit;
|
||||
index.contextLimit = globalLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/Attic/HexToUnicodeTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ import java.util.*;
|
|||
* applyPattern() for details.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: HexToUnicodeTransliterator.java,v $ $Revision: 1.6 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: HexToUnicodeTransliterator.java,v $ $Revision: 1.7 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class HexToUnicodeTransliterator extends Transliterator {
|
||||
private static final String COPYRIGHT =
|
||||
|
@ -267,8 +267,8 @@ public class HexToUnicodeTransliterator extends Transliterator {
|
|||
*/
|
||||
protected void handleTransliterate(Replaceable text,
|
||||
Position offsets, boolean isIncremental) {
|
||||
int cursor = offsets.__start;
|
||||
int limit = offsets.__contextLimit;
|
||||
int cursor = offsets.start;
|
||||
int limit = offsets.contextLimit;
|
||||
int i, j, ipat;
|
||||
|
||||
loop:
|
||||
|
@ -373,7 +373,7 @@ public class HexToUnicodeTransliterator extends Transliterator {
|
|||
++cursor;
|
||||
}
|
||||
|
||||
offsets.__contextLimit = limit;
|
||||
offsets.__start = cursor;
|
||||
offsets.contextLimit = limit;
|
||||
offsets.start = cursor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NullTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -37,6 +37,6 @@ public class NullTransliterator extends Transliterator {
|
|||
*/
|
||||
protected void handleTransliterate(Replaceable text,
|
||||
Position offsets, boolean incremental) {
|
||||
offsets.__start = offsets.__contextLimit;
|
||||
offsets.start = offsets.contextLimit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/RuleBasedTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.33 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.34 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -252,7 +252,7 @@ import com.ibm.util.Utility;
|
|||
* <p>Copyright (c) IBM Corporation 1999-2000. All rights reserved.</p>
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: RuleBasedTransliterator.java,v $ $Revision: 1.33 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: RuleBasedTransliterator.java,v $ $Revision: 1.34 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class RuleBasedTransliterator extends Transliterator {
|
||||
|
||||
|
@ -324,9 +324,9 @@ public class RuleBasedTransliterator extends Transliterator {
|
|||
* exz|d no match, advance cursor
|
||||
* exzd| done
|
||||
*/
|
||||
int start = index.__contextStart;
|
||||
int limit = index.__contextLimit;
|
||||
int cursor = index.__start;
|
||||
int start = index.contextStart;
|
||||
int limit = index.contextLimit;
|
||||
int cursor = index.start;
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.print("\"" +
|
||||
|
@ -391,8 +391,8 @@ public class RuleBasedTransliterator extends Transliterator {
|
|||
Utility.escape(rsubstring(text, cursor, limit)) + "\"");
|
||||
}
|
||||
|
||||
index.__contextLimit = limit;
|
||||
index.__start = cursor;
|
||||
index.contextLimit = limit;
|
||||
index.start = cursor;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1328,6 +1328,9 @@ public class RuleBasedTransliterator extends Transliterator {
|
|||
|
||||
/**
|
||||
* $Log: RuleBasedTransliterator.java,v $
|
||||
* Revision 1.34 2000/06/28 20:36:32 alan4j
|
||||
* Clean up Transliterator::Position - rename temporary names
|
||||
*
|
||||
* Revision 1.33 2000/06/28 20:31:43 alan4j
|
||||
* Clean up Transliterator::Position and rename fields (related to jitterbug 450)
|
||||
*
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/Transliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.17 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.18 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -210,7 +210,7 @@ import java.text.MessageFormat;
|
|||
* <p>Copyright © IBM Corporation 1999. All rights reserved.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.17 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.18 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public abstract class Transliterator {
|
||||
/**
|
||||
|
@ -256,7 +256,7 @@ public abstract class Transliterator {
|
|||
* anything before this index. INPUT parameter: This parameter is
|
||||
* not changed by a transliteration operation.
|
||||
*/
|
||||
public int __contextStart;
|
||||
public int contextStart;
|
||||
|
||||
/**
|
||||
* Ending index, exclusive, of the context to be considered for a
|
||||
|
@ -265,7 +265,7 @@ public abstract class Transliterator {
|
|||
* parameter is updated to reflect changes in the length of the
|
||||
* text, but points to the same logical position in the text.
|
||||
*/
|
||||
public int __contextLimit;
|
||||
public int contextLimit;
|
||||
|
||||
/**
|
||||
* Beginning index, inclusive, of the text to be transliteratd.
|
||||
|
@ -273,7 +273,7 @@ public abstract class Transliterator {
|
|||
* characters that have already been transliterated by a
|
||||
* transliteration operation.
|
||||
*/
|
||||
public int __start;
|
||||
public int start;
|
||||
|
||||
/**
|
||||
* Ending index, exclusive, of the text to be transliteratd.
|
||||
|
@ -281,7 +281,7 @@ public abstract class Transliterator {
|
|||
* changes in the length of the text, but points to the same
|
||||
* logical position in the text.
|
||||
*/
|
||||
public int __limit;
|
||||
public int limit;
|
||||
|
||||
public Position() {
|
||||
this(0, 0, 0, 0);
|
||||
|
@ -293,10 +293,10 @@ public abstract class Transliterator {
|
|||
|
||||
public Position(int contextStart, int contextLimit,
|
||||
int start, int limit) {
|
||||
this.__contextStart = contextStart;
|
||||
this.__contextLimit = contextLimit;
|
||||
this.__start = start;
|
||||
this.__limit = limit;
|
||||
this.contextStart = contextStart;
|
||||
this.contextLimit = contextLimit;
|
||||
this.start = start;
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ public abstract class Transliterator {
|
|||
public final int transliterate(Replaceable text, int start, int limit) {
|
||||
Position pos = new Position(start, limit, start);
|
||||
handleTransliterate(text, pos, false);
|
||||
return pos.__contextLimit;
|
||||
return pos.contextLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,24 +483,24 @@ public abstract class Transliterator {
|
|||
* transliterated unambiguosly after new text has been inserted,
|
||||
* typically as a result of a keyboard event. The new text in
|
||||
* <code>insertion</code> will be inserted into <code>text</code>
|
||||
* at <code>index.__contextLimit</code>, advancing
|
||||
* <code>index.__contextLimit</code> by <code>insertion.length()</code>.
|
||||
* at <code>index.contextLimit</code>, advancing
|
||||
* <code>index.contextLimit</code> by <code>insertion.length()</code>.
|
||||
* Then the transliterator will try to transliterate characters of
|
||||
* <code>text</code> between <code>index.__start</code> and
|
||||
* <code>index.__contextLimit</code>. Characters before
|
||||
* <code>index.__start</code> will not be changed.
|
||||
* <code>text</code> between <code>index.start</code> and
|
||||
* <code>index.contextLimit</code>. Characters before
|
||||
* <code>index.start</code> will not be changed.
|
||||
*
|
||||
* <p>Upon return, values in <code>index</code> will be updated.
|
||||
* <code>index.__contextStart</code> will be advanced to the first
|
||||
* <code>index.contextStart</code> will be advanced to the first
|
||||
* character that future calls to this method will read.
|
||||
* <code>index.__start</code> and <code>index.__contextLimit</code> will
|
||||
* <code>index.start</code> and <code>index.contextLimit</code> will
|
||||
* be adjusted to delimit the range of text that future calls to
|
||||
* this method may change.
|
||||
*
|
||||
* <p>Typical usage of this method begins with an initial call
|
||||
* with <code>index.__contextStart</code> and <code>index.__contextLimit</code>
|
||||
* with <code>index.contextStart</code> and <code>index.contextLimit</code>
|
||||
* set to indicate the portion of <code>text</code> to be
|
||||
* transliterated, and <code>index.__start == index.__contextStart</code>.
|
||||
* transliterated, and <code>index.start == index.contextStart</code>.
|
||||
* Thereafter, <code>index</code> can be used without
|
||||
* modification in future calls, provided that all changes to
|
||||
* <code>text</code> are made via this method.
|
||||
|
@ -519,7 +519,7 @@ public abstract class Transliterator {
|
|||
* of the cursor, and the start and limit of transliteration.
|
||||
* @param insertion text to be inserted and possibly
|
||||
* transliterated into the translation buffer at
|
||||
* <code>index.__contextLimit</code>. If <code>null</code> then no text
|
||||
* <code>index.contextLimit</code>. If <code>null</code> then no text
|
||||
* is inserted.
|
||||
* @see #handleTransliterate
|
||||
* @exception IllegalArgumentException if <code>index</code>
|
||||
|
@ -527,22 +527,22 @@ public abstract class Transliterator {
|
|||
*/
|
||||
public final void transliterate(Replaceable text, Position index,
|
||||
String insertion) {
|
||||
if (index.__contextStart < 0 ||
|
||||
index.__contextLimit > text.length() ||
|
||||
index.__start < index.__contextStart ||
|
||||
index.__start > index.__contextLimit) {
|
||||
if (index.contextStart < 0 ||
|
||||
index.contextLimit > text.length() ||
|
||||
index.start < index.contextStart ||
|
||||
index.start > index.contextLimit) {
|
||||
throw new IllegalArgumentException("Invalid index");
|
||||
}
|
||||
|
||||
int originalStart = index.__contextStart;
|
||||
int originalStart = index.contextStart;
|
||||
if (insertion != null) {
|
||||
text.replace(index.__contextLimit, index.__contextLimit, insertion);
|
||||
index.__contextLimit += insertion.length();
|
||||
text.replace(index.contextLimit, index.contextLimit, insertion);
|
||||
index.contextLimit += insertion.length();
|
||||
}
|
||||
|
||||
handleTransliterate(text, index, true);
|
||||
|
||||
index.__contextStart = Math.max(index.__start - getMaximumContextLength(),
|
||||
index.contextStart = Math.max(index.start - getMaximumContextLength(),
|
||||
originalStart);
|
||||
}
|
||||
|
||||
|
@ -558,7 +558,7 @@ public abstract class Transliterator {
|
|||
* of the cursor, and the start and limit of transliteration.
|
||||
* @param insertion text to be inserted and possibly
|
||||
* transliterated into the translation buffer at
|
||||
* <code>index.__contextLimit</code>.
|
||||
* <code>index.contextLimit</code>.
|
||||
* @see #transliterate(Replaceable, Transliterator.Position, String)
|
||||
*/
|
||||
public final void transliterate(Replaceable text, Position index,
|
||||
|
@ -593,36 +593,36 @@ public abstract class Transliterator {
|
|||
*/
|
||||
public final void finishTransliteration(Replaceable text,
|
||||
Position index) {
|
||||
if (index.__contextStart < 0 ||
|
||||
index.__contextLimit > text.length() ||
|
||||
index.__start < index.__contextStart ||
|
||||
index.__start > index.__contextLimit) {
|
||||
if (index.contextStart < 0 ||
|
||||
index.contextLimit > text.length() ||
|
||||
index.start < index.contextStart ||
|
||||
index.start > index.contextLimit) {
|
||||
throw new IllegalArgumentException("Invalid index");
|
||||
}
|
||||
|
||||
int originalStart = index.__contextStart;
|
||||
int originalStart = index.contextStart;
|
||||
|
||||
handleTransliterate(text, index, false);
|
||||
|
||||
index.__contextStart = Math.max(index.__start - getMaximumContextLength(),
|
||||
index.contextStart = Math.max(index.start - getMaximumContextLength(),
|
||||
originalStart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method that concrete subclasses define to implement
|
||||
* keyboard transliteration. This method should transliterate all
|
||||
* characters between <code>index.__start</code> and
|
||||
* <code>index.__contextLimit</code> that can be unambiguously
|
||||
* characters between <code>index.start</code> and
|
||||
* <code>index.contextLimit</code> that can be unambiguously
|
||||
* transliterated, regardless of future insertions of text at
|
||||
* <code>index.__contextLimit</code>. <code>index.__start</code> should
|
||||
* <code>index.contextLimit</code>. <code>index.start</code> should
|
||||
* be advanced past committed characters (those that will not
|
||||
* change in future calls to this method).
|
||||
* <code>index.__contextLimit</code> should be updated to reflect text
|
||||
* <code>index.contextLimit</code> should be updated to reflect text
|
||||
* replacements that shorten or lengthen the text between
|
||||
* <code>index.__start</code> and <code>index.__contextLimit</code>. Upon
|
||||
* return, neither <code>index.__start</code> nor
|
||||
* <code>index.__contextLimit</code> should be less than the initial value
|
||||
* of <code>index.__start</code>. <code>index.__contextStart</code>
|
||||
* <code>index.start</code> and <code>index.contextLimit</code>. Upon
|
||||
* return, neither <code>index.start</code> nor
|
||||
* <code>index.contextLimit</code> should be less than the initial value
|
||||
* of <code>index.start</code>. <code>index.contextStart</code>
|
||||
* should <em>not</em> be changed.
|
||||
*
|
||||
* @param text the buffer holding transliterated and
|
||||
|
@ -630,7 +630,7 @@ public abstract class Transliterator {
|
|||
* @param pos the start and limit of the text, the position
|
||||
* of the cursor, and the start and limit of transliteration.
|
||||
* @param incremental if true, assume more text may be coming after
|
||||
* pos.__contextLimit. Otherwise, assume the text is complete.
|
||||
* pos.contextLimit. Otherwise, assume the text is complete.
|
||||
* @see #transliterate
|
||||
*/
|
||||
protected abstract void handleTransliterate(Replaceable text,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/Attic/UnicodeToHexTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@ import java.util.*;
|
|||
* default is uppercase.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: UnicodeToHexTransliterator.java,v $ $Revision: 1.7 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: UnicodeToHexTransliterator.java,v $ $Revision: 1.8 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class UnicodeToHexTransliterator extends Transliterator {
|
||||
|
||||
|
@ -291,8 +291,8 @@ public class UnicodeToHexTransliterator extends Transliterator {
|
|||
* Unicode hexadecimal escapes. For example, '@' -> "U+0040",
|
||||
* assuming the prefix is "U+".
|
||||
*/
|
||||
int cursor = offsets.__start;
|
||||
int limit = offsets.__contextLimit;
|
||||
int cursor = offsets.start;
|
||||
int limit = offsets.contextLimit;
|
||||
|
||||
UnicodeFilter filter = getFilter();
|
||||
StringBuffer hex = new StringBuffer(prefix);
|
||||
|
@ -323,7 +323,7 @@ public class UnicodeToHexTransliterator extends Transliterator {
|
|||
limit += len;
|
||||
}
|
||||
|
||||
offsets.__contextLimit = limit;
|
||||
offsets.__start = cursor;
|
||||
offsets.contextLimit = limit;
|
||||
offsets.start = cursor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/test/translit/Attic/TransliteratorTest.java,v $
|
||||
* $Date: 2000/06/28 20:31:27 $
|
||||
* $Revision: 1.21 $
|
||||
* $Date: 2000/06/28 20:36:59 $
|
||||
* $Revision: 1.22 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -293,12 +293,12 @@ public class TransliteratorTest extends TestFmwk {
|
|||
}
|
||||
String str = s.toString();
|
||||
// Show the start index '{' and the cursor '|'
|
||||
log.append(str.substring(0, index.__contextStart)).
|
||||
log.append(str.substring(0, index.contextStart)).
|
||||
append('{').
|
||||
append(str.substring(index.__contextStart,
|
||||
index.__start)).
|
||||
append(str.substring(index.contextStart,
|
||||
index.start)).
|
||||
append('|').
|
||||
append(str.substring(index.__start));
|
||||
append(str.substring(index.start));
|
||||
if (str.equals(DATA[i+1])) {
|
||||
logln(log.toString());
|
||||
} else {
|
||||
|
@ -599,9 +599,9 @@ public void TestJ277() {
|
|||
// Append the string buffer with a vertical bar '|' where
|
||||
// the committed index is.
|
||||
String s = rsource.toString();
|
||||
log.append(s.substring(0, index.__start)).
|
||||
log.append(s.substring(0, index.start)).
|
||||
append('|').
|
||||
append(s.substring(index.__start));
|
||||
append(s.substring(index.start));
|
||||
}
|
||||
|
||||
// As a final step in keyboard transliteration, we must call
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/CompoundTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.9 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.10 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ import java.util.Vector;
|
|||
* <p>Copyright © IBM Corporation 1999. All rights reserved.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: CompoundTransliterator.java,v $ $Revision: 1.9 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: CompoundTransliterator.java,v $ $Revision: 1.10 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class CompoundTransliterator extends Transliterator {
|
||||
|
||||
|
@ -273,23 +273,23 @@ public class CompoundTransliterator extends Transliterator {
|
|||
* abc/u0041/u0041/u
|
||||
* S C L
|
||||
*/
|
||||
int cursor = index.__start;
|
||||
int limit = index.__contextLimit;
|
||||
int cursor = index.start;
|
||||
int limit = index.contextLimit;
|
||||
int globalLimit = limit;
|
||||
/* globalLimit is the overall limit. We keep track of this
|
||||
* since we overwrite index.__contextLimit with the previous
|
||||
* index.__start. After each transliteration, we update
|
||||
* since we overwrite index.contextLimit with the previous
|
||||
* index.start. After each transliteration, we update
|
||||
* globalLimit for insertions or deletions that have happened.
|
||||
*/
|
||||
|
||||
for (int i=0; i<trans.length; ++i) {
|
||||
index.__start = cursor; // Reset cursor
|
||||
index.__contextLimit = limit;
|
||||
index.start = cursor; // Reset cursor
|
||||
index.contextLimit = limit;
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.print(Utility.escape(i + ": \"" +
|
||||
substring(text, index.__contextStart, index.__start) + '|' +
|
||||
substring(text, index.__start, index.__contextLimit) +
|
||||
substring(text, index.contextStart, index.start) + '|' +
|
||||
substring(text, index.start, index.contextLimit) +
|
||||
"\" -> \""));
|
||||
}
|
||||
|
||||
|
@ -297,19 +297,19 @@ public class CompoundTransliterator extends Transliterator {
|
|||
|
||||
if (DEBUG) {
|
||||
System.out.println(Utility.escape(
|
||||
substring(text, index.__contextStart, index.__start) + '|' +
|
||||
substring(text, index.__start, index.__contextLimit) +
|
||||
substring(text, index.contextStart, index.start) + '|' +
|
||||
substring(text, index.start, index.contextLimit) +
|
||||
'"'));
|
||||
}
|
||||
|
||||
// Adjust overall limit for insertions/deletions
|
||||
globalLimit += index.__contextLimit - limit;
|
||||
limit = index.__start; // Move limit to end of committed text
|
||||
globalLimit += index.contextLimit - limit;
|
||||
limit = index.start; // Move limit to end of committed text
|
||||
}
|
||||
// Cursor is good where it is -- where the last
|
||||
// transliterator left it. Limit needs to be put back
|
||||
// where it was, modulo adjustments for deletions/insertions.
|
||||
index.__contextLimit = globalLimit;
|
||||
index.contextLimit = globalLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/HangulJamoTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.6 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@ import java.util.*;
|
|||
* <p>Copyright © IBM Corporation 1999. All rights reserved.
|
||||
*
|
||||
* @author Mark Davis
|
||||
* @version $RCSfile: HangulJamoTransliterator.java,v $ $Revision: 1.5 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: HangulJamoTransliterator.java,v $ $Revision: 1.6 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class HangulJamoTransliterator extends Transliterator {
|
||||
private static final String COPYRIGHT =
|
||||
|
@ -42,8 +42,8 @@ public class HangulJamoTransliterator extends Transliterator {
|
|||
*/
|
||||
protected void handleTransliterate(Replaceable text,
|
||||
Position offsets, boolean incremental) {
|
||||
int cursor = offsets.__start;
|
||||
int limit = offsets.__contextLimit;
|
||||
int cursor = offsets.start;
|
||||
int limit = offsets.contextLimit;
|
||||
|
||||
StringBuffer replacement = new StringBuffer();
|
||||
while (cursor < limit) {
|
||||
|
@ -57,8 +57,8 @@ public class HangulJamoTransliterator extends Transliterator {
|
|||
}
|
||||
}
|
||||
|
||||
offsets.__contextLimit = limit;
|
||||
offsets.__start = cursor;
|
||||
offsets.contextLimit = limit;
|
||||
offsets.start = cursor;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/HexToUnicodeTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ import java.util.*;
|
|||
* applyPattern() for details.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: HexToUnicodeTransliterator.java,v $ $Revision: 1.6 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: HexToUnicodeTransliterator.java,v $ $Revision: 1.7 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class HexToUnicodeTransliterator extends Transliterator {
|
||||
private static final String COPYRIGHT =
|
||||
|
@ -267,8 +267,8 @@ public class HexToUnicodeTransliterator extends Transliterator {
|
|||
*/
|
||||
protected void handleTransliterate(Replaceable text,
|
||||
Position offsets, boolean isIncremental) {
|
||||
int cursor = offsets.__start;
|
||||
int limit = offsets.__contextLimit;
|
||||
int cursor = offsets.start;
|
||||
int limit = offsets.contextLimit;
|
||||
int i, j, ipat;
|
||||
|
||||
loop:
|
||||
|
@ -373,7 +373,7 @@ public class HexToUnicodeTransliterator extends Transliterator {
|
|||
++cursor;
|
||||
}
|
||||
|
||||
offsets.__contextLimit = limit;
|
||||
offsets.__start = cursor;
|
||||
offsets.contextLimit = limit;
|
||||
offsets.start = cursor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/JamoHangulTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -45,8 +45,8 @@ public class JamoHangulTransliterator extends Transliterator {
|
|||
/**
|
||||
* Performs transliteration changing Jamo to Hangul
|
||||
*/
|
||||
int cursor = offsets.__start;
|
||||
int limit = offsets.__contextLimit;
|
||||
int cursor = offsets.start;
|
||||
int limit = offsets.contextLimit;
|
||||
if (cursor >= limit) return;
|
||||
|
||||
int count[] = new int[1];
|
||||
|
@ -68,8 +68,8 @@ public class JamoHangulTransliterator extends Transliterator {
|
|||
}
|
||||
}
|
||||
|
||||
offsets.__contextLimit = limit + 1;
|
||||
offsets.__start = cursor;
|
||||
offsets.contextLimit = limit + 1;
|
||||
offsets.start = cursor;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/NullTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -37,6 +37,6 @@ public class NullTransliterator extends Transliterator {
|
|||
*/
|
||||
protected void handleTransliterate(Replaceable text,
|
||||
Position offsets, boolean incremental) {
|
||||
offsets.__start = offsets.__contextLimit;
|
||||
offsets.start = offsets.contextLimit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/RuleBasedTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.33 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.34 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -252,7 +252,7 @@ import com.ibm.util.Utility;
|
|||
* <p>Copyright (c) IBM Corporation 1999-2000. All rights reserved.</p>
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: RuleBasedTransliterator.java,v $ $Revision: 1.33 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: RuleBasedTransliterator.java,v $ $Revision: 1.34 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class RuleBasedTransliterator extends Transliterator {
|
||||
|
||||
|
@ -324,9 +324,9 @@ public class RuleBasedTransliterator extends Transliterator {
|
|||
* exz|d no match, advance cursor
|
||||
* exzd| done
|
||||
*/
|
||||
int start = index.__contextStart;
|
||||
int limit = index.__contextLimit;
|
||||
int cursor = index.__start;
|
||||
int start = index.contextStart;
|
||||
int limit = index.contextLimit;
|
||||
int cursor = index.start;
|
||||
|
||||
if (DEBUG) {
|
||||
System.out.print("\"" +
|
||||
|
@ -391,8 +391,8 @@ public class RuleBasedTransliterator extends Transliterator {
|
|||
Utility.escape(rsubstring(text, cursor, limit)) + "\"");
|
||||
}
|
||||
|
||||
index.__contextLimit = limit;
|
||||
index.__start = cursor;
|
||||
index.contextLimit = limit;
|
||||
index.start = cursor;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1328,6 +1328,9 @@ public class RuleBasedTransliterator extends Transliterator {
|
|||
|
||||
/**
|
||||
* $Log: RuleBasedTransliterator.java,v $
|
||||
* Revision 1.34 2000/06/28 20:36:32 alan4j
|
||||
* Clean up Transliterator::Position - rename temporary names
|
||||
*
|
||||
* Revision 1.33 2000/06/28 20:31:43 alan4j
|
||||
* Clean up Transliterator::Position and rename fields (related to jitterbug 450)
|
||||
*
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/Transliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.17 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.18 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -210,7 +210,7 @@ import java.text.MessageFormat;
|
|||
* <p>Copyright © IBM Corporation 1999. All rights reserved.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.17 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.18 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public abstract class Transliterator {
|
||||
/**
|
||||
|
@ -256,7 +256,7 @@ public abstract class Transliterator {
|
|||
* anything before this index. INPUT parameter: This parameter is
|
||||
* not changed by a transliteration operation.
|
||||
*/
|
||||
public int __contextStart;
|
||||
public int contextStart;
|
||||
|
||||
/**
|
||||
* Ending index, exclusive, of the context to be considered for a
|
||||
|
@ -265,7 +265,7 @@ public abstract class Transliterator {
|
|||
* parameter is updated to reflect changes in the length of the
|
||||
* text, but points to the same logical position in the text.
|
||||
*/
|
||||
public int __contextLimit;
|
||||
public int contextLimit;
|
||||
|
||||
/**
|
||||
* Beginning index, inclusive, of the text to be transliteratd.
|
||||
|
@ -273,7 +273,7 @@ public abstract class Transliterator {
|
|||
* characters that have already been transliterated by a
|
||||
* transliteration operation.
|
||||
*/
|
||||
public int __start;
|
||||
public int start;
|
||||
|
||||
/**
|
||||
* Ending index, exclusive, of the text to be transliteratd.
|
||||
|
@ -281,7 +281,7 @@ public abstract class Transliterator {
|
|||
* changes in the length of the text, but points to the same
|
||||
* logical position in the text.
|
||||
*/
|
||||
public int __limit;
|
||||
public int limit;
|
||||
|
||||
public Position() {
|
||||
this(0, 0, 0, 0);
|
||||
|
@ -293,10 +293,10 @@ public abstract class Transliterator {
|
|||
|
||||
public Position(int contextStart, int contextLimit,
|
||||
int start, int limit) {
|
||||
this.__contextStart = contextStart;
|
||||
this.__contextLimit = contextLimit;
|
||||
this.__start = start;
|
||||
this.__limit = limit;
|
||||
this.contextStart = contextStart;
|
||||
this.contextLimit = contextLimit;
|
||||
this.start = start;
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ public abstract class Transliterator {
|
|||
public final int transliterate(Replaceable text, int start, int limit) {
|
||||
Position pos = new Position(start, limit, start);
|
||||
handleTransliterate(text, pos, false);
|
||||
return pos.__contextLimit;
|
||||
return pos.contextLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,24 +483,24 @@ public abstract class Transliterator {
|
|||
* transliterated unambiguosly after new text has been inserted,
|
||||
* typically as a result of a keyboard event. The new text in
|
||||
* <code>insertion</code> will be inserted into <code>text</code>
|
||||
* at <code>index.__contextLimit</code>, advancing
|
||||
* <code>index.__contextLimit</code> by <code>insertion.length()</code>.
|
||||
* at <code>index.contextLimit</code>, advancing
|
||||
* <code>index.contextLimit</code> by <code>insertion.length()</code>.
|
||||
* Then the transliterator will try to transliterate characters of
|
||||
* <code>text</code> between <code>index.__start</code> and
|
||||
* <code>index.__contextLimit</code>. Characters before
|
||||
* <code>index.__start</code> will not be changed.
|
||||
* <code>text</code> between <code>index.start</code> and
|
||||
* <code>index.contextLimit</code>. Characters before
|
||||
* <code>index.start</code> will not be changed.
|
||||
*
|
||||
* <p>Upon return, values in <code>index</code> will be updated.
|
||||
* <code>index.__contextStart</code> will be advanced to the first
|
||||
* <code>index.contextStart</code> will be advanced to the first
|
||||
* character that future calls to this method will read.
|
||||
* <code>index.__start</code> and <code>index.__contextLimit</code> will
|
||||
* <code>index.start</code> and <code>index.contextLimit</code> will
|
||||
* be adjusted to delimit the range of text that future calls to
|
||||
* this method may change.
|
||||
*
|
||||
* <p>Typical usage of this method begins with an initial call
|
||||
* with <code>index.__contextStart</code> and <code>index.__contextLimit</code>
|
||||
* with <code>index.contextStart</code> and <code>index.contextLimit</code>
|
||||
* set to indicate the portion of <code>text</code> to be
|
||||
* transliterated, and <code>index.__start == index.__contextStart</code>.
|
||||
* transliterated, and <code>index.start == index.contextStart</code>.
|
||||
* Thereafter, <code>index</code> can be used without
|
||||
* modification in future calls, provided that all changes to
|
||||
* <code>text</code> are made via this method.
|
||||
|
@ -519,7 +519,7 @@ public abstract class Transliterator {
|
|||
* of the cursor, and the start and limit of transliteration.
|
||||
* @param insertion text to be inserted and possibly
|
||||
* transliterated into the translation buffer at
|
||||
* <code>index.__contextLimit</code>. If <code>null</code> then no text
|
||||
* <code>index.contextLimit</code>. If <code>null</code> then no text
|
||||
* is inserted.
|
||||
* @see #handleTransliterate
|
||||
* @exception IllegalArgumentException if <code>index</code>
|
||||
|
@ -527,22 +527,22 @@ public abstract class Transliterator {
|
|||
*/
|
||||
public final void transliterate(Replaceable text, Position index,
|
||||
String insertion) {
|
||||
if (index.__contextStart < 0 ||
|
||||
index.__contextLimit > text.length() ||
|
||||
index.__start < index.__contextStart ||
|
||||
index.__start > index.__contextLimit) {
|
||||
if (index.contextStart < 0 ||
|
||||
index.contextLimit > text.length() ||
|
||||
index.start < index.contextStart ||
|
||||
index.start > index.contextLimit) {
|
||||
throw new IllegalArgumentException("Invalid index");
|
||||
}
|
||||
|
||||
int originalStart = index.__contextStart;
|
||||
int originalStart = index.contextStart;
|
||||
if (insertion != null) {
|
||||
text.replace(index.__contextLimit, index.__contextLimit, insertion);
|
||||
index.__contextLimit += insertion.length();
|
||||
text.replace(index.contextLimit, index.contextLimit, insertion);
|
||||
index.contextLimit += insertion.length();
|
||||
}
|
||||
|
||||
handleTransliterate(text, index, true);
|
||||
|
||||
index.__contextStart = Math.max(index.__start - getMaximumContextLength(),
|
||||
index.contextStart = Math.max(index.start - getMaximumContextLength(),
|
||||
originalStart);
|
||||
}
|
||||
|
||||
|
@ -558,7 +558,7 @@ public abstract class Transliterator {
|
|||
* of the cursor, and the start and limit of transliteration.
|
||||
* @param insertion text to be inserted and possibly
|
||||
* transliterated into the translation buffer at
|
||||
* <code>index.__contextLimit</code>.
|
||||
* <code>index.contextLimit</code>.
|
||||
* @see #transliterate(Replaceable, Transliterator.Position, String)
|
||||
*/
|
||||
public final void transliterate(Replaceable text, Position index,
|
||||
|
@ -593,36 +593,36 @@ public abstract class Transliterator {
|
|||
*/
|
||||
public final void finishTransliteration(Replaceable text,
|
||||
Position index) {
|
||||
if (index.__contextStart < 0 ||
|
||||
index.__contextLimit > text.length() ||
|
||||
index.__start < index.__contextStart ||
|
||||
index.__start > index.__contextLimit) {
|
||||
if (index.contextStart < 0 ||
|
||||
index.contextLimit > text.length() ||
|
||||
index.start < index.contextStart ||
|
||||
index.start > index.contextLimit) {
|
||||
throw new IllegalArgumentException("Invalid index");
|
||||
}
|
||||
|
||||
int originalStart = index.__contextStart;
|
||||
int originalStart = index.contextStart;
|
||||
|
||||
handleTransliterate(text, index, false);
|
||||
|
||||
index.__contextStart = Math.max(index.__start - getMaximumContextLength(),
|
||||
index.contextStart = Math.max(index.start - getMaximumContextLength(),
|
||||
originalStart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method that concrete subclasses define to implement
|
||||
* keyboard transliteration. This method should transliterate all
|
||||
* characters between <code>index.__start</code> and
|
||||
* <code>index.__contextLimit</code> that can be unambiguously
|
||||
* characters between <code>index.start</code> and
|
||||
* <code>index.contextLimit</code> that can be unambiguously
|
||||
* transliterated, regardless of future insertions of text at
|
||||
* <code>index.__contextLimit</code>. <code>index.__start</code> should
|
||||
* <code>index.contextLimit</code>. <code>index.start</code> should
|
||||
* be advanced past committed characters (those that will not
|
||||
* change in future calls to this method).
|
||||
* <code>index.__contextLimit</code> should be updated to reflect text
|
||||
* <code>index.contextLimit</code> should be updated to reflect text
|
||||
* replacements that shorten or lengthen the text between
|
||||
* <code>index.__start</code> and <code>index.__contextLimit</code>. Upon
|
||||
* return, neither <code>index.__start</code> nor
|
||||
* <code>index.__contextLimit</code> should be less than the initial value
|
||||
* of <code>index.__start</code>. <code>index.__contextStart</code>
|
||||
* <code>index.start</code> and <code>index.contextLimit</code>. Upon
|
||||
* return, neither <code>index.start</code> nor
|
||||
* <code>index.contextLimit</code> should be less than the initial value
|
||||
* of <code>index.start</code>. <code>index.contextStart</code>
|
||||
* should <em>not</em> be changed.
|
||||
*
|
||||
* @param text the buffer holding transliterated and
|
||||
|
@ -630,7 +630,7 @@ public abstract class Transliterator {
|
|||
* @param pos the start and limit of the text, the position
|
||||
* of the cursor, and the start and limit of transliteration.
|
||||
* @param incremental if true, assume more text may be coming after
|
||||
* pos.__contextLimit. Otherwise, assume the text is complete.
|
||||
* pos.contextLimit. Otherwise, assume the text is complete.
|
||||
* @see #transliterate
|
||||
*/
|
||||
protected abstract void handleTransliterate(Replaceable text,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/UnicodeToHexTransliterator.java,v $
|
||||
* $Date: 2000/06/28 20:31:43 $
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 2000/06/28 20:36:32 $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@ import java.util.*;
|
|||
* default is uppercase.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: UnicodeToHexTransliterator.java,v $ $Revision: 1.7 $ $Date: 2000/06/28 20:31:43 $
|
||||
* @version $RCSfile: UnicodeToHexTransliterator.java,v $ $Revision: 1.8 $ $Date: 2000/06/28 20:36:32 $
|
||||
*/
|
||||
public class UnicodeToHexTransliterator extends Transliterator {
|
||||
|
||||
|
@ -291,8 +291,8 @@ public class UnicodeToHexTransliterator extends Transliterator {
|
|||
* Unicode hexadecimal escapes. For example, '@' -> "U+0040",
|
||||
* assuming the prefix is "U+".
|
||||
*/
|
||||
int cursor = offsets.__start;
|
||||
int limit = offsets.__contextLimit;
|
||||
int cursor = offsets.start;
|
||||
int limit = offsets.contextLimit;
|
||||
|
||||
UnicodeFilter filter = getFilter();
|
||||
StringBuffer hex = new StringBuffer(prefix);
|
||||
|
@ -323,7 +323,7 @@ public class UnicodeToHexTransliterator extends Transliterator {
|
|||
limit += len;
|
||||
}
|
||||
|
||||
offsets.__contextLimit = limit;
|
||||
offsets.__start = cursor;
|
||||
offsets.contextLimit = limit;
|
||||
offsets.start = cursor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/components/Attic/TransliteratingTextComponent.java,v $
|
||||
* $Date: 2000/06/28 20:31:14 $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2000/06/28 20:36:45 $
|
||||
* $Revision: 1.6 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@ import com.ibm.text.*;
|
|||
* <p>Copyright © IBM Corporation 1999. All rights reserved.
|
||||
*
|
||||
* @author Alan Liu
|
||||
* @version $RCSfile: TransliteratingTextComponent.java,v $ $Revision: 1.5 $ $Date: 2000/06/28 20:31:14 $
|
||||
* @version $RCSfile: TransliteratingTextComponent.java,v $ $Revision: 1.6 $ $Date: 2000/06/28 20:36:45 $
|
||||
*/
|
||||
public class TransliteratingTextComponent extends DumbTextComponent {
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class TransliteratingTextComponent extends DumbTextComponent {
|
|||
log = new StringBuffer();
|
||||
log.append("start " + start + ", cursor " + cursor);
|
||||
log.append(", sel " + getSelectionStart());
|
||||
log.append(", {" + index.__contextStart + ", " + index.__contextLimit + ", " + index.__start + "}, ");
|
||||
log.append(", {" + index.contextStart + ", " + index.contextLimit + ", " + index.start + "}, ");
|
||||
log.append('"' + buf.toString() + "\" + '" + ch + "' -> \"");
|
||||
}
|
||||
|
||||
|
@ -127,20 +127,20 @@ public class TransliteratingTextComponent extends DumbTextComponent {
|
|||
// it was zero. We can therefore just add it to our original
|
||||
// getText()-based index value of start (in saveStart) to get
|
||||
// the new getText()-based start.
|
||||
start = saveStart + index.__contextStart;
|
||||
start = saveStart + index.contextStart;
|
||||
|
||||
// Make the cursor getText()-based. The CURSOR index is zero-based.
|
||||
cursor = start + index.__start - index.__contextStart;
|
||||
cursor = start + index.start - index.contextStart;
|
||||
|
||||
if (DEBUG) {
|
||||
String out = buf.toString();
|
||||
log.append(out.substring(0, index.__contextStart)).
|
||||
log.append(out.substring(0, index.contextStart)).
|
||||
append('{').
|
||||
append(out.substring(index.__contextStart, index.__start)).
|
||||
append(out.substring(index.contextStart, index.start)).
|
||||
append('|').
|
||||
append(out.substring(index.__start)).
|
||||
append(out.substring(index.start)).
|
||||
append('"');
|
||||
log.append(", {" + index.__contextStart + ", " + index.__contextLimit + ", " + index.__start + "}, ");
|
||||
log.append(", {" + index.contextStart + ", " + index.contextLimit + ", " + index.start + "}, ");
|
||||
log.append("start " + start + ", cursor " + cursor);
|
||||
log.append(", sel " + getSelectionStart());
|
||||
System.out.println(escape(log.toString()));
|
||||
|
|
Loading…
Add table
Reference in a new issue