org.mycore.datamodel.ifs
Class MCRSimpleFCTDetector.MCRExtensionRule

java.lang.Object
  extended by org.mycore.datamodel.ifs.MCRSimpleFCTDetector.MCRDetectionRule
      extended by org.mycore.datamodel.ifs.MCRSimpleFCTDetector.MCRExtensionRule
Enclosing class:
MCRSimpleFCTDetector

 class MCRSimpleFCTDetector.MCRExtensionRule
extends MCRSimpleFCTDetector.MCRDetectionRule

A rule that decides based on the file extension


Field Summary
protected  String extension
          The lowercase file name extension that a file must match
 
Fields inherited from class org.mycore.datamodel.ifs.MCRSimpleFCTDetector.MCRDetectionRule
score
 
Constructor Summary
MCRSimpleFCTDetector.MCRExtensionRule(String extension, double score)
          Creates a new rule based on a match of the file extension
 
Method Summary
(package private)  double getScore(String filename, byte[] header)
          Returns the score if filename and/or header matches this rule, or 0.0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extension

protected String extension
The lowercase file name extension that a file must match

Constructor Detail

MCRSimpleFCTDetector.MCRExtensionRule

MCRSimpleFCTDetector.MCRExtensionRule(String extension,
                                      double score)
Creates a new rule based on a match of the file extension

Parameters:
extension - lowercase file name extension that a file must match
score - the score for matching this rule, a value between 0.0 and 1.0
Method Detail

getScore

double getScore(String filename,
                byte[] header)
Description copied from class: MCRSimpleFCTDetector.MCRDetectionRule
Returns the score if filename and/or header matches this rule, or 0.0

Specified by:
getScore in class MCRSimpleFCTDetector.MCRDetectionRule
Parameters:
filename - the name of the file to detect the content type of
header - the first bytes of the file content
Returns:
the score between 0.0 and 1.0 for matching this rule