/// <summary> /// Determines whether [is compute operator] [the specified input]. /// </summary> /// <param name="input">The input.</param> /// <param name="computeOperator">The compute operator.</param> /// <returns><c>true</c> if [is compute operator] [the specified input]; otherwise, <c>false</c>.</returns> private bool IsComputeOperator(string input, out ComputeOperator computeOperator) { var result = BooleanSearchCore.ToComputeOperator(input); if (result.HasValue) { computeOperator = result.Value; return(true); } computeOperator = default(ComputeOperator); return(false); }
/// <summary> /// Expects the compute operator. /// </summary> /// <param name="input">The input.</param> /// <param name="position">The position.</param> /// <returns>System.Nullable<ComputeOperator>.</returns> /// <exception cref="Beyova.Diagnostic.InvalidExpressiontException"></exception> private ComputeOperator?ExpectComputeOperator(string input, ref int position) { string operatorString = null; TrimStartSpaces(input, ref position); var startPosition = position; bool isSymbol = position < input.Length && computeOperatorSymbolChars.HasItem(input[position]); while (position < input.Length) { if (isSymbol) { if (computeOperatorSymbolChars.HasItem(input[position])) { position++; } else { break; } } else { if (!relationshipOperatorInterruptChars.HasItem(input[position])) { position++; } else { break; } } } operatorString = input.Substring(startPosition, position - startPosition); return(BooleanSearchCore.ToComputeOperator(operatorString)); }
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns>A <see cref="System.String" /> that represents this instance.</returns> public override string ToString() { return((!string.IsNullOrWhiteSpace(ItemLeft) && !string.IsNullOrWhiteSpace(ItemRight)) ? string.Format(BooleanSearchCore.expressionFormat, BooleanSearchCore.StringFieldToExpressionString(ItemLeft), Operator.ToString(), BooleanSearchCore.StringFieldToExpressionString(ItemRight)) : string.Empty); }
/// <summary> /// Computes the specified json. /// </summary> /// <param name="json">The json.</param> /// <returns><c>true</c> if compute as true, <c>false</c> otherwise.</returns> public bool Compute(JObject json) { return(BooleanSearchCore.BooleanCompute(this, json)); }
/// <summary> /// Validates this instance. /// </summary> /// <returns><c>true</c> if validation passed, <c>false</c> otherwise.</returns> public bool Validate() { return(BooleanSearchCore.IsKeyValid(this)); }