public override bool Interpret(Context context) { if (_value.HasValue) { return (bool) _value; } throw new InvalidOperationException(); }
public override bool Interpret(Context context) { bool xVar; bool yVar; switch (_scenario) { case Scenario.VarVar: xVar = context.GetValue(_xVarName); yVar = context.GetValue(_yVarName); break; case Scenario.VarExp: xVar = context.GetValue(_xVarName); yVar = _yExp.Interpret(context); break; case Scenario.ExpVar: xVar = _xExp.Interpret(context); yVar = context.GetValue(_yVarName); break; case Scenario.ExpExp: xVar = _xExp.Interpret(context); yVar = _yExp.Interpret(context); break; default: throw new InvalidOperationException(); } switch (_op) { case BinaryOp.And: return xVar && yVar; case BinaryOp.Or: return xVar || yVar; default: throw new InvalidOperationException(); } }
public override bool Interpret(Context context) { throw new NullReferenceException(); }