Exemplo n.º 1
0
 public ComposedSet <T, TDB> TrimEnd(ComposedSet <T, TDB> cset)
 {
     if (EndsWith(cset))
     {
         var trimmed = new ComposedSet <T, TDB>(this);
         trimmed.indices.RemoveRange(trimmed.indices.Count - cset.indices.Count, cset.indices.Count);
         return(trimmed);
     }
     return(this);
 }
Exemplo n.º 2
0
 public static bool IsNullOrEmpty(ComposedSet <T, TDB> cset)
 {
     if (cset == null)
     {
         return(true);
     }
     if (cset.indices.Count == 0)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        public bool StartsWith(ComposedSet <T, TDB> a)
        {
            int length  = indices.Count;
            int alength = a.indices.Count;

            if (alength > length)
            {
                return(false);
            }
            for (int i = 0; i < alength; ++i)
            {
                if (a.indices[i] != indices[i])
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
        public bool EndsWith(ComposedSet <T, TDB> a)
        {
            int length  = indices.Count;
            int alength = a.indices.Count;

            if (alength > length)
            {
                return(false);
            }
            if (alength == 0)
            {
                return(false);
            }
            for (int i = 0; i < alength; ++i)
            {
                if (a.indices[alength - i - 1] != indices[length - i - 1])
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 5
0
 public ComposedSet(ComposedSet <T, TDB> cset)
 {
     indices = new List <int>(cset.indices);
 }