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()
ISourceFragmentgetPhysicalText in interface ISourceFragmentpublic String getLogicalText()
ISourceFragmentgetLogicalText in interface ISourceFragmentpublic int getPhysicalStart()
ISourceFragmentgetPhysicalStart in interface ISourceFragmentpublic 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()
ISourceFragmentgetPhysicalLine in interface ISourceFragmentpublic int getPhysicalColumn()
ISourceFragmentgetPhysicalColumn in interface ISourceFragmentpublic 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.