TextStreamIterator.java
1.46 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
import com.adobe.xfa.text.TextCharProp;
import com.adobe.xfa.text.TextCharPropIterator;
import com.adobe.xfa.text.TextPosnBase;
import com.adobe.xfa.text.TextStream;
public class TextStreamIterator
implements TextCharPropIterator {
private final TextPosnBase moPosition;
private final boolean mbForward;
private final boolean mbVisual;
private final int mnStartIndex;
public TextStreamIterator(TextStream poStream, int nIndex, boolean bForward, boolean bVisual) {
this.moPosition = new TextPosnBase(poStream, nIndex);
this.mbForward = bForward;
this.mbVisual = bVisual;
this.mnStartIndex = nIndex;
}
public TextStreamIterator(TextPosnBase oSourcePosn, boolean bForward, boolean bVisual) {
this.moPosition = new TextPosnBase(oSourcePosn);
this.mbForward = bForward;
this.mbVisual = bVisual;
this.mnStartIndex = oSourcePosn.index();
}
@Override
public int first() {
return this.mnStartIndex;
}
@Override
public int next(int nIndex) {
this.moPosition.index(nIndex);
return this.next();
}
@Override
public int next() {
char c = this.moPosition.charMove(this.mbForward, this.mbVisual);
return c == '\u0000' ? Integer.MAX_VALUE : TextCharProp.getCharProperty(c);
}
@Override
public int getNextIndex() {
return this.moPosition.index();
}
}