Example #1
0
        public override bool Equals(FluidValue other)
        {
            if (other.IsNil())
            {
                return(_value.Count == 0);
            }

            if (other is DictionaryValue otherDictionary)
            {
                if (_value.Count != otherDictionary._value.Count)
                {
                    return(false);
                }

                foreach (var key in _value.Keys)
                {
                    if (!otherDictionary._value.TryGetValue(key, out var otherItem))
                    {
                        return(false);
                    }

                    _value.TryGetValue(key, out var item);

                    if (!item.Equals(otherItem))
                    {
                        return(false);
                    }
                }
            }

            return(false);
        }
Example #2
0
        public override bool Equals(FluidValue other)
        {
            if (other.IsNil())
            {
                return(_value.Count == 0);
            }

            if (other is ArrayValue arrayValue)
            {
                if (_value.Count != arrayValue._value.Count)
                {
                    return(false);
                }

                for (var i = 0; i < _value.Count; i++)
                {
                    var item      = _value[i];
                    var otherItem = arrayValue._value[i];

                    if (!item.Equals(otherItem))
                    {
                        return(false);
                    }
                }
            }

            return(false);
        }
Example #3
0
        public override bool Equals(FluidValue other)
        {
            if (other.IsNil())
            {
                return(_value.Length == 0);
            }

            if (other is ArrayValue arrayValue)
            {
                if (_value.Length != arrayValue._value.Length)
                {
                    return(false);
                }

                for (var i = 0; i < _value.Length; i++)
                {
                    var item      = _value[i];
                    var otherItem = arrayValue._value[i];

                    if (!item.Equals(otherItem))
                    {
                        return(false);
                    }
                }
            }
            else if (other.Type == FluidValues.Empty)
            {
                return(_value.Length == 0);
            }

            return(false);
        }
Example #4
0
        public static FluidValue Or(this FluidValue self, FluidValue other)
        {
            if (self.IsNil())
            {
                return(other);
            }

            return(self);
        }
Example #5
0
        public override bool Equals(FluidValue other)
        {
            if (other.IsNil())
            {
                return(_value.Length == 0);
            }

            return(_value == other.ToStringValue());
        }
Example #6
0
        public override bool Equals(FluidValue other)
        {
            if (other.IsNil())
            {
                return(false);
            }

            if (other.Type != FluidValues.DateTime)
            {
                return(false);
            }

            return(_value.Equals(((DateTimeValue)other)._value));
        }
        public override bool Equals(FluidValue other)
        {
            if (other.IsNil())
            {
                switch (_value)
                {
                case ICollection collection:
                    return(collection.Count == 0);

                case IEnumerable enumerable:
                    return(!enumerable.GetEnumerator().MoveNext());
                }

                return(false);
            }

            return(other is ObjectValue && ((ObjectValue)other)._value == _value);
        }