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.bcp;
21:
22: /**
23: * A Binding binds a name to a Variable.
24: *
25: * @author David Hovemeyer
26: * @see Variable
27: */
28: public class Binding {
29: private final String varName;
30: private final Variable variable;
31:
32: /**
33: * Constructor.
34: *
35: * @param varName the name of the variable
36: * @param variable the variable
37: */
38: public Binding(String varName, Variable variable) {
39: if (variable == null)
40: throw new IllegalArgumentException("No variable!");
41: this .varName = varName;
42: this .variable = variable;
43: }
44:
45: /**
46: * Get the variable name.
47: */
48: public String getVarName() {
49: return varName;
50: }
51:
52: /**
53: * Get the variable of the variable.
54: */
55: public Variable getVariable() {
56: return variable;
57: }
58:
59: @Override
60: public String toString() {
61: StringBuffer buf = new StringBuffer();
62: buf.append(varName);
63: buf.append('=');
64: buf.append(variable.toString());
65: return buf.toString();
66: }
67: }
68:
69: // vim:ts=4
|