public IBooleanExp Replace(string name, IBooleanExp booleanExp) { return (new AndExp( this.operand1.Replace(name, booleanExp), this.operand2.Replace(name, booleanExp) )); }
public IBooleanExp Replace(string name, IBooleanExp booleanExp) { if (this.name == name) { return(booleanExp.Copy()); } else { return(new VariableExp(this.name)); } }
public IBooleanExp Replace(string statement, IBooleanExp exp) { if (this.mName.Equals(statement)) { return(exp.Copy()); } else { return(new VariableExp(this.mName)); } }
static void Main(string[] args) { IBooleanExp expression; Context context = new Context(); VariableExp x = new VariableExp("X"); VariableExp y = new VariableExp("Y"); expression = new OrExp(new AndExp(new Constant(true), x), new AndExp(y, new NotExp(x))); context.Assign(x, false); context.Assign(y, true); Boolean result = expression.Evaluate(context); VariableExp z = new VariableExp("Z"); NotExp notZ = new NotExp(z); IBooleanExp replacement = expression.Replace("y", notZ); context.Assign(z, true); result = replacement.Evaluate(context); }
public IBooleanExp Replace(string statement, IBooleanExp exp) { return(new AndExp(this.exp1.Replace(statement, exp), this.exp2.Replace(statement, exp))); }
public AndExp(IBooleanExp exp1, IBooleanExp exp2) { this.exp1 = exp1; this.exp2 = exp2; }
public IBooleanExp Replace(string statement, IBooleanExp exp) { return(new Constant(this.booleanValue)); }
public NotExp(IBooleanExp operand) { this.operand = operand; }
public IBooleanExp Replace(string name, IBooleanExp booleanExp) { return (new NotExp(this.operand.Replace(name, booleanExp))); }
public AndExp(IBooleanExp operand1, IBooleanExp operand2) { this.operand1 = operand1; this.operand2 = operand2; }
public IBooleanExp Replace(string statement, IBooleanExp exp) { return(new NotExp(this.exp.Replace(statement, exp))); }
public NotExp(IBooleanExp exp) { this.exp = exp; }
public IBooleanExp Replace(string name, IBooleanExp booleanExp) { return(new Constant(this.value)); }