org.apache.rat.analysis.license
Class FullTextMatchingLicense

java.lang.Object
  extended by org.apache.rat.analysis.license.BaseLicense
      extended by org.apache.rat.analysis.license.FullTextMatchingLicense
All Implemented Interfaces:
IHeaderMatcher
Direct Known Subclasses:
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

Constructor Summary
  FullTextMatchingLicense()
           
protected FullTextMatchingLicense(MetaData.Datum licenseFamilyCategory, MetaData.Datum licenseFamilyName, String notes, String fullText)
           
 
Method Summary
 boolean hasFullText()
           
 boolean match(Document subject, String line)
          Matches the text accumulated to licenses.
protected  String prune(String text)
           
 void reset()
          Resets this matches.
 void setFullText(String text)
           
 
Methods inherited from class org.apache.rat.analysis.license.BaseLicense
getLicenseFamilyCategory, getLicenseFamilyName, getNotes, reportOnLicense, setLicenseFamilyCategory, setLicenseFamilyName, setNotes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FullTextMatchingLicense

public FullTextMatchingLicense()

FullTextMatchingLicense

protected FullTextMatchingLicense(MetaData.Datum licenseFamilyCategory,
                                  MetaData.Datum licenseFamilyName,
                                  String notes,
                                  String fullText)
Method Detail

setFullText

public final void setFullText(String text)

hasFullText

public final boolean hasFullText()

prune

protected final String prune(String text)

match

public boolean match(Document subject,
                     String line)
              throws RatHeaderAnalysisException
Description copied from interface: IHeaderMatcher
Matches the text accumulated to licenses. TODO probably a poor design choice - hope to fix later

Specified by:
match in interface IHeaderMatcher
Parameters:
subject - TODO
line - next line of text, not null
Returns:
TODO
Throws:
RatHeaderAnalysisException

reset

public void reset()
Description copied from interface: IHeaderMatcher
Resets this matches. Subsequent calls to IHeaderMatcher.match(org.apache.rat.api.Document, java.lang.String) will accumulate new text.

Specified by:
reset in interface IHeaderMatcher


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.