|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--antlr.BaseAST | +--antlr.CommonAST | +--de.zeigermann.xpa.treeParser.XMLAST
The XMLAST
class is the basic class to represent
AST
for XML data. This class is used to represent XML nodes that contain PCDATA
and to provide a set of convenience methods to transform ASTs low level.
Even though it is an AST
node this class does not expect to have
any children, as it is text only. XMLStartAST
is the class to
contain children.
Field Summary |
Fields inherited from class antlr.BaseAST |
down, right |
Constructor Summary | |
XMLAST()
Create a new new empty XMLAST . |
|
XMLAST(int type,
String text)
Creates a new XMLAST . |
|
XMLAST(Token t)
Creates a new XMLAST . |
|
XMLAST(XMLAST b)
Copy ctor. |
Method Summary | |
XMLAST |
addSibling(XMLAST sibling)
Adds a new sibling to this element. |
XMLAST |
getLastChild()
Adds a new sibling to this element. |
XMLAST |
getLastSibling()
Gets the last sibling of this element, if there is one, otherwise null. |
XMLAST |
getPreviousSiblingFlat(XMLAST inTree)
Gets the sibling left to me or null if there is none. |
XMLAST |
noRoot()
Chops off root of tree, leaving only first child. |
XMLAST |
reverseFlat()
Destructive method that reverses a flat tree. |
String |
toString()
Gets a simple string representation of this token. |
void |
updateTokenTypes(XMLTokenTypeManager tokenManager)
Resets the type of XMLTokenTypeManager.PCDATA
for this XMLAST . |
void |
write(XMLWriter writer)
Writes itself to XML writer. |
Methods inherited from class antlr.CommonAST |
getText, getType, initialize, initialize, initialize, setText, setType |
Methods inherited from class antlr.BaseAST |
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XMLAST()
XMLAST
.
public XMLAST(int type, String text)
XMLAST
.
type
- the type of the AST, usually the type of
XMLTokenTypeManager.PCDATA
.text
- the text of the ASTpublic XMLAST(Token t)
XMLAST
.
t
- the token to get type and text frompublic XMLAST(XMLAST b)
Method Detail |
public String toString()
toString
in interface AST
toString
in class BaseAST
write(de.zeigermann.xml.XMLWriter)
public void write(XMLWriter writer) throws IOException
IOException
public void updateTokenTypes(XMLTokenTypeManager tokenManager)
XMLTokenTypeManager.PCDATA
for this XMLAST
. This is needed when we want to
change the token types of an existing XMLAST
.
public XMLAST noRoot()
public XMLAST addSibling(XMLAST sibling)
public XMLAST getLastChild()
public XMLAST getLastSibling()
public XMLAST reverseFlat()
this right this right
1 -> 2 4 -> 3
2 -> 3 ---> 3 -> 2
3 -> 4 ---> 2 -> 1
4 -> NULL 1 -> NULL
This means:
- swap left with right
- make last first
public XMLAST getPreviousSiblingFlat(XMLAST inTree)
BaseAST.getNextSibling()
which gets the sibling
right to me.
inTree
- the root AST of this AST
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |