private void reduceTernary(IOperandTerm left, IOperandTerm right, OperatorCode op) { OperatorCode newOp = (OperatorCode)stack.Pop(); IOperandTerm newLeft = (IOperandTerm)stack.Pop(); IOperandTerm newTerm = OperatorMethodManager.ReduceTernaryTerm(newOp, newLeft, left, right); stack.Push(newTerm); }
private void reduceUnary() { //if (stack.Count < 2) // throw new ExeEE("不正な時期の呼び出し"); IOperandTerm operand = (IOperandTerm)stack.Pop(); OperatorCode op = (OperatorCode)stack.Pop(); IOperandTerm newTerm = OperatorMethodManager.ReduceUnaryTerm(op, operand); stack.Push(newTerm); }
public bool GetBool(Int64 Is, ExpressionMediator exm) { if (CaseType == CaseExpressionType.To) { return(LeftTerm.GetIntValue(exm) <= Is && Is <= RightTerm.GetIntValue(exm)); } if (CaseType == CaseExpressionType.Is) { IOperandTerm term = OperatorMethodManager.ReduceBinaryTerm(Operator, new SingleTerm(Is), LeftTerm); return(term.GetIntValue(exm) != 0); } return(LeftTerm.GetIntValue(exm) == Is); }
public bool GetBool(string Is, ExpressionMediator exm) { if (CaseType == CaseExpressionType.To) { return(string.Compare(LeftTerm.GetStrValue(exm), Is, Config.SCExpression) <= 0 && string.Compare(Is, RightTerm.GetStrValue(exm), Config.SCExpression) <= 0); } if (CaseType == CaseExpressionType.Is) { IOperandTerm term = OperatorMethodManager.ReduceBinaryTerm(Operator, new SingleTerm(Is), LeftTerm); return(term.GetIntValue(exm) != 0); } return(LeftTerm.GetStrValue(exm) == Is); }
private void reduceLastThree() { //if (stack.Count < 2) // throw new ExeEE("不正な時期の呼び出し"); IOperandTerm right = (IOperandTerm)stack.Pop();//後から入れたほうが右側 OperatorCode op = (OperatorCode)stack.Pop(); IOperandTerm left = (IOperandTerm)stack.Pop(); if (OperatorManager.IsTernary(op)) { if (stack.Count > 1) { reduceTernary(left, right, op); return; } throw new CodeEE("式の数が不足しています"); } IOperandTerm newTerm = OperatorMethodManager.ReduceBinaryTerm(op, left, right); stack.Push(newTerm); }