IntTrie.java
3.23 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.impl;
import com.adobe.agl.impl.Trie;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
public class IntTrie
extends Trie {
private int m_initialValue_;
private int[] m_data_;
public IntTrie(InputStream inputStream, Trie.DataManipulate dataManipulate) throws IOException {
super(inputStream, dataManipulate);
if (!this.isIntTrie()) {
throw new IllegalArgumentException("Data given does not belong to a int trie.");
}
}
public final int getCodePointValue(int ch) {
if (0 <= ch && ch < 55296) {
int offset = (this.m_index_[ch >> 5] << 2) + (ch & 31);
return this.m_data_[offset];
}
int offset = this.getCodePointOffset(ch);
return offset >= 0 ? this.m_data_[offset] : this.m_initialValue_;
}
public final int getLeadValue(char ch) {
return this.m_data_[this.getLeadOffset(ch)];
}
public final int getTrailValue(int leadvalue, char trail) {
if (this.m_dataManipulate_ == null) {
throw new NullPointerException("The field DataManipulate in this Trie is null");
}
int offset = this.m_dataManipulate_.getFoldingOffset(leadvalue);
if (offset > 0) {
return this.m_data_[this.getRawOffset(offset, (char)(trail & 1023))];
}
return this.m_initialValue_;
}
public final int getLatin1LinearValue(char ch) {
return this.m_data_[32 + ch];
}
public boolean equals(Object other) {
boolean result = super.equals(other);
if (result && other instanceof IntTrie) {
IntTrie othertrie = (IntTrie)other;
if (this.m_initialValue_ != othertrie.m_initialValue_ || !Arrays.equals(this.m_data_, othertrie.m_data_)) {
return false;
}
return true;
}
return false;
}
protected final void unserialize(InputStream inputStream) throws IOException {
super.unserialize(inputStream);
this.m_data_ = new int[this.m_dataLength_];
DataInputStream input = new DataInputStream(inputStream);
for (int i = 0; i < this.m_dataLength_; ++i) {
this.m_data_[i] = input.readInt();
}
this.m_initialValue_ = this.m_data_[0];
}
protected final int getSurrogateOffset(char lead, char trail) {
if (this.m_dataManipulate_ == null) {
throw new NullPointerException("The field DataManipulate in this Trie is null");
}
int offset = this.m_dataManipulate_.getFoldingOffset(this.getLeadValue(lead));
if (offset > 0) {
return this.getRawOffset(offset, (char)(trail & 1023));
}
return -1;
}
protected final int getValue(int index) {
return this.m_data_[index];
}
protected final int getInitialValue() {
return this.m_initialValue_;
}
IntTrie(char[] index, int[] data, int initialvalue, int options, Trie.DataManipulate datamanipulate) {
super(index, options, datamanipulate);
this.m_data_ = data;
this.m_dataLength_ = this.m_data_.length;
this.m_initialValue_ = initialvalue;
}
}