Re: [JGIT PATCH v2 17/24] Added the class TreeFilePattern.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Florian Koeberle <florianskarten@xxxxxx> wrote:
> +/**
> + * Represents a pattern like "documents/*.txt" which matches all *.txt files in
> + * the tree documents.
> + * 
> + */
> +class TreeFilePattern implements FilePattern {
> +
> +	private final List<String> 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<FilePattern> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux