1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.verifier.structurals;
18
19
20
21
22
23 public class Frame {
24
25
26
27
28
29
30
31 @Deprecated
32 protected static UninitializedObjectType _this;
33
34
35
36
37
38 public static UninitializedObjectType getThis() {
39 return _this;
40 }
41
42
43
44
45
46 public static void setThis(final UninitializedObjectType _this) {
47 Frame._this = _this;
48 }
49
50
51
52 private final LocalVariables locals;
53
54
55
56 private final OperandStack stack;
57
58
59
60 public Frame(final int maxLocals, final int maxStack) {
61 locals = new LocalVariables(maxLocals);
62 stack = new OperandStack(maxStack);
63 }
64
65
66
67 public Frame(final LocalVariables locals, final OperandStack stack) {
68 this.locals = locals;
69 this.stack = stack;
70 }
71
72
73
74 @Override
75 protected Object clone() {
76 return new Frame(locals.getClone(), stack.getClone());
77 }
78
79
80
81 @Override
82 public boolean equals(final Object o) {
83 if (!(o instanceof Frame)) {
84 return false;
85 }
86 final Frame f = (Frame) o;
87 return this.stack.equals(f.stack) && this.locals.equals(f.locals);
88 }
89
90
91
92 public Frame getClone() {
93 return (Frame) clone();
94 }
95
96
97
98 public LocalVariables getLocals() {
99 return locals;
100 }
101
102
103
104 public OperandStack getStack() {
105 return stack;
106 }
107
108
109
110
111 @Override
112 public int hashCode() {
113 return stack.hashCode() ^ locals.hashCode();
114 }
115
116
117
118
119 @Override
120 public String toString() {
121 final StringBuilder s = new StringBuilder("Local Variables:\n");
122 s.append(locals);
123 s.append("OperandStack:\n");
124 s.append(stack);
125 return s.toString();
126 }
127 }