//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {Contact : darkwynter.com for licensing information //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace DarkWynter.Engine.Compiler { #region Using Statements using System; using System.Collections.Generic; using System.Text; using System.IO; #endregion public class Node { private char dataTwo; private int dataNode; private Node leftNode; private Node rightNode; public Node() { dataNode = 0; leftNode = null; rightNode = null; dataTwo = ' '; } public Node (int dNode, Node lNode, Node rNode, char d2Node) { dataNode = dNode; leftNode = lNode; rightNode = rNode; dataTwo = d2Node; } public int getData() { return dataNode; } public Node returnRight() { return rightNode; } public Node returnLeft() { return leftNode; } public char returnSecret() { return dataTwo; } public static int getSize(Node node) { if (node == null) return 0; else if (node.leftNode == null && node.rightNode == null) return 1; else return 1 + getSize(node.rightNode) + getSize(node.leftNode); } public static int getHeight(Node node) { if (node == null) return 0; else if (node.leftNode == null && node.rightNode == null) return 1; else return 1 + Math.Max(getHeight(node.rightNode), getHeight(node.leftNode)); } } }