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