public class OffsetLookup extends Object
StreamingASTokenizer
has been altered so that
their start and end offsets are absolute offsets.
This class can translate an "absolute" offset to a tuple of filename and
"local offset" in the file. Each ASFileScope
has an
OffsetLookup
object.
Constructor and Description |
---|
OffsetLookup(com.google.common.collect.ImmutableList<OffsetCue> offsetCueList) |
Modifier and Type | Method and Description |
---|---|
int[] |
getAbsoluteOffset(String filename,
int localOffset)
Convert a local offset to an absolute offset.
|
String |
getFilename(int absoluteOffset)
Get the name of the file that contains the given absolute offset.
|
int |
getLocalOffset(int absoluteOffset)
Translate absolute offset to local offset.
|
boolean |
hasIncludes()
Determines if there are any includes.
|
String |
toString() |
public OffsetLookup(com.google.common.collect.ImmutableList<OffsetCue> offsetCueList)
public String getFilename(int absoluteOffset)
absoluteOffset
- absolute offsetpublic int getLocalOffset(int absoluteOffset)
absoluteOffset
- absolute offsetpublic int[] getAbsoluteOffset(String filename, int localOffset)
filename
- Normalized path of the file the local offset is in.localOffset
- Local offset.public boolean hasIncludes()
Copyright © 2016 The Apache Software Foundation. All rights reserved.