AFEAttrMap.java
3.32 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
import com.adobe.xfa.text.AFEFixedAttr;
import com.adobe.xfa.text.AFEVarAttr;
import com.adobe.xfa.text.AFEVarAttrTest;
import com.adobe.xfa.text.DispRun;
import com.adobe.xfa.text.TextContext;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
class AFEAttrMap {
private final TextContext mContext;
private final Map<Object, Integer> mAFEIndexMap = new HashMap<Object, Integer>();
private final SortedMap<AFEFixedAttr, AFEFixedAttr> mFixedAttrs = new TreeMap<AFEFixedAttr, AFEFixedAttr>();
private final SortedMap<AFEVarAttr, AFEVarAttr> mVarAttrs = new TreeMap<AFEVarAttr, AFEVarAttr>();
private AFEFixedAttr mFixedTest;
private final AFEVarAttrTest mVarTest;
private Object[] mAFEKeys;
private final AFEVarAttr mEmptyVarAttr;
AFEAttrMap(TextContext context) {
this.mContext = context;
this.mVarTest = new AFEVarAttrTest(this);
this.mEmptyVarAttr = new AFEVarAttr(this);
}
TextContext getContext() {
return this.mContext;
}
int getAFEIndexCount() {
return this.mAFEIndexMap.size();
}
Object[] getAFEKeys() {
if (this.mAFEKeys == null) {
this.mAFEKeys = new Object[this.mAFEIndexMap.size()];
for (Map.Entry<Object, Integer> entry : this.mAFEIndexMap.entrySet()) {
this.mAFEKeys[entry.getValue().intValue()] = entry.getKey();
}
}
return this.mAFEKeys;
}
AFEVarAttr getEmptyVarAttr() {
return this.mEmptyVarAttr;
}
int mapAFEIndex(Object attribute) {
int result;
Integer i = this.mAFEIndexMap.get(attribute);
if (i == null) {
result = this.mAFEIndexMap.size();
this.mAFEIndexMap.put(attribute, result);
this.mAFEKeys = null;
} else {
result = i;
}
return result;
}
AFEFixedAttr mapFixedAttr(DispRun dispRun, int bidiLevel) {
if (this.mFixedTest == null) {
this.mFixedTest = new AFEFixedAttr(this);
}
this.mFixedTest.populate(dispRun, bidiLevel);
AFEFixedAttr result = this.mFixedAttrs.get(this.mFixedTest);
if (result != null) {
return result;
}
result = this.mFixedTest;
this.mFixedTest = null;
this.mFixedAttrs.put(result, result);
return result;
}
AFEVarAttr mapVarAttr(AFEVarAttr base, Object key, Object value) {
this.mVarTest.setup(base, key, value);
AFEVarAttr result = this.mVarAttrs.get(this.mVarTest);
if (result != null) {
return result;
}
result = this.mVarTest.create();
this.mVarAttrs.put(result, result);
return result;
}
public String toString() {
StringBuilder result = new StringBuilder("Pooled attributes:\n\tFixed:");
for (AFEFixedAttr attr2 : this.mFixedAttrs.values()) {
result.append("\n\t\t");
result.append(attr2.toString());
}
result.append("\n\tVariable:");
for (AFEVarAttr attr : this.mVarAttrs.values()) {
result.append("\n\t\t");
result.append(attr.toString());
}
return result.toString();
}
}