UCharArrayIterator.java
1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.impl;
import com.adobe.agl.text.UCharacterIterator;
public final class UCharArrayIterator
extends UCharacterIterator {
private final char[] text;
private final int start;
private final int limit;
private int pos;
public UCharArrayIterator(char[] text, int start, int limit) {
if (start < 0 || limit > text.length || start > limit) {
throw new IllegalArgumentException("start: " + start + " or limit: " + limit + " out of range [0, " + text.length + ")");
}
this.text = text;
this.start = start;
this.limit = limit;
this.pos = start;
}
public int current() {
return this.pos < this.limit ? this.text[this.pos] : -1;
}
public int getLength() {
return this.limit - this.start;
}
public int getIndex() {
return this.pos - this.start;
}
public int next() {
int n = this.pos < this.limit ? this.text[this.pos++] : -1;
return n;
}
public int previous() {
int n = this.pos > this.start ? this.text[--this.pos] : -1;
return n;
}
public void setIndex(int index) {
if (index < 0 || index > this.limit - this.start) {
throw new IndexOutOfBoundsException("index: " + index + " out of range [0, " + (this.limit - this.start) + ")");
}
this.pos = this.start + index;
}
public int getText(char[] fillIn, int offset) {
int len = this.limit - this.start;
System.arraycopy(this.text, this.start, fillIn, offset, len);
return len;
}
public Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
return null;
}
}
}