Re: [PATCH 1/2] Create a fnmatch-style pattern TreeFilter
- From
- Florian Köberle <florianskarten@web.de>
- Date
- Jun 23, 2008, 17:32 UTC
- Message-ID
- <485FDE42.1060106@web.de>
- In-Reply-To
- <1214177145-18963-1-git-send-email-robin.rosenberg@dewire.com>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi Robin,
thank you for accepting my first patch :D.
| +/** | + * This class implements a TreeeFilter that uses the wildcard style pattern | + * matching like of Posix fnmatch function. | + */ Typo: One 'e' to much in TreeeFilter.
It would be more efficient to
| + @Override
| + public TreeFilter clone() {
| + return new WildCardTreeFilter(pattern);
| + }One way to create a clone of the FileNameMatcher is to call: originalMatcher.reset() FileNameMatcher clone = originalMatcher.createMatcherForSuffix()
I will send a patch which implements a copy constructor for FileNameMatcher.
First I wanted to implement a clone() method, but found this page and decided then to implement a copy constructor: http://www.javapractices.com/topic/TopicAction.do?Id=71
A Implementor of a super class could imply that clone() of object gets called, as stated in the javadoc of clone():
quote (javadoc ob Object#clone()): - ----------- By convention, the returned object should be obtained by calling super.clone - -----------
I think this is a bad convention, as one should not rely on Object#clone() to do the copy job for one. If you really need a clone method then I would do it the same way you did, by calling a constructor which does the job.
Best regards, Florian
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIX94k59ca4mzhfxMRAgDjAJ9S76L8I5Lqed4lKfgTf+2cp2IQ9gCfQNVh z72+NGvmIy3H0gwveKRfn+w= =wnpy -----END PGP SIGNATURE-----