Add null transliterator

X-SVN-Rev: 491
This commit is contained in:
Alan Liu 2000-01-06 17:38:25 +00:00
parent a55e26abb1
commit 697ee8afba
4 changed files with 94 additions and 2 deletions

View File

@ -0,0 +1,43 @@
package com.ibm.text;
import java.util.*;
/**
* A transliterator that leaves text unchanged.
*/
public class NullTransliterator extends Transliterator {
private static final String COPYRIGHT =
"\u00A9 IBM Corporation 2000. All rights reserved.";
/**
* Package accessible ID for this transliterator.
*/
static String _ID = "Null";
/**
* Constructs a transliterator.
*/
public NullTransliterator() {
super(_ID, null);
}
/**
* Transliterates a segment of a string. <code>Transliterator</code> API.
* @param text the string to be transliterated
* @param start the beginning index, inclusive; <code>0 <= start
* <= limit</code>.
* @param limit the ending index, exclusive; <code>start <= limit
* <= text.length()</code>.
* @return the new limit index
*/
public int transliterate(Replaceable text, int start, int limit) {
return limit;
}
/**
* Implements {@link Transliterator#handleKeyboardTransliterate}.
*/
protected void handleKeyboardTransliterate(Replaceable text,
int[] offsets) {
offsets[CURSOR] = offsets[LIMIT];
}
}

View File

@ -198,7 +198,7 @@ import java.text.MessageFormat;
* <p>Copyright &copy; IBM Corporation 1999. All rights reserved.
*
* @author Alan Liu
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.5 $ $Date: 2000/01/06 01:36:36 $
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.6 $ $Date: 2000/01/06 17:38:25 $
*/
public abstract class Transliterator {
/**
@ -880,9 +880,12 @@ public abstract class Transliterator {
}
} catch (MissingResourceException e) {}
// Register non-rule-based transliterators
registerClass(HexToUnicodeTransliterator._ID,
HexToUnicodeTransliterator.class);
registerClass(UnicodeToHexTransliterator._ID,
UnicodeToHexTransliterator.class);
registerClass(NullTransliterator._ID,
NullTransliterator.class);
}
}

View File

@ -0,0 +1,43 @@
package com.ibm.text;
import java.util.*;
/**
* A transliterator that leaves text unchanged.
*/
public class NullTransliterator extends Transliterator {
private static final String COPYRIGHT =
"\u00A9 IBM Corporation 2000. All rights reserved.";
/**
* Package accessible ID for this transliterator.
*/
static String _ID = "Null";
/**
* Constructs a transliterator.
*/
public NullTransliterator() {
super(_ID, null);
}
/**
* Transliterates a segment of a string. <code>Transliterator</code> API.
* @param text the string to be transliterated
* @param start the beginning index, inclusive; <code>0 <= start
* <= limit</code>.
* @param limit the ending index, exclusive; <code>start <= limit
* <= text.length()</code>.
* @return the new limit index
*/
public int transliterate(Replaceable text, int start, int limit) {
return limit;
}
/**
* Implements {@link Transliterator#handleKeyboardTransliterate}.
*/
protected void handleKeyboardTransliterate(Replaceable text,
int[] offsets) {
offsets[CURSOR] = offsets[LIMIT];
}
}

View File

@ -198,7 +198,7 @@ import java.text.MessageFormat;
* <p>Copyright &copy; IBM Corporation 1999. All rights reserved.
*
* @author Alan Liu
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.5 $ $Date: 2000/01/06 01:36:36 $
* @version $RCSfile: Transliterator.java,v $ $Revision: 1.6 $ $Date: 2000/01/06 17:38:25 $
*/
public abstract class Transliterator {
/**
@ -880,9 +880,12 @@ public abstract class Transliterator {
}
} catch (MissingResourceException e) {}
// Register non-rule-based transliterators
registerClass(HexToUnicodeTransliterator._ID,
HexToUnicodeTransliterator.class);
registerClass(UnicodeToHexTransliterator._ID,
UnicodeToHexTransliterator.class);
registerClass(NullTransliterator._ID,
NullTransliterator.class);
}
}