예제 #1
0
        public override JsonElement Execute(JsonElement input)
        {
            JsonElement left  = LeftSide.Execute(input);
            JsonElement right = RightSide.Execute(input);

            bool result = false;

            if ((IsEqual || IsGreaterOrEqual || IsLessOrEqual) && JsonElementEqualityComparer.Default.Equals(left, right))
            {
                result = true;
            }
            else if (IsNotEqual && !JsonElementEqualityComparer.Default.Equals(left, right))
            {
                result = true;
            }
            else if (left.ValueKind == right.ValueKind)
            {
                int r = JsonElementComparer.Default.Compare(left, right);

                if ((IsGreater || IsGreaterOrEqual) && r > 0)
                {
                    result = true;
                }
                else if ((IsLess || IsLessOrEqual) && r < 0)
                {
                    result = true;
                }
            }

            return(JsonElementFactory.CreateBool(result));
        }
예제 #2
0
        public override JsonElement Execute(JsonElement input)
        {
            bool left = LeftSide.Execute(input).IsTruthy();

            if (left && IsOr)
            {
                return(JsonElementFactory.CreateBool(true));
            }

            bool right = RightSide.Execute(input).IsTruthy();

            bool result;

            if (IsAnd)
            {
                result = left && right;
            }
            else
            {
                result = left || right;
            }

            return(JsonElementFactory.CreateBool(result));
        }