public virtual Node buildTree()
 {
     n11 = new Node(); // Node-0
     n12 = new Node(); // Node-1
     n1  = new Node(new Node[]{n11,n12}); // Node-2
     n2  = new Node(); // Node-3
     n0  = new Node(new Node[]{n1,n2}); // Node-4
     return n0;
 }
 public abstract Node visitNode(Node x);
Example #3
0
 /**
  * Create a new node with given kids. Each created node will have
  * a different nodeID.
  */
 public static Node factory(Node[] kids)
 {
     Node result = new Node(kids, nodeCounter);
     nodeCounter++;
     return result;
 }
Example #4
0
 public Node(Node[] kids)
 {
     this.kids = kids;
     this.nodeID = nodeCounter++;
 }
Example #5
0
 public Node(Node[] kids, int nodeID)
 {
     this.kids = kids;
     this.nodeID = nodeID;
 }
 internal virtual void buildDiamond()
 {
     Node sink = new Node();
     rootOfDiamond = new Node(new Node[]{sink,sink});
 }
 internal virtual void buildCircle()
 {
     Node node = new Node(new Node[]{null});
     rootOfCircle = new Node(new Node[]{node});
     node.setChildAt(0,rootOfCircle);
 }
 protected override void SetUp()
 {
     Node.reset();
     Node[] empty = {};
     logger = new Logger();
     n0 = Node.factory(empty);
     n1 = Node.factory(empty);
     n2 = Node.factory(empty);
     n3 = Node.factory(new Node[]{n0,n1});
     n4 = Node.factory(new Node[]{n3,n2});
 }