01: /*
02: * Bytecode Analysis Framework
03: * Copyright (C) 2003,2004 University of Maryland
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19:
20: package edu.umd.cs.findbugs.ba;
21:
22: public class ResourceValueFrame extends Frame<ResourceValue> {
23: /**
24: * The resource escapes the method.
25: */
26: public static final int ESCAPED = 0;
27:
28: /**
29: * The resource is open (or locked, etc) on paths that include only normal control flow.
30: */
31: public static final int OPEN = 1;
32:
33: /**
34: * The resource is open (or locked, etc) on paths that include exception control flow.
35: */
36: public static final int OPEN_ON_EXCEPTION_PATH = 2;
37:
38: /**
39: * The resource is closed (or unlocked, etc).
40: */
41: public static final int CLOSED = 3;
42:
43: /**
44: * The resource has been created, but is not open.
45: */
46: public static final int CREATED = 4;
47:
48: /**
49: * The resource doesn't exist.
50: */
51: public static final int NONEXISTENT = 5;
52:
53: private int status;
54:
55: public ResourceValueFrame(int numSlots) {
56: super (numSlots);
57: this .status = NONEXISTENT;
58: }
59:
60: public int getStatus() {
61: return status;
62: }
63:
64: public void setStatus(int status) {
65: this .status = status;
66: }
67:
68: @Override
69: public boolean sameAs(Frame<ResourceValue> other_) {
70: if (!super .sameAs(other_))
71: return false;
72:
73: ResourceValueFrame other = (ResourceValueFrame) other_;
74: return this .status == other.status;
75: }
76:
77: @Override
78: public void copyFrom(Frame<ResourceValue> other_) {
79: super .copyFrom(other_);
80: ResourceValueFrame other = (ResourceValueFrame) other_;
81: this .status = other.status;
82: }
83:
84: private static final String[] statusList = { "(escaped)", "(open)",
85: "(open_exception)", "(closed)", "(created)",
86: "(nonexistent)" };
87:
88: @Override
89: public String toString() {
90: return super .toString() + statusList[status];
91: }
92:
93: }
94:
95: // vim:ts=4
|