public final class SourceRange extends Object implements ISourceRange
ISourceRange
Constructor and Description |
---|
SourceRange(int offset,
int length)
Instantiate a new source range using the given offset and the given length.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getLength()
Returns the number of characters of the source code for this element,
relative to the source buffer in which this element is contained.
|
int |
getOffset()
Returns the 0-based index of the first character of the source code for this element,
relative to the source buffer in which this element is contained.
|
int |
hashCode() |
static boolean |
isAvailable(ISourceRange range)
Helper method that answers whether a valid source range is available
in the given ISourceRange.
|
String |
toString() |
public SourceRange(int offset, int length)
offset
- the given offsetlength
- the given lengthpublic static boolean isAvailable(ISourceRange range)
null
or a range of
[-1, 0] to indicate an invalid range. This utility method can be used
to detect that case.range
- a source range, can be null
true
iff range is not null and range.getOffset() is not -1public int getLength()
ISourceRange
getLength
in interface ISourceRange
ISourceRange
public int getOffset()
ISourceRange
getOffset
in interface ISourceRange
ISourceRange
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.