From: Shawn O. Pearce Date: Tue, 13 May 2008 01:22:53 GMT Subject: Re: [JGIT PATCH v2 17/24] Added the class TreeFilePattern. Message-ID: <20080513012253.GF29038@spearce.org> In-Reply-To: <1210623222-24908-18-git-send-email-florianskarten@web.de> Florian Koeberle wrote: > +/** > + * Represents a pattern like "documents/*.txt" which matches all *.txt files in > + * the tree documents. > + * > + */ > +class TreeFilePattern implements FilePattern { > + > + private final List path; > + > + private final int offset; > + > + private final GlobalFilePattern globalFilePattern; Hmm. This looks a lot like the ComplexFilePattern class to me; only it has the optimization of avoiding the regex match on the leading parts of the path. Wouldn't it be simpler to define ComplexFilePattern taking a List and have two implementations of FilePattern; one that uses FNMatch and one that uses strict String.equals()? Then this entire class becomes unnecessary as the pattern "documents/technical/*.txt" can be handled by two ExactMatch instances followd by an FNMatch instance. The performance difference is probably not even measurable, but the code will be less complicated and less special-cased. -- Shawn.