KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > jimple > toolkits > annotation > nullcheck > RefIntPair


1 /*
2  * Copyright (C) 2000 Janus
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20
21 /*
22     RefIntPair class
23
24     Immutable pair of an EquivalentValue representing a reference
25     and an interger (representing a constant).
26     With pretty printing for BranchedRefVarsAnalysis.
27 */

28
29 package soot.jimple.toolkits.annotation.nullcheck;
30 import soot.*;
31
32 public class RefIntPair
33 {
34     private EquivalentValue _ref;
35     private int _val;
36     private BranchedRefVarsAnalysis brva;
37     
38     // constructor is not public so that people go throught the ref pair constants factory on the analysis
39
RefIntPair(EquivalentValue r, int v, BranchedRefVarsAnalysis brva)
40     {
41     this._ref = r;
42     this._val = v;
43         this.brva = brva;
44     }
45
46     public EquivalentValue ref ()
47     { return this._ref; }
48
49     public int val ()
50     { return this._val; }
51
52     public String JavaDoc toString()
53     {
54     String JavaDoc prefix = "("+_ref+", ";
55     if (_val == brva.kNull)
56         return prefix+"null)";
57     else if (_val == brva.kNonNull)
58         return prefix+"non-null)";
59     else if (_val == brva.kTop)
60         return prefix+"top)";
61     else if (_val == brva.kBottom)
62         return prefix+"bottom)";
63     else
64         return prefix+_val+")";
65     }
66 } // end class RefIntPair
67
Popular Tags