01: /*
02: * Copyright (C) 2000 Janus
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * 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: RefIntPair class
22:
23: Immutable pair of an EquivalentValue representing a reference
24: and an interger (representing a constant).
25: With pretty printing for BranchedRefVarsAnalysis.
26: */
27:
28: package soot.jimple.toolkits.annotation.nullcheck;
29:
30: import soot.*;
31:
32: public class RefIntPair {
33: private EquivalentValue _ref;
34: private int _val;
35:
36: // constructor is not public so that people go throught the ref pair constants factory on the analysis
37: RefIntPair(EquivalentValue r, int v, BranchedRefVarsAnalysis brva) {
38: this ._ref = r;
39: this ._val = v;
40: }
41:
42: public EquivalentValue ref() {
43: return this ._ref;
44: }
45:
46: public int val() {
47: return this ._val;
48: }
49:
50: public String toString() {
51: String prefix = "(" + _ref + ", ";
52: if (_val == BranchedRefVarsAnalysis.kNull)
53: return prefix + "null)";
54: else if (_val == BranchedRefVarsAnalysis.kNonNull)
55: return prefix + "non-null)";
56: else if (_val == BranchedRefVarsAnalysis.kTop)
57: return prefix + "top)";
58: else if (_val == BranchedRefVarsAnalysis.kBottom)
59: return prefix + "bottom)";
60: else
61: return prefix + _val + ")";
62: }
63: } // end class RefIntPair
|