Beispiel #1
0
    public bool Evaluate(IVariableDictionary variables)
    {
        if (Max.Evaluate(variables) is not IComparable maxValue)
        {
            return(true);
        }

        var minValue = Min.Evaluate(variables) as IComparable;

        if (Operand.Evaluate(variables) is not IComparable actual)
        {
            return(minValue is not null);
        }

        if (minValue is not null)
        {
            if (actual.GetType() != minValue.GetType())
            {
                return(false);
            }

            if (actual.CompareTo(minValue) < 0)
            {
                return(true);
            }
        }

        return(actual.GetType() == maxValue.GetType() && actual.CompareTo(maxValue) > 0);
    }