public IBooleanExp Replace(string name, IBooleanExp booleanExp)
 {
     return
         (new AndExp(
              this.operand1.Replace(name, booleanExp),
              this.operand2.Replace(name, booleanExp)
              ));
 }
Пример #2
0
 public IBooleanExp Replace(string name, IBooleanExp booleanExp)
 {
     if (this.name == name)
     {
         return(booleanExp.Copy());
     }
     else
     {
         return(new VariableExp(this.name));
     }
 }
Пример #3
0
 public IBooleanExp Replace(string statement, IBooleanExp exp)
 {
     if (this.mName.Equals(statement))
     {
         return(exp.Copy());
     }
     else
     {
         return(new VariableExp(this.mName));
     }
 }
Пример #4
0
        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);
        }
Пример #5
0
 public IBooleanExp Replace(string statement, IBooleanExp exp)
 {
     return(new AndExp(this.exp1.Replace(statement, exp), this.exp2.Replace(statement, exp)));
 }
Пример #6
0
 public AndExp(IBooleanExp exp1, IBooleanExp exp2)
 {
     this.exp1 = exp1;
     this.exp2 = exp2;
 }
Пример #7
0
 public IBooleanExp Replace(string statement, IBooleanExp exp)
 {
     return(new Constant(this.booleanValue));
 }
Пример #8
0
 public NotExp(IBooleanExp operand)
 {
     this.operand = operand;
 }
Пример #9
0
 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;
 }
Пример #11
0
 public IBooleanExp Replace(string statement, IBooleanExp exp)
 {
     return(new NotExp(this.exp.Replace(statement, exp)));
 }
Пример #12
0
 public NotExp(IBooleanExp exp)
 {
     this.exp = exp;
 }
Пример #13
0
 public IBooleanExp Replace(string name, IBooleanExp booleanExp)
 {
     return(new Constant(this.value));
 }