KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > npe > UnconditionalDerefSet


1 /*
2  * Bytecode analysis framework
3  * Copyright (C) 2005, 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.npe;
21
22 import java.util.BitSet JavaDoc;
23
24 /**
25  * @author David Hovemeyer
26  * @deprecated Use UnconditionalValueDerefAnalysis instead
27  */

28 public class UnconditionalDerefSet extends BitSet JavaDoc {
29     private static final long serialVersionUID = 1L;
30     
31     private final int numParams;
32     
33     public UnconditionalDerefSet(int numParams) {
34         this.numParams = numParams;
35     }
36     
37     public void setTop() {
38         clear();
39         set(numParams);
40     }
41     
42     public void setBottom() {
43         clear();
44         set(numParams + 1);
45     }
46     
47     public boolean isValid() {
48         return !isTop() && !isBottom();
49     }
50     
51     public boolean isTop() {
52         return get(numParams);
53     }
54     
55     public boolean isBottom() {
56         return get(numParams + 1);
57     }
58     
59     @Override JavaDoc
60          public String JavaDoc toString() {
61         if (isTop())
62             return "TOP";
63         else if (isBottom())
64             return "BOTTOM";
65         else
66             return super.toString();
67     }
68 }
69
Popular Tags