Author: rdonkin
Date: Fri Dec 6 17:45:27 2013
New Revision: 1548610
URL: http://svn.apache.org/r1548610
Log:
Format Code.
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CopyrightHeader.java
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CopyrightHeader.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CopyrightHeader.java?rev=1548610&r1=1548609&r2=1548610&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CopyrightHeader.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CopyrightHeader.java
Fri Dec 6 17:45:27 2013
@@ -25,65 +25,73 @@ import org.apache.rat.api.Document;
import org.apache.rat.api.MetaData.Datum;
/**
- * Matches a typical Copyright header line only based on a regex pattern
- * which allows for one (starting) year or year range, and a
- * configurable copyright owner.
- *
- * <p>The matching is done case insensitive</p>
- *
- * <ul>Example supported Copyright header lines, using copyright owner "FooBar"
- * <li>* Copyright 2010 FooBar. *</li>
- * <li>* Copyright 2010-2012 FooBar. *</li>
- * <li>*copyright 2012 foobar*</li>
+ * Matches a typical Copyright header line only based on a regex pattern which
+ * allows for one (starting) year or year range, and a configurable copyright
+ * owner.
+ *
+ * <p>
+ * The matching is done case insensitive
+ * </p>
+ *
+ * <ul>
+ * Example supported Copyright header lines, using copyright owner "FooBar"
+ * <li>* Copyright 2010 FooBar. *</li>
+ * <li>* Copyright 2010-2012 FooBar. *</li>
+ * <li>*copyright 2012 foobar*</li>
* </ul>
- *
- * <p>Note also that the copyright owner is appended to the regex pattern, so
- * can support additional regex but also requires escaping where needed,<br/>
- * e.g. use "FooBar \(www\.foobar\.com\)" for matching "FooBar
(www.foobar.com)" </p>
- *
+ *
+ * <p>
+ * Note also that the copyright owner is appended to the regex pattern, so can
+ * support additional regex but also requires escaping where needed,<br/>
+ * e.g. use "FooBar \(www\.foobar\.com\)" for matching "FooBar
(www.foobar.com)"
+ * </p>
+ *
* @since Rat 0.9
*/
public class CopyrightHeader extends BaseLicense implements IHeaderMatcher {
- public static final String COPYRIGHT_PREFIX_PATTERN_DEFN = ".*Copyright
[0-9]{4}(\\-[0-9]{4})? ";
+ public static final String COPYRIGHT_PREFIX_PATTERN_DEFN = ".*Copyright
[0-9]{4}(\\-[0-9]{4})? ";
- private Pattern copyrightPattern;
- private String copyrightOwner;
- private boolean copyrightMatch = false;
-
- protected CopyrightHeader(Datum licenseFamilyCategory, Datum
licenseFamilyName, String notes) {
- super(licenseFamilyCategory, licenseFamilyName, notes);
- }
-
- protected CopyrightHeader(Datum licenseFamilyCategory, Datum
licenseFamilyName, String notes, String copyrightOwner) {
- this(licenseFamilyCategory, licenseFamilyName, notes);
- setCopyrightOwner(copyrightOwner);
- }
-
- // Called by ctor, so must not be overridden
- public final void setCopyrightOwner(String copyrightOwner) {
- this.copyrightOwner = copyrightOwner;
- this.copyrightPattern =
Pattern.compile(COPYRIGHT_PREFIX_PATTERN_DEFN+copyrightOwner+".*",
Pattern.CASE_INSENSITIVE);
- }
-
- public String getCopyRightOwner() {
- return copyrightOwner;
- }
-
- public boolean hasCopyrightPattern() {
- return copyrightPattern != null;
- }
-
- protected boolean isCopyrightMatch() {
- return copyrightMatch;
- }
-
- protected boolean matchCopyright(String s) {
- if (!copyrightMatch) {
- copyrightMatch = copyrightPattern.matcher(s).matches();
- }
- return copyrightMatch;
- }
+ private Pattern copyrightPattern;
+ private String copyrightOwner;
+ private boolean copyrightMatch = false;
+
+ protected CopyrightHeader(Datum licenseFamilyCategory,
+ Datum licenseFamilyName, String notes) {
+ super(licenseFamilyCategory, licenseFamilyName, notes);
+ }
+
+ protected CopyrightHeader(Datum licenseFamilyCategory,
+ Datum licenseFamilyName, String notes, String
copyrightOwner) {
+ this(licenseFamilyCategory, licenseFamilyName, notes);
+ setCopyrightOwner(copyrightOwner);
+ }
+
+ // Called by ctor, so must not be overridden
+ public final void setCopyrightOwner(String copyrightOwner) {
+ this.copyrightOwner = copyrightOwner;
+ this.copyrightPattern =
Pattern.compile(COPYRIGHT_PREFIX_PATTERN_DEFN
+ + copyrightOwner + ".*",
Pattern.CASE_INSENSITIVE);
+ }
+
+ public String getCopyRightOwner() {
+ return copyrightOwner;
+ }
+
+ public boolean hasCopyrightPattern() {
+ return copyrightPattern != null;
+ }
+
+ protected boolean isCopyrightMatch() {
+ return copyrightMatch;
+ }
+
+ protected boolean matchCopyright(String s) {
+ if (!copyrightMatch) {
+ copyrightMatch = copyrightPattern.matcher(s).matches();
+ }
+ return copyrightMatch;
+ }
public boolean match(Document subject, String s) {
if (!copyrightMatch) {
@@ -94,7 +102,7 @@ public class CopyrightHeader extends Bas
return copyrightMatch;
}
- public void reset() {
- copyrightMatch = false;
- }
+ public void reset() {
+ copyrightMatch = false;
+ }
}