/** * Create a collection of path filters from Java strings. * <p> * Path strings are relative to the root of the repository. If the user's * input should be assumed relative to a subdirectory of the repository the * caller must prepend the subdirectory's path prior to creating the filter. * <p> * Path strings use '/' to delimit directories on all platforms. * <p> * Paths may appear in any order within the collection. Sorting may be done * internally when the group is constructed if doing so will improve path * matching performance. * * @param paths * the paths to test against. Must have at least one entry. * @return a new filter for the list of paths supplied. */ public static TreeFilter createFromStrings(IEnumerable<string> paths) { if (paths.Count()==0) throw new ArgumentException("At least one path is required."); PathFilter[] p = new PathFilter[paths.Count()]; int i = 0; foreach (string s in paths) p[i++] = PathFilter.create(s); return create(p); }
public Single(PathFilter p) { path = p; raw = path.pathRaw; }
public Group(PathFilter[] p) { paths = p; Array.Sort(paths, PATH_SORT); }
private static TreeFilter create(PathFilter[] p) { if (p.Length == 1) return new Single(p[0]); return new Group(p); }