Packageorg.antlr.runtime.tree
Classpublic class BaseTree
ImplementsTree
SubclassesCommonTree

A generic tree implementation with no payload. You must subclass to actually have any user data. ANTLR v3 uses a list of children approach instead of the child-sibling approach in v2. A flat tree (a list) is an empty node whose children represent the list. An empty, but non-null node is called "nil".



Public Properties
 PropertyDefined by
  charPositionInLine : int
[read-only]
BaseTree
  childCount : int
[read-only]
BaseTree
  childIndex : int
BaseTree doesn't track child indexes.
BaseTree
  children : Array
[read-only] Get the children internal List; note that if you directly mess with the list, do so at your own risk.
BaseTree
  isNil : Boolean
[read-only]
BaseTree
  line : int
[read-only]
BaseTree
  parent : Tree
BaseTree doesn't track parent pointers.
BaseTree
  text : String
[read-only]
BaseTree
  tokenStartIndex : int
BaseTree
  tokenStopIndex : int
BaseTree
  type : int
[read-only]
BaseTree
Protected Properties
 PropertyDefined by
  _children : Array
BaseTree
Public Methods
 MethodDefined by
  
BaseTree(node:Tree = null)
Create a new node from an existing node does nothing for BaseTree as there are no fields other than the children list, which cannot be copied as the children are not considered part of this node.
BaseTree
  
addChild(t:Tree):void
Add t as child of this node.
BaseTree
  
addChildren(kids:Array):void
Add all elements of kids list as children of this node
BaseTree
  
deleteChild(i:int):Object
BaseTree
  
BaseTree
  
Set the parent and child index values for all child of t
BaseTree
  
BaseTree
  
getChild(i:int):Tree
BaseTree
  
BaseTree
  
replaceChildren(startChildIndex:int, stopChildIndex:int, t:Object):void
Delete children from start to stop and replace with t even if t is a list (nil-root tree).
BaseTree
  
BaseTree
  
BaseTree
  
setChild(i:int, t:Tree):void
BaseTree
  
toStringTree():String
Print out a whole tree not just a node
BaseTree
Property detail
charPositionInLineproperty
charPositionInLine:int  [read-only]Implementation
    public function get charPositionInLine():int
childCountproperty 
childCount:int  [read-only]Implementation
    public function get childCount():int
childIndexproperty 
childIndex:int  [read-write]

BaseTree doesn't track child indexes.

Implementation
    public function get childIndex():int
    public function set childIndex(value:int):void
_childrenproperty 
protected var _children:Array
childrenproperty 
children:Array  [read-only]

Get the children internal List; note that if you directly mess with the list, do so at your own risk.

Implementation
    public function get children():Array
isNilproperty 
isNil:Boolean  [read-only]Implementation
    public function get isNil():Boolean
lineproperty 
line:int  [read-only]Implementation
    public function get line():int
parentproperty 
parent:Tree  [read-write]

BaseTree doesn't track parent pointers.

Implementation
    public function get parent():Tree
    public function set parent(value:Tree):void
textproperty 
text:String  [read-only]Implementation
    public function get text():String
tokenStartIndexproperty 
tokenStartIndex:int  [read-write]Implementation
    public function get tokenStartIndex():int
    public function set tokenStartIndex(value:int):void
tokenStopIndexproperty 
tokenStopIndex:int  [read-write]Implementation
    public function get tokenStopIndex():int
    public function set tokenStopIndex(value:int):void
typeproperty 
type:int  [read-only]Implementation
    public function get type():int
Constructor detail
BaseTree()constructor
public function BaseTree(node:Tree = null)

Create a new node from an existing node does nothing for BaseTree as there are no fields other than the children list, which cannot be copied as the children are not considered part of this node.

Parameters
node:Tree (default = null)
Method detail
addChild()method
public function addChild(t:Tree):void

Add t as child of this node. Warning: if t has no children, but child does and child isNil then this routine moves children to t via t.children = child.children; i.e., without copying the array.

Parameters
t:Tree
addChildren()method 
public function addChildren(kids:Array):void

Add all elements of kids list as children of this node

Parameters
kids:Array
deleteChild()method 
public function deleteChild(i:int):ObjectParameters
i:int

Returns
Object
dupNode()method 
public function dupNode():Tree

Returns
Tree
freshenParentAndChildIndexes()method 
public function freshenParentAndChildIndexes():void

Set the parent and child index values for all child of t

freshenParentAndChildIndexesFrom()method 
public function freshenParentAndChildIndexesFrom(offset:int):voidParameters
offset:int
getChild()method 
public function getChild(i:int):TreeParameters
i:int

Returns
Tree
getFirstChildWithType()method 
public function getFirstChildWithType(type:int):TreeParameters
type:int

Returns
Tree
replaceChildren()method 
public function replaceChildren(startChildIndex:int, stopChildIndex:int, t:Object):void

Delete children from start to stop and replace with t even if t is a list (nil-root tree). num of children can increase or decrease. For huge child lists, inserting children can force walking rest of children to set their childindex; could be slow.

Parameters
startChildIndex:int
 
stopChildIndex:int
 
t:Object
sanityCheckParentAndChildIndexes()method 
public function sanityCheckParentAndChildIndexes():void
sanityCheckParentAndChildIndexesFrom()method 
public function sanityCheckParentAndChildIndexesFrom(parent:Tree, i:int):voidParameters
parent:Tree
 
i:int
setChild()method 
public function setChild(i:int, t:Tree):voidParameters
i:int
 
t:Tree
toStringTree()method 
public function toStringTree():String

Print out a whole tree not just a node

Returns
String