Transliterator.Position
public
static
class
Transliterator.Position
extends Object
java.lang.Object | |
↳ | android.icu.text.Transliterator.Position |
Position structure for incremental transliteration. This data structure defines two substrings of the text being transliterated. The first region, [contextStart, contextLimit), defines what characters the transliterator will read as context. The second region, [start, limit), defines what characters will actually be transliterated. The second region should be a subset of the first.
After a transliteration operation, some of the indices in this structure will be modified. See the field descriptions for details.
contextStart <= start <= limit <= contextLimit
Note: All index values in this structure must be at code point boundaries. That is, none of them may occur between two code units of a surrogate pair. If any index does split a surrogate pair, results are unspecified.
Summary
Fields | |
---|---|
public
int |
contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation. |
public
int |
contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation. |
public
int |
limit
Ending index, exclusive, of the text to be transliteratd. |
public
int |
start
Beginning index, inclusive, of the text to be transliteratd. |
Public constructors | |
---|---|
Position()
Constructs a Position object with start, limit, contextStart, and contextLimit all equal to zero. |
|
Position(Transliterator.Position pos)
Constructs a Position object that is a copy of another. |
|
Position(int contextStart, int contextLimit, int start)
Constructs a Position object with the given start, contextStart, and contextLimit. |
|
Position(int contextStart, int contextLimit, int start, int limit)
Constructs a Position object with the given start, limit, contextStart, and contextLimit. |
Public methods | |
---|---|
boolean
|
equals(Object obj)
Returns true if this Position is equal to the given object. |
int
|
hashCode()
Returns a hash code value for the object. |
void
|
set(Transliterator.Position pos)
Copies the indices of this position from another. |
String
|
toString()
Returns a string representation of this Position. |
final
void
|
validate(int length)
Check all bounds. |
Inherited methods | |
---|---|
Fields
contextLimit
public int contextLimit
Ending index, exclusive, of the context to be considered for a transliteration operation. The transliterator will ignore anything at or after this index. INPUT/OUTPUT parameter: This parameter is updated to reflect changes in the length of the text, but points to the same logical position in the text.
contextStart
public int contextStart
Beginning index, inclusive, of the context to be considered for a transliteration operation. The transliterator will ignore anything before this index. INPUT/OUTPUT parameter: This parameter is updated by a transliteration operation to reflect the maximum amount of antecontext needed by a transliterator.
limit
public int limit
Ending index, exclusive, of the text to be transliteratd. INPUT/OUTPUT parameter: This parameter is updated to reflect changes in the length of the text, but points to the same logical position in the text.
start
public int start
Beginning index, inclusive, of the text to be transliteratd. INPUT/OUTPUT parameter: This parameter is advanced past characters that have already been transliterated by a transliteration operation.
Public constructors
Position
public Position ()
Constructs a Position object with start, limit, contextStart, and contextLimit all equal to zero.
Position
public Position (Transliterator.Position pos)
Constructs a Position object that is a copy of another.
Parameters | |
---|---|
pos |
Transliterator.Position |
Position
public Position (int contextStart, int contextLimit, int start)
Constructs a Position object with the given start, contextStart, and contextLimit. The limit is set to the contextLimit.
Parameters | |
---|---|
contextStart |
int |
contextLimit |
int |
start |
int |
Position
public Position (int contextStart, int contextLimit, int start, int limit)
Constructs a Position object with the given start, limit, contextStart, and contextLimit.
Parameters | |
---|---|
contextStart |
int |
contextLimit |
int |
start |
int |
limit |
int |
Public methods
equals
public boolean equals (Object obj)
Returns true if this Position is equal to the given object.
Parameters | |
---|---|
obj |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
hashCode
public int hashCode ()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap
.
The general contract of hashCode
is:
- Whenever it is invoked on the same object more than once during
an execution of a Java application, the
hashCode
method must consistently return the same integer, provided no information used inequals
comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the
equals
method, then calling thehashCode
method on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal
according to the
equals
method, then calling thehashCode
method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns | |
---|---|
int |
a hash code value for this object. |
set
public void set (Transliterator.Position pos)
Copies the indices of this position from another.
Parameters | |
---|---|
pos |
Transliterator.Position |
toString
public String toString ()
Returns a string representation of this Position.
Returns | |
---|---|
String |
a string representation of the object. |
validate
public final void validate (int length)
Check all bounds. If they are invalid, throw an exception.
Parameters | |
---|---|
length |
int : the length of the string this object applies to |
Throws | |
---|---|
IllegalArgumentException |
if any indices are out of bounds |