InstructionQueue.java
3.45 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.types.ASName
*/
package com.adobe.internal.pdftoolkit.pdf.content;
import com.adobe.internal.pdftoolkit.core.types.ASName;
import com.adobe.internal.pdftoolkit.pdf.content.Instruction;
import java.util.HashSet;
import java.util.LinkedList;
public class InstructionQueue {
private LinkedList queue = new LinkedList();
public void enqueue(Instruction instruction) {
this.queue.addLast(instruction);
}
public Instruction dequeue() {
return (Instruction)this.queue.removeFirst();
}
public Instruction peekNextOut() {
return (Instruction)this.queue.getFirst();
}
public Instruction peekLastIn() {
return (Instruction)this.queue.getLast();
}
public boolean isEmpty() {
return this.queue.isEmpty();
}
public int size() {
return this.queue.size();
}
public void clear() {
this.queue.clear();
}
public boolean contains(ASName operator) {
Iterator iter = this.iterator();
while (iter.hasNext()) {
Instruction instr = iter.next();
if (instr.getOperator() != operator) continue;
return true;
}
return false;
}
public boolean containsOnly(HashSet operatorNameSet) {
Iterator iter = this.iterator();
while (iter.hasNext()) {
Instruction instr = iter.next();
if (operatorNameSet.contains((Object)instr.getOperator())) continue;
return false;
}
return true;
}
public boolean containAny(HashSet operatorNameSet) {
Iterator iter = this.iterator();
while (iter.hasNext()) {
Instruction instr = iter.next();
if (!operatorNameSet.contains((Object)instr.getOperator())) continue;
return true;
}
return false;
}
public boolean beginsWith(ASName[] operators) {
int i = 0;
Iterator iter = this.iterator();
while (iter.hasNext()) {
Instruction instr = iter.next();
if (instr.getOperator() != operators[i++]) {
return false;
}
if (i != operators.length) continue;
break;
}
return true;
}
public Iterator iterator() {
return new Iterator();
}
public boolean hasMarkedContentWrapper() {
Instruction startInstr = this.peekNextOut();
Instruction endInstr = this.peekLastIn();
ASName startOp = startInstr.getOperator();
ASName endOp = endInstr.getOperator();
if ((startOp == ASName.k_BMC || startOp == ASName.k_BDC) && endOp == ASName.k_EMC) {
return true;
}
return false;
}
public boolean removeMarkedContentWrapper() {
if (this.hasMarkedContentWrapper()) {
this.queue.removeFirst();
this.queue.removeLast();
return true;
}
return false;
}
public class Iterator {
private java.util.Iterator queueIter;
public Iterator() {
this.queueIter = InstructionQueue.this.queue.iterator();
}
public boolean hasNext() {
return this.queueIter.hasNext();
}
public Instruction next() {
return (Instruction)this.queueIter.next();
}
public void remove() {
this.queueIter.remove();
}
}
}