SchemaPairs.java
2.28 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa;
public final class SchemaPairs {
private int mCount;
private int[] meTags;
private Object[] mSchemaObj;
public SchemaPairs(SchemaPairs other) {
this.mCount = other.mCount;
this.meTags = new int[this.mCount];
System.arraycopy(other.meTags, 0, this.meTags, 0, this.mCount);
this.mSchemaObj = new Object[this.mCount];
System.arraycopy(other.mSchemaObj, 0, this.mSchemaObj, 0, this.mCount);
}
public SchemaPairs() {
}
public Object get(int eTag) {
for (int i = 0; i < this.mCount; ++i) {
int tag = this.meTags[i];
if (tag == eTag) {
return this.mSchemaObj[i];
}
if (eTag >= tag) continue;
return null;
}
return null;
}
public int key(int index) {
return this.meTags[index];
}
public void put(int eTag, Object schema) {
int index;
for (index = 0; index < this.mCount; ++index) {
int tag = this.meTags[index];
if (tag == eTag) {
this.mSchemaObj[index] = schema;
return;
}
if (eTag < tag) break;
}
if (this.meTags == null) {
this.meTags = new int[4];
this.mSchemaObj = new Object[4];
} else if (this.mCount == this.meTags.length) {
int newSize = this.mCount * 2;
int[] newTags = new int[newSize];
System.arraycopy(this.meTags, 0, newTags, 0, this.mCount);
Object[] newObj = new Object[newSize];
System.arraycopy(this.mSchemaObj, 0, newObj, 0, this.mCount);
this.meTags = newTags;
this.mSchemaObj = newObj;
}
int elementsToShift = this.mCount - index;
if (elementsToShift != 0) {
System.arraycopy(this.meTags, index, this.meTags, index + 1, elementsToShift);
System.arraycopy(this.mSchemaObj, index, this.mSchemaObj, index + 1, elementsToShift);
}
this.meTags[index] = eTag;
this.mSchemaObj[index] = schema;
++this.mCount;
}
public int size() {
return this.mCount;
}
public Object value(int index) {
return this.mSchemaObj[index];
}
}