UnicodeSetIterator.java
2.19 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.text;
import com.adobe.agl.text.UnicodeSet;
import java.util.Iterator;
public class UnicodeSetIterator {
public static int IS_STRING = -1;
public int codepoint;
public int codepointEnd;
public String string;
private UnicodeSet set;
private int endRange = 0;
private int range = 0;
protected int endElement;
protected int nextElement;
private Iterator stringIterator = null;
public UnicodeSetIterator(UnicodeSet set) {
this.reset(set);
}
public UnicodeSetIterator() {
this.reset(new UnicodeSet());
}
public boolean nextRange() {
if (this.nextElement <= this.endElement) {
this.codepointEnd = this.endElement;
this.codepoint = this.nextElement;
this.nextElement = this.endElement + 1;
return true;
}
if (this.range < this.endRange) {
this.loadRange(++this.range);
this.codepointEnd = this.endElement;
this.codepoint = this.nextElement;
this.nextElement = this.endElement + 1;
return true;
}
if (this.stringIterator == null) {
return false;
}
this.codepoint = IS_STRING;
this.string = (String)this.stringIterator.next();
if (!this.stringIterator.hasNext()) {
this.stringIterator = null;
}
return true;
}
public void reset(UnicodeSet uset) {
this.set = uset;
this.reset();
}
public void reset() {
this.endRange = this.set.getRangeCount() - 1;
this.range = 0;
this.endElement = -1;
this.nextElement = 0;
if (this.endRange >= 0) {
this.loadRange(this.range);
}
this.stringIterator = null;
if (this.set.strings != null) {
this.stringIterator = this.set.strings.iterator();
if (!this.stringIterator.hasNext()) {
this.stringIterator = null;
}
}
}
protected void loadRange(int aRange) {
this.nextElement = this.set.getRangeStart(aRange);
this.endElement = this.set.getRangeEnd(aRange);
}
}