UCharacterIterator.java
3.89 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.text;
import com.adobe.agl.impl.*;
import com.adobe.agl.text.Replaceable;
import com.adobe.agl.text.UForwardCharacterIterator;
import com.adobe.agl.text.UTF16;
import java.text.CharacterIterator;
public abstract class UCharacterIterator
implements UForwardCharacterIterator,
Cloneable {
protected UCharacterIterator() {
}
public static final UCharacterIterator getInstance(Replaceable source) {
return new ReplaceableUCharacterIterator(source);
}
public static final UCharacterIterator getInstance(String source) {
return new ReplaceableUCharacterIterator(source);
}
public static final UCharacterIterator getInstance(char[] source) {
return UCharacterIterator.getInstance(source, 0, source.length);
}
public static final UCharacterIterator getInstance(char[] source, int start, int limit) {
return new UCharArrayIterator(source, start, limit);
}
public static final UCharacterIterator getInstance(StringBuffer source) {
return new ReplaceableUCharacterIterator(source);
}
public static final UCharacterIterator getInstance(CharacterIterator source) {
return new CharacterIteratorWrapper(source);
}
public CharacterIterator getCharacterIterator() {
return new UCharacterIteratorWrapper(this);
}
public abstract int current();
public int currentCodePoint() {
int ch = this.current();
if (UTF16.isLeadSurrogate((char)ch)) {
this.next();
int ch2 = this.current();
this.previous();
if (UTF16.isTrailSurrogate((char)ch2)) {
return UCharacterProperty.getRawSupplementary((char)ch, (char)ch2);
}
}
return ch;
}
public abstract int getLength();
public abstract int getIndex();
public abstract int next();
public int nextCodePoint() {
int ch1 = this.next();
if (UTF16.isLeadSurrogate((char)ch1)) {
int ch2 = this.next();
if (UTF16.isTrailSurrogate((char)ch2)) {
return UCharacterProperty.getRawSupplementary((char)ch1, (char)ch2);
}
if (ch2 != -1) {
this.previous();
}
}
return ch1;
}
public abstract int previous();
public int previousCodePoint() {
int ch1 = this.previous();
if (UTF16.isTrailSurrogate((char)ch1)) {
int ch2 = this.previous();
if (UTF16.isLeadSurrogate((char)ch2)) {
return UCharacterProperty.getRawSupplementary((char)ch2, (char)ch1);
}
if (ch2 != -1) {
this.next();
}
}
return ch1;
}
public abstract void setIndex(int var1);
public void setToLimit() {
this.setIndex(this.getLength());
}
public void setToStart() {
this.setIndex(0);
}
public abstract int getText(char[] var1, int var2);
public final int getText(char[] fillIn) {
return this.getText(fillIn, 0);
}
public String getText() {
char[] text = new char[this.getLength()];
this.getText(text);
return new String(text);
}
public int moveIndex(int delta) {
int x = Math.max(0, Math.min(this.getIndex() + delta, this.getLength()));
this.setIndex(x);
return x;
}
public int moveCodePointIndex(int delta) {
if (delta > 0) {
while (delta > 0 && this.nextCodePoint() != -1) {
--delta;
}
} else {
while (delta < 0 && this.previousCodePoint() != -1) {
++delta;
}
}
if (delta != 0) {
throw new IndexOutOfBoundsException();
}
return this.getIndex();
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}