예제 #1
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
        /// </returns>
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            if (!(obj is FilterSpecParamIn))
            {
                return(false);
            }

            FilterSpecParamIn other = (FilterSpecParamIn)obj;

            if (!base.Equals(other))
            {
                return(false);
            }

            if (_listOfValues.Count != other._listOfValues.Count)
            {
                return(false);
            }

            if (!Collections.AreEqual(_listOfValues, other._listOfValues))
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        public void TestEquals()
        {
            values = new FilterSpecParamIn(MakeLookupable("a"), FilterOperator.IN_LIST_OF_VALUES, GetList(new Object[] { "A", "B" }));
            FilterSpecParamIn values2 = new FilterSpecParamIn(MakeLookupable("a"), FilterOperator.IN_LIST_OF_VALUES, GetList(new Object[] { "A" }));
            FilterSpecParamIn values3 = new FilterSpecParamIn(MakeLookupable("a"), FilterOperator.IN_LIST_OF_VALUES, GetList(new Object[] { "A", "B" }));
            FilterSpecParamIn values4 = new FilterSpecParamIn(MakeLookupable("a"), FilterOperator.IN_LIST_OF_VALUES, GetList(new Object[] { "A", "C" }));

            Assert.IsFalse(values.Equals(new FilterSpecParamConstant(MakeLookupable("a"), FilterOperator.EQUAL, "a")));
            Assert.IsFalse(values.Equals(values2));
            Assert.IsTrue(values.Equals(values3));
            Assert.IsFalse(values.Equals(values4));
        }
예제 #3
0
        // consolidate "val != 3 and val != 4 and val != 5"
        // to "val not in (3, 4, 5)"
        private static void HandleConsolidateNotEqual(IList <FilterSpecParam> parameters, FilterParamExprMap filterParamExprMap, string statementName)
        {
            IList <FilterSpecParamInValue> values = new List <FilterSpecParamInValue>();

            ExprNode lastNotEqualsExprNode = null;

            foreach (var param in parameters)
            {
                if (param is FilterSpecParamConstant)
                {
                    var constantParam = (FilterSpecParamConstant)param;
                    var constant      = constantParam.FilterConstant;
                    values.Add(new InSetOfValuesConstant(constant));
                }
                else if (param is FilterSpecParamEventProp)
                {
                    var eventProp = (FilterSpecParamEventProp)param;
                    values.Add(new InSetOfValuesEventProp(eventProp.ResultEventAsName, eventProp.ResultEventProperty,
                                                          eventProp.IsMustCoerce, TypeHelper.GetBoxedType(eventProp.CoercionType)));
                }
                else if (param is FilterSpecParamEventPropIndexed)
                {
                    var eventProp = (FilterSpecParamEventPropIndexed)param;
                    values.Add(new InSetOfValuesEventPropIndexed(eventProp.ResultEventAsName, eventProp.ResultEventIndex, eventProp.ResultEventProperty,
                                                                 eventProp.IsMustCoerce, TypeHelper.GetBoxedType(eventProp.CoercionType), statementName));
                }
                else
                {
                    throw new ArgumentException("Unknown filter parameter:" + param.ToString());
                }

                lastNotEqualsExprNode = filterParamExprMap.RemoveEntry(param);
            }

            var paramIn = new FilterSpecParamIn(parameters[0].Lookupable, FilterOperator.NOT_IN_LIST_OF_VALUES, values);

            filterParamExprMap.Put(lastNotEqualsExprNode, paramIn);
        }