public Evaluation EvaluateOperator( ExpressionOptions options, ValueToken op, Token?left, Token?right) { var validationError = ValidateOperatorTokens(options, op, left, right); if (validationError != null) { return(validationError); } var leftEval = left != null?Evaluate(options, left) : null; if (leftEval?.Error != null) { return(leftEval); } var rightEval = right != null?Evaluate(options, right) : null; if (rightEval?.Error != null) { return(rightEval); } return(ExecuteOperator.Invoke(op.Value, leftEval?.Result, rightEval?.Result)); }
public static bool IsMatch(ExecuteCommand command, ExecuteOperator<Cell> executor, Tree<Cell> parameters) { var processor = new CellProcessorBase(); processor.AddOperator(new ParseMemberName()); ((CellOperator) executor).Processor = processor; return executor.CanExecute(new TypedValue(new ExecuteContext(command, null, new TypedValue("stuff"))), parameters); }
public static bool IsMatch(ExecuteCommand command, ExecuteOperator <Cell> executor, Tree <Cell> parameters) { var processor = new CellProcessorBase(); processor.AddOperator(new ParseMemberName()); ((CellOperator)executor).Processor = processor; return(executor.CanExecute(new TypedValue(new ExecuteContext(command, new TypedValue("stuff"))), parameters)); }
private void ExecuteOperation(ExecuteOperator <string> executeOperator, Tree <string> input, int branchCount) { TypedValue executeResult = TypedValue.Void; executeOperator.TryExecute(processor, TypedValue.Void, input, ref executeResult); result = (Tree <string>)executeResult.Value; Assert.IsFalse(result.IsLeaf); Assert.AreEqual(branchCount, result.Branches.Count); Assert.AreEqual("step", result.Branches[0].Value); }
private void ExecuteOperation(ExecuteOperator <string> executeOperator, Tree <string> input, int branchCount) { TypedValue executeResult = TypedValue.Void; if (executeOperator.CanExecute(TypedValue.Void, input)) { executeResult = executeOperator.Execute(TypedValue.Void, input); } result = executeResult.GetValue <Tree <string> >(); Assert.IsFalse(result.IsLeaf); Assert.AreEqual(branchCount, result.Branches.Count); Assert.AreEqual("step", result.Branches[0].Value); }
/// <summary> /// Gets the hash code for this object /// </summary> /// <returns></returns> public override int GetHashCode() { return(OperatorString.GetHashCode() ^ ExecuteOperator.GetHashCode() ^ Side.GetHashCode()); }
private void ExecuteOperation(ExecuteOperator<string> executeOperator, Tree<string> input, int branchCount) { TypedValue executeResult = TypedValue.Void; executeOperator.TryExecute(processor, TypedValue.Void, input, ref executeResult); result = (Tree<string>)executeResult.Value; Assert.IsFalse(result.IsLeaf); Assert.AreEqual(branchCount, result.Branches.Count); Assert.AreEqual("step", result.Branches[0].Value); }
private void ExecuteOperation(ExecuteOperator<string> executeOperator, Tree<string> input, int branchCount) { TypedValue executeResult = TypedValue.Void; if (executeOperator.CanExecute(TypedValue.Void, input)) { executeResult = executeOperator.Execute(TypedValue.Void, input); } result = executeResult.GetValue<Tree<string>>(); Assert.IsFalse(result.IsLeaf); Assert.AreEqual(branchCount, result.Branches.Count); Assert.AreEqual("step", result.Branches[0].Value); }