public override bool GetValue(EvalContext ctx) { //common code not refactored to parent class for speed (less virt calls) var lv = LeftOperand.GetValue(ctx); if (ctx.Aborted) { return(false); } var rv = RightOperand.GetValue(ctx); if (ctx.Aborted) { return(false); } return(lv ^ rv); }
public bool Evaluate(IOutput output, IPropertyProvider propertyProvider, IPropertyStore propertyStore, ProcessorItem item) { PropertyItem leftValue = LeftOperand.GetValue(output, propertyProvider, propertyStore, item); if (leftValue == null) { return(Operator.HasFlag(Operator.Ignore)); } PropertyItem rightValue = RightOperand.GetValue(output, propertyProvider, propertyStore, item); if (rightValue == null) { return(Operator.HasFlag(Operator.Ignore)); } if (leftValue.IsNumeric && rightValue.IsNumeric) // If we are comparing two numbers. { double vl = leftValue.ValueNumber; double vr = rightValue.ValueNumber; return(EvaluateNumeric(vl, vr, output)); } else if (!leftValue.IsNumeric && !rightValue.IsNumeric) // If we are comparing two strings. { string vl = leftValue.ValueText; string vr = rightValue.ValueText; return(EvaluateText(vl, vr, output)); } else { output.WriteLine(Level.Warn, $"&-c;Condition type mismatch, unable to compare values, ignoring condition: {leftValue.Value} {Operator} {rightValue.Value}&-^;"); output.WriteLine(Level.Debug, $"&-c; - LV_NUMERIC: {leftValue.IsNumeric}, RV_NUMERIC: {rightValue.IsNumeric}&-^;"); return(true); } }