Package org.apache.rat.analysis.license
Class FullTextMatchingLicense
- java.lang.Object
-
- org.apache.rat.analysis.license.BaseLicense
-
- org.apache.rat.analysis.license.FullTextMatchingLicense
-
- All Implemented Interfaces:
IHeaderMatcher
- Direct Known Subclasses:
FullTextLicenseMatcher,GPL1License,GPL2License,GPL3License,MITLicense,OASISLicense
public class FullTextMatchingLicense extends BaseLicense implements IHeaderMatcher
Accumulates all letters and numbers contained inside the header and compares it to the full text of a given license (after reducing it to letters and numbers as well).The text comparison is case insensitive but assumes only characters in the US-ASCII charset are being matched.
- Since:
- Rat 0.9
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringBuilderbufferprivate static intDEFAULT_INITIAL_LINE_LENGTHprivate java.lang.StringfirstLineprivate java.lang.StringfullTextprivate booleanseenFirstLine
-
Constructor Summary
Constructors Modifier Constructor Description FullTextMatchingLicense()protectedFullTextMatchingLicense(MetaData.Datum licenseFamilyCategory, MetaData.Datum licenseFamilyName, java.lang.String notes, java.lang.String fullText)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasFullText()private voidinit()booleanmatch(Document subject, java.lang.String line)Matches the text accumulated to licenses.voidreset()Resets this matches.voidsetFullText(java.lang.String text)-
Methods inherited from class org.apache.rat.analysis.license.BaseLicense
getLicenseFamilyCategory, getLicenseFamilyName, getNotes, prune, reportOnLicense, setLicenseFamilyCategory, setLicenseFamilyName, setNotes
-
-
-
-
Field Detail
-
DEFAULT_INITIAL_LINE_LENGTH
private static final int DEFAULT_INITIAL_LINE_LENGTH
- See Also:
- Constant Field Values
-
fullText
private java.lang.String fullText
-
firstLine
private java.lang.String firstLine
-
seenFirstLine
private boolean seenFirstLine
-
buffer
private final java.lang.StringBuilder buffer
-
-
Constructor Detail
-
FullTextMatchingLicense
public FullTextMatchingLicense()
-
FullTextMatchingLicense
protected FullTextMatchingLicense(MetaData.Datum licenseFamilyCategory, MetaData.Datum licenseFamilyName, java.lang.String notes, java.lang.String fullText)
-
-
Method Detail
-
setFullText
public final void setFullText(java.lang.String text)
-
hasFullText
public final boolean hasFullText()
-
match
public boolean match(Document subject, java.lang.String line) throws RatHeaderAnalysisException
Description copied from interface:IHeaderMatcherMatches the text accumulated to licenses. TODO probably a poor design choice - hope to fix later- Specified by:
matchin interfaceIHeaderMatcher- Parameters:
subject- current document.line- next line of text, not null- Returns:
- whether the current line matched in the document.
- Throws:
RatHeaderAnalysisException- in case of internal RAT errors.
-
reset
public void reset()
Description copied from interface:IHeaderMatcherResets this matches. Subsequent calls toIHeaderMatcher.match(org.apache.rat.api.Document, java.lang.String)will accumulate new text.- Specified by:
resetin interfaceIHeaderMatcher
-
init
private void init()
-
-