Stack.java
1.37 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.formcalc;
import com.adobe.xfa.formcalc.CalcSymbol;
public final class Stack {
static final int SIZE = 64;
private int mnStackSize;
private CalcSymbol[] moStackBase;
private int moStackPtr;
Stack() {
}
int create(int nStackSize) {
this.mnStackSize = nStackSize;
this.moStackBase = new CalcSymbol[this.mnStackSize];
this.moStackPtr = 0;
return 1;
}
void init() {
for (int i = 0; i < this.mnStackSize; ++i) {
this.moStackBase[i] = null;
}
this.moStackPtr = 0;
}
CalcSymbol pop() {
assert (this.moStackPtr > 0);
return this.moStackBase[--this.moStackPtr];
}
void push(CalcSymbol sym) {
if (this.moStackPtr >= this.mnStackSize) {
this.mnStackSize <<= 1;
CalcSymbol[] oNewBase = new CalcSymbol[this.mnStackSize];
System.arraycopy(this.moStackBase, 0, oNewBase, 0, this.mnStackSize >> 1);
this.moStackBase = oNewBase;
this.moStackPtr = this.mnStackSize >> 1;
}
this.moStackBase[this.moStackPtr++] = sym;
}
int getOffset() {
return this.moStackPtr;
}
public CalcSymbol peek(int nOffset) {
assert (0 <= nOffset && nOffset <= this.moStackPtr);
return this.moStackBase[nOffset];
}
}