TextIntArray.java
1.61 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
public final class TextIntArray {
public static final int MIN_ALLOC = 4;
private int[] mArray;
private int mSize;
public int[] getArray() {
return this.mArray;
}
public int getSize() {
return this.mSize;
}
public int[] setSize(int size, boolean preserve) {
this.allocate(size, preserve);
this.mSize = size;
return this.mArray;
}
public int[] setSize(int size) {
return this.setSize(size, false);
}
private int[] allocate(int newSize, boolean preserve) {
if (this.mArray == null || newSize > this.mArray.length) {
int alloc;
for (alloc = 4; alloc < newSize; alloc *= 2) {
}
int[] newArray = new int[alloc];
if (preserve && this.mArray != null) {
System.arraycopy(this.mArray, 0, newArray, 0, this.mSize);
}
this.mArray = newArray;
}
return this.mArray;
}
public int get(int index) {
return this.mArray[index];
}
public void add(int value) {
int index = this.mSize;
this.setSize(this.mSize + 1, true);
this.mArray[index] = value;
}
public void set(int index, int value) {
if (index >= this.mSize) {
this.setSize(index + 1, true);
}
this.mArray[index] = value;
}
public void copyFrom(TextIntArray source) {
this.setSize(source.mSize);
for (int i = 0; i < this.mSize; ++i) {
this.mArray[i] = source.mArray[i];
}
}
}