Exemplo n.º 1
0
 public static List<PngChunk> FilterList( List<PngChunk> list, ChunkPredicate predicateKeep )
 {
     List<PngChunk> result = new List<PngChunk> ();
     foreach ( PngChunk element in list )
     {
         if ( predicateKeep.Matches ( element ) )
         {
             result.Add ( element );
         }
     }
     return result;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Filters a list of Chunks, keeping those which match the predicate
        /// </summary>
        /// <remarks>The original list is not altered</remarks>
        /// <param name="list"></param>
        /// <param name="predicateKeep"></param>
        /// <returns></returns>
        public static List <PngChunk> FilterList(List <PngChunk> list, ChunkPredicate predicateKeep)
        {
            List <PngChunk> result = new List <PngChunk>();

            foreach (PngChunk element in list)
            {
                if (predicateKeep.Matches(element))
                {
                    result.Add(element);
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public static List <PngChunk> FilterList(List <PngChunk> list, ChunkPredicate predicateKeep)
        {
            List <PngChunk> list2 = new List <PngChunk>();

            foreach (PngChunk item in list)
            {
                if (predicateKeep.Matches(item))
                {
                    list2.Add(item);
                }
            }
            return(list2);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Filters a list of Chunks, removing those which match the predicate
        /// </summary>
        /// <remarks>The original list is not altered</remarks>
        /// <param name="list"></param>
        /// <param name="predicateRemove"></param>
        /// <returns></returns>
        public static int TrimList(List <PngChunk> list, ChunkPredicate predicateRemove)
        {
            int cont = 0;

            for (int i = list.Count - 1; i >= 0; i--)
            {
                if (predicateRemove.Matches(list[i]))
                {
                    list.RemoveAt(i);
                    cont++;
                }
            }
            return(cont);
        }
Exemplo n.º 5
0
        public static int TrimList(List <PngChunk> list, ChunkPredicate predicateRemove)
        {
            int num = 0;

            for (int num2 = list.Count - 1; num2 >= 0; num2--)
            {
                if (predicateRemove.Matches(list[num2]))
                {
                    list.RemoveAt(num2);
                    num++;
                }
            }
            return(num);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Filters a list of Chunks, removing those which match the predicate
 /// </summary>
 /// <remarks>The original list is not altered</remarks>
 /// <param name="list"></param>
 /// <param name="predicateRemove"></param>
 /// <returns></returns>
 public static int TrimList(List<PngChunk> list, ChunkPredicate predicateRemove)
 {
     int cont = 0;
     for (int i = list.Count - 1; i >= 0; i--) {
         if (predicateRemove.Matches(list[i])) {
             list.RemoveAt(i);
             cont++;
         }
     }
     return cont;
 }