public IEnumerable <Coord> Filter(IEnumerable <Coord> coords, DynamicValueContext context)
 {
     Coord[] allCoords = coords.ToArray();
     Coord[] first     = m_firstFilter.Filter(allCoords, context).ToArray();
     for (int i = 0; i < first.Length; i++)
     {
         yield return(first[i]);
     }
     foreach (Coord item in m_secondFilter.Filter(allCoords, context))
     {
         if (!first.Contains(item))
         {
             yield return(item);
         }
     }
 }
示例#2
0
        public IEnumerable <Coord> Filter(IEnumerable <Coord> coords, DynamicValueContext context)
        {
            List <Coord> coordList = ListPool <Coord> .Get();

            List <Coord> filtered = ListPool <Coord> .Get();

            coordList.AddRange(coords);
            filtered.AddRange(m_filter.Filter(coordList, context));
            int coordCount    = coordList.Count;
            int filteredCount = filtered.Count;
            int num2;

            for (int i = 0; i < coordCount; i = num2)
            {
                Coord coord = coordList[i];
                int   num   = 0;
                while (true)
                {
                    if (num < filteredCount)
                    {
                        if (coord == filtered[num])
                        {
                            break;
                        }
                        num++;
                        continue;
                    }
                    yield return(coord);

                    break;
                }
                num2 = i + 1;
            }
            ListPool <Coord> .Release(coordList);

            ListPool <Coord> .Release(filtered);
        }