package tl3;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import jburg.BurgInput;

class Node implements BurgInput<NodeType>
{
    final NodeType      nodeType;
    final List<Node>    children;
    final Object        content;

    int stateNumber = -1;

    Node(NodeType nodeType)
    {
        this.nodeType = nodeType;
        this.children = new ArrayList<Node>();
        this.content  = null;
    }

    Node(NodeType nodeType, int childCount)
    {
        this(nodeType);

        for (int i = 0; i < childCount; i++) {
            this.children.add(null);
        }
    }

    Node(NodeType nodeType, Object content)
    {
        this.nodeType = nodeType;
        this.children = Collections.emptyList();
        this.content  = content;
    }

    public NodeType getNodeType()
    {
        return nodeType;
    }

    public int getSubtreeCount() 
    {
        return children.size();
    }

    public Node getSubtree(int idx)
    {
        return children.get(idx);
    }

    public void setStateNumber(int stateNumber)
    {
        this.stateNumber = stateNumber;
    }

    public int getStateNumber()
    {
        return this.stateNumber;
    }

    public Object getContent()
    {
        return this.content;
    }

    @Override
    public String toString()
    {
        if (content != null) {
            return String.format("%s(%d)%s", nodeType, stateNumber, content);
        } else {
            return String.format("%s(%d)%s", nodeType, stateNumber, children);
        }
    }

    void setChild(int idx, Node child)
    {
        children.set(idx, child);
    }
}

@@ -112,16 +112,36 @@
 rgInput;
+%0Aimport jburg.State;
 %0A%0Aclass 
@@ -166,16 +166,29 @@
 rgInput%3C
+Nonterminal, 
 NodeType
@@ -318,16 +318,60 @@
 er = -1;
+%0A    State%3CNonterminal,NodeType%3E transition;
 %0A%0A    No
@@ -1270,32 +1270,261 @@
 eNumber;%0A    %7D%0A%0A
+    public void setTransitionTableLeaf(State%3CNonterminal,NodeType%3E state)%0A    %7B%0A        this.transition = state;%0A    %7D%0A%0A    public State%3CNonterminal,NodeType%3E getTransitionTableLeaf()%0A    %7B%0A        return this.transition;%0A    %7D%0A%0A
     public Objec

Update TL/3 AST to new jburg/AST API