01: package Schmortopf.JavaSourceEditor.SymbolUsageLocationSearch;
02:
03: /**
04: * Holds the location of the usage of a class with className from
05: * the inside of the file with associated parentFSD.
06: */
07:
08: import Schmortopf.FileStructure.Descriptions.FileStructureDescription;
09:
10: public class ClassReferenceEntry {
11:
12: // Meaning: The class <parentFSD> uses the class with the
13: // simple className at the position defined be the line/column attributes
14: private FileStructureDescription parentFSD;
15: private String className;
16: private int startLine = -1; // Important -> -1 means, not valid, and because this
17: private int startColumn = -1; // often is used for editor linenumbers, it's unique,
18: private int endLine = -1; // because these numbers are always positive, once set.
19: private int endColumn = -1;
20:
21: public ClassReferenceEntry(
22: final FileStructureDescription theParentFSD,
23: final String theClassName, final int theStartLine,
24: final int theStartColumn, final int theEndLine,
25: final int theEndColumn) {
26: this .parentFSD = theParentFSD;
27: this .className = theClassName;
28: this .startLine = theStartLine;
29: this .startColumn = theStartColumn;
30: this .endLine = theEndLine;
31: this .endColumn = theEndColumn;
32: } // Constructor
33:
34: public FileStructureDescription getParentFSD() {
35: return this .parentFSD;
36: }
37:
38: public String getClassName() {
39: return this .className;
40: }
41:
42: public int getStartLine() {
43: return this .startLine;
44: }
45:
46: public int getStartColumn() {
47: return this .startColumn;
48: }
49:
50: public int getEndLine() {
51: return this .endLine;
52: }
53:
54: public int getEndColumn() {
55: return this .endColumn;
56: }
57:
58: public boolean equals(final ClassReferenceEntry otherEntry) {
59: // Use reference comparison for the fsd's
60: return (otherEntry.getParentFSD().equals(this .parentFSD)
61: && otherEntry.getClassName().equals(this .className)
62: && otherEntry.getStartLine() == this .startLine
63: && otherEntry.getStartColumn() == this .startColumn
64: && otherEntry.getEndLine() == this .endLine && otherEntry
65: .getEndColumn() == this .endColumn);
66: }
67:
68: public String toString() {
69: StringBuffer buffer = new StringBuffer();
70: buffer.append("ParentFSD ");
71: buffer.append(this .parentFSD.fullyQualifiedClassNameBuffer);
72: buffer.append(" class name ");
73: buffer.append(this .className);
74: buffer.append(" startline ");
75: buffer.append(this .startLine);
76: buffer.append(" startcolumn ");
77: buffer.append(this .startColumn);
78: buffer.append(" endline ");
79: buffer.append(this .endLine);
80: buffer.append(" endcolumn ");
81: buffer.append(this .endColumn);
82: return buffer.toString();
83: }
84:
85: } // ClassReferenceEntry
|