PostScriptStack.java
1.7 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.internal.pdftoolkit.pdf.graphics.impl;
import java.util.ArrayList;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class PostScriptStack<T> {
private ArrayList<T> list = new ArrayList();
private int pos = 0;
public T pop() {
return this.list.get(--this.pos);
}
public void push(T value) {
if (this.list.size() == this.pos) {
this.list.add(value);
++this.pos;
} else {
this.list.set(this.pos++, value);
}
}
public boolean isEmpty() {
return this.pos == 0;
}
public T peek() {
return this.list.get(this.pos - 1);
}
public int size() {
return this.pos;
}
public void clear() {
this.list.clear();
this.pos = 0;
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
PostScriptStack postScriptObj = null;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
postScriptObj = (PostScriptStack)obj;
if (this.size() != postScriptObj.size()) {
return false;
}
int i = 0;
while (i < this.size()) {
T elem1 = this.list.get(i);
T elem2 = postScriptObj.list.get(i);
if (elem1 == null) {
if (elem2 != null) return false;
} else if (!elem1.equals(elem2)) {
return false;
}
++i;
}
return true;
}
}