public Expressie(String p) { op = Operator.ONE; terminals = p; left = null; right = null; }
public Expressie() { op = Operator.ONE; terminals = ""; left = null; right = null; }
public Expressie star() { Expressie result = new Expressie(); result.op = Operator.STAR; result.left = this; return(result); }
public Expressie plus() { Expressie result = new Expressie(); result.op = Operator.PLUS; result.left = this; return(result); }
public Expressie dot(Expressie e2) { Expressie result = new Expressie(); result.op = Operator.DOT; result.left = this; result.right = e2; return(result); }
public bool Equals(Expressie other) { if (other == null) { return(false); } else if (this.ToString() == other.ToString() && this.terminals == other.terminals && this.op == other.op && this.left == other.left && this.right == other.right) { return(true); } else { return(false); } }
public override string ToString() { string expressie = ""; Expressie mostleft = left; if (mostleft != null) { while (mostleft != null) { mostleft = left.left; } while (mostleft.right != null) { expressie += mostleft.terminals; mostleft = mostleft.right; } } else { expressie = terminals; } return(expressie); }