public override RandomAccessFilter BuildRandomAccessOrFilter(string[] vals, Properties prop, bool isNot)
        {
            RandomAccessFilter filter = null;

            int[] indexes = FacetDataCache.Convert(_dataCache, vals);
            if (indexes.Length > 1)
            {
                return new FacetOrFilter(_dataCache, indexes, isNot);
            }
            else if (indexes.Length == 1)
            {
                filter = new FacetFilter(_dataCache, indexes[0]);
            }
            else
            {
                filter = EmptyFilter.GetInstance();
            }
            if (isNot)
            {
                filter = new RandomAccessNotFilter(filter);
            }
            return filter;
        }
Ejemplo n.º 2
0
        public virtual RandomAccessFilter BuildRandomAccessOrFilter(string[] vals, Properties prop, bool isNot)
        {
            List<RandomAccessFilter> filterList = new List<RandomAccessFilter>(vals.Length);

            foreach (string val in vals)
            {
                RandomAccessFilter f = BuildRandomAccessFilter(val, prop);
                if (f != null && !(f is EmptyFilter))
                {
                    filterList.Add(f);
                }
            }

            RandomAccessFilter finalFilter;
            if (filterList.Count == 0)
            {
                finalFilter = EmptyFilter.GetInstance();
            }
            else
            {
                finalFilter = new RandomAccessOrFilter(filterList);
            }

            if (isNot)
            {
                finalFilter = new RandomAccessNotFilter(finalFilter);
            }
            return finalFilter;
        }
 public override RandomAccessFilter BuildRandomAccessOrFilter(string[] vals, Properties prop, bool isNot)
 {
     if (vals.Length > 1)
     {
         return new FacetOrFilter(dataCache, ConvertIndexes(dataCache, vals), isNot);
     }
     else
     {
         RandomAccessFilter filter = BuildRandomAccessFilter(vals[0], prop);
         if (filter == null)
             return filter;
         if (isNot)
         {
             filter = new RandomAccessNotFilter(filter);
         }
         return filter;
     }
 }
 public override RandomAccessFilter BuildRandomAccessOrFilter(string[] vals, Properties prop, bool isNot)
 {
     if (vals.Length > 1)
     {
         int depth = GetDepth(prop);
         bool strict = IsStrict(prop);
         List<int> intSet = new List<int>();
         GetFilters(intSet, vals, depth, strict);
         if (intSet.Count > 0)
         {
             return new FacetOrFilter(dataCache, intSet.ToArray(), isNot);
         }
         else
         {
             if (isNot)
             {
                 return null;
             }
             else
             {
                 return EmptyFilter.GetInstance();
             }
         }
     }
     else
     {
         RandomAccessFilter f = BuildRandomAccessFilter(vals[0], prop);
         if (f == null)
             return f;
         if (isNot)
         {
             f = new RandomAccessNotFilter(f);
         }
         return f;
     }
 }