01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: package de.uka.ilkd.key.logic;
09:
10: import java.util.HashMap;
11: import java.util.Iterator;
12: import java.util.LinkedList;
13:
14: import de.uka.ilkd.key.java.SourceElement;
15:
16: public class SingleRenamingTable extends RenamingTable {
17:
18: SourceElement oldVar, newVar;
19: LinkedList ll = new LinkedList();
20:
21: public SingleRenamingTable(SourceElement oldVar,
22: SourceElement newVar) {
23: this .oldVar = oldVar;
24: this .newVar = newVar;
25: ll.add(oldVar);
26: }
27:
28: public SourceElement getRenaming(SourceElement se) {
29: if (se.equals(oldVar))
30: return newVar;
31: return null;
32: }
33:
34: public Iterator getRenamingIterator() {
35: return ll.listIterator(0);
36: }
37:
38: public String toString() {
39: return ("SingleRenamingTable: " + oldVar + " -> " + newVar);
40: }
41:
42: public HashMap getHashMap() {
43: HashMap hm = new HashMap();
44: hm.put(oldVar, newVar);
45: return hm;
46: }
47:
48: }
|