1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*******************************************************************************
* Copyright (c) 2000, 2005 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.ISourceRange;
/**
* @see ISourceRange
*/
class SourceRange implements ISourceRange {
protected int startPos, length;
protected int idStartPos, idLength;
protected int startLine, endLine;
protected SourceRange(int startPos, int length) {
this.startPos = startPos;
this.length = length;
idStartPos = 0;
idLength = 0;
startLine = 0;
endLine = 0;
}
protected SourceRange(int startPos, int length, int idStartPos, int idLength) {
this.startPos = startPos;
this.length = length;
this.idStartPos = idStartPos;
this.idLength = idLength;
}
protected SourceRange(int startPos, int length, int idStartPos, int idLength,
int startLine, int endLine) {
this.startPos = startPos;
this.length = length;
this.idStartPos = idStartPos;
this.idLength = idLength;
this.startLine = startLine;
this.endLine = endLine;
}
/**
* @see ISourceRange
*/
public int getLength() {
return length;
}
/**
* @see ISourceRange
*/
public int getStartPos() {
return startPos;
}
/**
*/
public int getIdStartPos() {
return idStartPos;
}
public int getIdLength() {
return idLength;
}
public int getStartLine() {
return startLine;
}
public int getEndLine() {
return endLine;
}
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[offset="); //$NON-NLS-1$
buffer.append(this.startPos);
buffer.append(", length="); //$NON-NLS-1$
buffer.append(this.length);
buffer.append("]"); //$NON-NLS-1$
buffer.append("[IdOffset="); //$NON-NLS-1$
buffer.append(this.idStartPos);
buffer.append(", idLength="); //$NON-NLS-1$
buffer.append(this.idLength);
buffer.append("]"); //$NON-NLS-1$
return buffer.toString();
}
}
|