Re: [PATCH 1/2] Create a fnmatch-style pattern TreeFilter

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Florian Köberle
Date: Monday, June 23, 2008 - 10:32 am

-----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-----
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/2] Create a fnmatch-style pattern TreeFilter, Robin Rosenberg, (Sun Jun 22, 4:25 pm)
[PATCH 2/2] LsTree: Enable pattern matching in LsTree, Robin Rosenberg, (Sun Jun 22, 4:25 pm)
Re: [PATCH 1/2] Create a fnmatch-style pattern TreeFilter, Shawn O. Pearce, (Sun Jun 22, 5:27 pm)
Re: [PATCH 1/2] Create a fnmatch-style pattern TreeFilter, Florian Köberle, (Mon Jun 23, 10:32 am)
[[JGIT PATCH]] Implementation of a copy constructor for Fi ..., Florian Köberle, (Mon Jun 23, 10:43 am)