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