KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > ResourceValueFrame


1 /*
2  * Bytecode Analysis Framework
3  * Copyright (C) 2003,2004 University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 JavaDoc
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 JavaDoc
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 JavaDoc[] statusList = {"(escaped)", "(open)", "(open_exception)", "(closed)", "(created)", "(nonexistent)"};
85
86     @Override JavaDoc
87          public String JavaDoc toString() {
88         return super.toString() + statusList[status];
89     }
90
91 }
92
93 // vim:ts=4
94
Popular Tags