Modifier and Type | Class and Description |
---|---|
class |
MXMLData.Cursor
A cursor represents the offset into the document and the index of the
MXML unit that contains that offset
|
Constructor and Description |
---|
MXMLData(IFileSpecification specification)
Constructor
|
MXMLData(int startOffset,
Reader mxmlText,
IFileSpecification fileSpec)
Constructor
|
MXMLData(int startOffset,
Reader mxmlText,
String path,
boolean fullContent)
Constructor
|
MXMLData(List<MXMLToken> tokens,
PrefixMap map,
IFileSpecification fileSpec)
Constructor
|
MXMLData(List<MXMLToken> tokens,
PrefixMap map,
IFileSpecification fileSpec,
boolean shouldRepair) |
MXMLData(Reader mxmlText,
IFileSpecification fileSpec) |
MXMLData(Reader mxmlText,
String path) |
Modifier and Type | Method and Description |
---|---|
static boolean |
contains(int start,
int end,
int offset)
Test whether the offset is contained within the range from start to end.
|
IMXMLTagData |
findAttributeListContainingOffset(int offset)
Get the open or empty tag whose attribute list contains this offset.
|
IMXMLUnitData |
findContainmentReferenceUnit(int offset)
Get the unit that should be referenced when looking at what tags contain
this offset (i.e. tags that are opened and not closed before this offset)
|
protected IMXMLUnitData |
findNearestUnit(int offset)
If the offset is contained within an MXML unit, get that unit.
|
IMXMLTagData |
findTagContainingOffset(int offset)
Get the open, close, or empty tag that contains this offset.
|
IMXMLTagData |
findTagOrSurroundingTagContainingOffset(int offset)
Similar to findTagContainingOffset, but if the unit inside offset is a
text node, will return the surrounding tag instead.
|
IMXMLUnitData |
findUnitContainingOffset(int offset)
Get the unit that contains this offset
|
MXMLData.Cursor |
getCursor() |
PrefixMap |
getDocumentPrefixMap()
Returns a collection of prefix->namespaces mappings found within this
document.
|
int |
getEnd()
Gets the ending offset of the last unit.
|
IFileSpecification |
getFileSpecification()
Gets the file on disk that created this
MXMLData . |
MXMLDialect |
getMXMLDialect()
Gets the MXML dialect being used.
|
int |
getNumUnits()
Gets the number of MXML "units".
|
String |
getPath()
Gets the path to the file on disk that created this
MXMLData . |
PrefixMap |
getPrefixMapForData(IMXMLTagData data)
Returns the PrefixMap for the given
IMXMLTagData . |
Collection<ICompilerProblem> |
getProblems()
Gets the compiler problems found during the creation of this
MXMLData . |
static PrefixMap |
getRootNamespaces(Reader reader)
Get the namespaces defined on the root tag
|
IMXMLTagData |
getRootTag()
Gets the root tag.
|
PrefixMap |
getRootTagPrefixMap()
Returns the PrefixMap for the root tag of this
MXMLData object |
Map<IMXMLTagData,PrefixMap> |
getTagToPrefixMap() |
protected org.apache.flex.compiler.internal.mxml.MXMLData.TokenizerPayload |
getTokens(int startOffset,
Reader reader) |
protected org.apache.flex.compiler.internal.mxml.MXMLData.TokenizerPayload |
getTokens(Reader reader) |
IMXMLUnitData |
getUnit(int i)
Gets an MXML unit by index.
|
Iterator<IMXMLUnitData> |
getUnitIterator() |
IMXMLUnitData[] |
getUnits()
Get the MXML units found in this
IMXMLData . |
boolean |
hasProblems() |
protected void |
initializeFromTokens(List<MXMLToken> tokens)
Common code from the two constructors
|
boolean |
isDataRepaired()
Determines if this data was built from a source that was repaired
|
static void |
main(String[] args) |
void |
refreshPositionData()
Used to rebuild the structures inside of the MXMLData, refreshing prefix
maps, depth and position data.
|
void |
setPath(String path)
API to change the path after MXMLData creation.
|
void |
setPrefixMappings(HashMap<IMXMLTagData,PrefixMap> map) |
void |
setUnits(IMXMLUnitData[] units)
Replace the list of units in this MXMLData.
|
void |
setWasRepaired(boolean wasRepaired) |
String |
toString()
For debugging only.
|
void |
updateMXMLVersion(PrefixMap map)
Update the version of the mxml data
|
boolean |
verify()
Verifies that all units (plus all attributes on units that are tags) have
their source location information set.
|
public MXMLData(List<MXMLToken> tokens, PrefixMap map, IFileSpecification fileSpec)
tokens
- MXML tokens to build the MXMLData object frommap
- the PrefixMap
for the document, containing the
namespace/prefix mappingspublic MXMLData(List<MXMLToken> tokens, PrefixMap map, IFileSpecification fileSpec, boolean shouldRepair)
public MXMLData(int startOffset, Reader mxmlText, IFileSpecification fileSpec)
mxmlText
- input build our MXMLData
frompublic MXMLData(int startOffset, Reader mxmlText, String path, boolean fullContent)
mxmlText
- input build our MXMLData
frompublic MXMLData(Reader mxmlText, IFileSpecification fileSpec)
public MXMLData(IFileSpecification specification)
specification
- input build our MXMLData
frompublic void updateMXMLVersion(PrefixMap map)
map
- the prefix mappublic static PrefixMap getRootNamespaces(Reader reader) throws IOException
reader
- The reader which would provide the root tag informationPrefixMap
for the root tagIOException
- errorprotected org.apache.flex.compiler.internal.mxml.MXMLData.TokenizerPayload getTokens(Reader reader)
protected org.apache.flex.compiler.internal.mxml.MXMLData.TokenizerPayload getTokens(int startOffset, Reader reader)
public MXMLDialect getMXMLDialect()
IMXMLData
getMXMLDialect
in interface IMXMLData
MXMLDialect
.public PrefixMap getPrefixMapForData(IMXMLTagData data)
IMXMLData
IMXMLTagData
. This will not
walk up the chain of prefix maps if this tag does not physically have
uri->namespace mappings.getPrefixMapForData
in interface IMXMLData
data
- the IMXMLTagData
to find the PrefixMap
forPrefixMap
or nullpublic void setPrefixMappings(HashMap<IMXMLTagData,PrefixMap> map)
public Map<IMXMLTagData,PrefixMap> getTagToPrefixMap()
public PrefixMap getDocumentPrefixMap()
IMXMLTagData
and
IMXMLTagAttributeData
objects should be calledpublic PrefixMap getRootTagPrefixMap()
MXMLData
objectPrefixMap
or nullpublic Collection<ICompilerProblem> getProblems()
IMXMLData
MXMLData
.getProblems
in interface IMXMLData
ICompilerProblem
objects.public boolean hasProblems()
public boolean isDataRepaired()
public void setWasRepaired(boolean wasRepaired)
public IFileSpecification getFileSpecification()
IMXMLData
MXMLData
.getFileSpecification
in interface IMXMLData
IFileSpecification
.public String getPath()
IMXMLData
MXMLData
.public void setPath(String path)
path
- is the absolute path to the backing source fileprotected void initializeFromTokens(List<MXMLToken> tokens)
tokens
- A list of MXML tokens.public void refreshPositionData()
public IMXMLUnitData[] getUnits()
IMXMLData
IMXMLData
.getUnits
in interface IMXMLData
IMXMLUnitData
.public Iterator<IMXMLUnitData> getUnitIterator()
public void setUnits(IMXMLUnitData[] units)
units
- units to addpublic IMXMLUnitData getUnit(int i)
IMXMLData
public int getNumUnits()
IMXMLData
Each unit represents an open tag, a close tag, a block of text, etc.
getNumUnits
in interface IMXMLData
MXMLUnitData
objects you can retrieve with
getUnit()
.protected IMXMLUnitData findNearestUnit(int offset)
offset
- test offsetpublic IMXMLUnitData findContainmentReferenceUnit(int offset)
offset
- test offsetpublic IMXMLUnitData findUnitContainingOffset(int offset)
offset
- test offsetpublic IMXMLTagData findTagContainingOffset(int offset)
offset
- test offsetpublic IMXMLTagData findTagOrSurroundingTagContainingOffset(int offset)
IMXMLData
findTagOrSurroundingTagContainingOffset
in interface IMXMLData
offset
- offsetpublic IMXMLTagData findAttributeListContainingOffset(int offset)
offset
- test offsetpublic static boolean contains(int start, int end, int offset)
start
- start of the range (excluded)end
- end of the range (included)offset
- test offsetpublic IMXMLTagData getRootTag()
IMXMLData
getRootTag
in interface IMXMLData
MXMLTagData
for the root tag.public int getEnd()
IMXMLData
public MXMLData.Cursor getCursor()
public boolean verify()
This is used only in asserts.
public static void main(String[] args)
Copyright © 2016 The Apache Software Foundation. All rights reserved.