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); }
public static bool IsNullOrEmpty(ComposedSet <T, TDB> cset) { if (cset == null) { return(true); } if (cset.indices.Count == 0) { return(true); } return(false); }
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); }
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); }
public ComposedSet(ComposedSet <T, TDB> cset) { indices = new List <int>(cset.indices); }