public class SourceFragment extends Object implements ISourceFragment
ISourceFragment
interface.
It also adds the ability to split a fragment at a list of character indices
within the logical text.Constructor and Description |
---|
SourceFragment(String text,
ISourceLocation location) |
SourceFragment(String physicalText,
String logicalText,
int physicalStart,
int physicalLine,
int physicalColumn) |
SourceFragment(String physicalText,
String logicalText,
ISourceLocation location) |
Modifier and Type | Method and Description |
---|---|
String |
getLogicalText()
Gets the post-processed text for this fragment.
|
int |
getPhysicalColumn()
Gets the column number where this fragment originally appeared in the file.
|
int |
getPhysicalLine()
Gets the line number where this fragment originally appeared in the file.
|
int |
getPhysicalStart()
Gets the starting offset where this fragment originally appeared in the file.
|
String |
getPhysicalText()
Gets the original text for this fragment, as it originally appeared in the file.
|
void |
setPhysicalStart(int physicalStart)
Sets the physical starting offset.
|
ISourceFragment |
subfragment(int beginIndex,
int endIndex)
Returns a subfragment from the fragment.
|
String |
toString()
For debugging only.
|
public SourceFragment(String physicalText, String logicalText, int physicalStart, int physicalLine, int physicalColumn)
public SourceFragment(String physicalText, String logicalText, ISourceLocation location)
public SourceFragment(String text, ISourceLocation location)
public String getPhysicalText()
ISourceFragment
getPhysicalText
in interface ISourceFragment
public String getLogicalText()
ISourceFragment
getLogicalText
in interface ISourceFragment
public int getPhysicalStart()
ISourceFragment
getPhysicalStart
in interface ISourceFragment
public void setPhysicalStart(int physicalStart)
This is used for mapping it from a local to an absolute offset, when we account for include statements and source attributes.
public int getPhysicalLine()
ISourceFragment
getPhysicalLine
in interface ISourceFragment
public int getPhysicalColumn()
ISourceFragment
getPhysicalColumn
in interface ISourceFragment
public ISourceFragment subfragment(int beginIndex, int endIndex)
beginIndex
- The beginning character index within the logical text.endIndex
- The ending character index within the logical txext.Copyright © 2016 The Apache Software Foundation. All rights reserved.