Esempio n. 1
0
        public static IFilter Join(IFilter first, IFilter second)
        {
            if (first == null && second == null)
            {
                return(null);
            }
            else if (first == null)
            {
                return(second);
            }
            else if (second == null)
            {
                return(first);
            }
            else if (first.Empty)
            {
                return(second);
            }
            else if (second.Empty)
            {
                return(first);
            }
            else
            {
                if (first is FilterExpression && second is FilterExpression && ((FilterExpression)first).Result == ((FilterExpression)second).Result)
                {
                    return(FilterExpression.Combine((FilterExpression)first, (FilterExpression)second));
                }

                return(new JoinedFilterExpression(first, second));
            }
        }
Esempio n. 2
0
 public static IFilter Join(IFilter first, IFilter second)
 {
     if (first == null && second == null)
         return null;
     else if (first == null)
         return second;
     else if (second == null)
         return first;
     else if (first.Empty)
         return second;
     else if (second.Empty)
         return first;
     else
     {
         if (first is FilterExpression && second is FilterExpression && ((FilterExpression)first).Result == ((FilterExpression)second).Result)
             return FilterExpression.Combine((FilterExpression)first, (FilterExpression)second);
         
         return new JoinedFilterExpression(first, second);
     }
 }