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.visualdebugger;
09:
10: import java.io.File;
11:
12: /**
13: * A source element id identifies an occurrence of a source code element
14: * unambigously. In the current implementation an occurrence is identified by
15: * labeling programs (up to now only statement labels are supported). the
16: * labelling is performed by inserting a pseudo method call
17: * <tt>Debug.sep(id)</tt> before and after each statement.
18: *
19: * An isnatnce of this class refers to exact one such label.
20: */
21: public class SourceElementId {
22: private String className = "";
23:
24: private File file;
25:
26: private int id;
27:
28: private boolean isBoolean = false;
29:
30: private boolean isStatement = true;
31:
32: public SourceElementId(String id) {
33: this ("", new Integer(id).intValue());
34: }
35:
36: public SourceElementId(String cl, int id) {
37: this .id = id;
38: this .className = cl;
39:
40: }
41:
42: public SourceElementId(String cl, String id) {
43: this (id);
44: this .className = cl;
45:
46: }
47:
48: public SourceElementId(String cl, String id, boolean isStatement,
49: boolean isBoolean) {
50: this (cl, id);
51: this .isStatement = isStatement;
52: this .isBoolean = isBoolean;
53: }
54:
55: public boolean equals(Object o) {
56: if (o instanceof SourceElementId) {
57: SourceElementId id2 = (SourceElementId) o;
58: return id == id2.getId();
59: }
60: return false;
61: }
62:
63: public String getClassName() {
64: return className;
65: }
66:
67: public File getFile() {
68: return file;
69: }
70:
71: public int getId() {
72: return id;
73: }
74:
75: public int hashCode() {
76: return id;
77: }
78:
79: public boolean isBoolean() {
80: return isBoolean;
81: }
82:
83: public boolean isStatement() {
84: return isStatement;
85: }
86:
87: public String toString() {
88: return "Class Name: " + className + " Statement: " + id
89: + " File" + file;
90: }
91:
92: }
|