KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > bcp > Binding


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.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 JavaDoc 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 JavaDoc varName, Variable variable) {
39         if (variable == null) throw new IllegalArgumentException JavaDoc("No variable!");
40         this.varName = varName;
41         this.variable = variable;
42     }
43
44     /**
45      * Get the variable name.
46      */

47     public String JavaDoc getVarName() {
48         return varName;
49     }
50
51     /**
52      * Get the variable of the variable.
53      */

54     public Variable getVariable() {
55         return variable;
56     }
57
58     @Override JavaDoc
59          public String JavaDoc toString() {
60         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
61         buf.append(varName);
62         buf.append('=');
63         buf.append(variable.toString());
64         return buf.toString();
65     }
66 }
67
68 // vim:ts=4
69
Popular Tags