public class TreeLocal
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Long,ShadowNode> |
shadowLeft
Mapping of shadow nodes by left-side identifier.
|
private java.util.List<ShadowNode> |
shadowList
All shadow nodes, in the order read from the original input stream.
|
private java.util.Map<java.lang.Long,ShadowNode> |
shadowRight
Mapping of shadow nodes by right-side identifier.
|
private java.util.Map<java.lang.Long,ShadowNode> |
shadows
Mapping of shadow nodes by node ID.
|
private java.util.Map<antlr.CommonHiddenStreamToken,ShadowNode> |
shadowTokens
Mapping of shadow nodes by the source token.
|
Constructor and Description |
---|
TreeLocal() |
Modifier and Type | Method and Description |
---|---|
void |
addShadowNode(int idx,
ShadowNode sn)
Add a shadow node to the list at the given index position and map the
left and right lookups as needed.
|
void |
addShadowNode(ShadowNode sn)
Add a shadow node to the list and map the left and right lookups as
needed.
|
ShadowNode |
getLeftShadowNode(java.lang.Long id)
Access a shadow node that exists to the left of the identified node.
|
ShadowNode |
getRightShadowNode(java.lang.Long id)
Access a shadow node that exists to the right of the identified node.
|
ShadowNode |
getShadowNode(antlr.CommonHiddenStreamToken token)
Access the shadow node which was created from the given token.
|
ShadowNode |
getShadowNode(int idx)
Access the shadow node at the given index position.
|
ShadowNode |
getShadowNode(java.lang.Long id)
Access the shadow node which contains the AST with the given ID.
|
java.util.Iterator<ShadowNode> |
getShadowNodeList()
Access the list of all shadow nodes.
|
private ShadowNode |
getShadowNodeWorker(java.lang.Long id,
boolean right)
Access the shadow node on the left or right of the current node.
|
private void |
insertMappings(ShadowNode sn)
Map the left and right lookups for the given node.
|
int |
shadowListSize()
Get the size of the shadow list.
|
private java.util.Map<java.lang.Long,ShadowNode> shadowLeft
private java.util.Map<java.lang.Long,ShadowNode> shadowRight
private java.util.Map<java.lang.Long,ShadowNode> shadows
private java.util.Map<antlr.CommonHiddenStreamToken,ShadowNode> shadowTokens
private java.util.List<ShadowNode> shadowList
public int shadowListSize()
public void addShadowNode(ShadowNode sn)
sn
- The shadow node to add.public void addShadowNode(int idx, ShadowNode sn)
idx
- Index position at which to add the node.sn
- The shadow node to add.public ShadowNode getShadowNode(int idx)
idx
- 0-based index.null
if no such
element exists.public ShadowNode getShadowNode(java.lang.Long id)
id
- AST ID contained in the shadow node.null
if no shadow node exists
which contains that AST.public ShadowNode getShadowNode(antlr.CommonHiddenStreamToken token)
token
- Source token.null
if no such element exists.public java.util.Iterator<ShadowNode> getShadowNodeList()
public ShadowNode getLeftShadowNode(java.lang.Long id)
id
- The ID of the node to the RIGHT of the shadow node.null
if no such node exists.public ShadowNode getRightShadowNode(java.lang.Long id)
id
- The ID of the node to the LEFT of the shadow node.null
if no such node exists.private void insertMappings(ShadowNode sn)
sn
- The shadow node to map.private ShadowNode getShadowNodeWorker(java.lang.Long id, boolean right)
id
- The ID of the node to the LEFT of the shadow node.right
- true
to obtain the right side node,
false
to obtain the left side node.null
if no such node exists.