Package com.cobber.fta.plugins
Class CheckDigitISBN
- Object
-
- LogicalType
-
- LogicalTypeCode
-
- LogicalTypeInfinite
-
- com.cobber.fta.plugins.CheckDigitLT
-
- com.cobber.fta.plugins.CheckDigitISBN
-
- All Implemented Interfaces:
LTRandom
,Comparable<LogicalType>
public class CheckDigitISBN extends CheckDigitLT
Plugin to detect ISBN-13 identifiers (with hyphens).
-
-
Field Summary
Fields Modifier and Type Field Description static String
REGEXP
The Regular Express for this Semantic type.static String
SEMANTIC_TYPE
The Semantic type for this Plugin.-
Fields inherited from class com.cobber.fta.plugins.CheckDigitLT
BACKOUT_REGEXP, validator
-
Fields inherited from class com.cobber.fta.LogicalTypeCode
random
-
Fields inherited from class com.cobber.fta.LogicalType
defn, locale, pluginLocaleEntry, priority, threshold
-
-
Constructor Summary
Constructors Constructor Description CheckDigitISBN(PluginDefinition plugin)
Construct a plugin to detect ISBNs (International Standard Book Numbers) with hyphens based on the Plugin Definition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PluginAnalysis
analyzeSet(AnalyzerContext context, long matchCount, long realSamples, String currentRegExp, Facts facts, Map<String,Long> cardinality, Map<String,Long> outliers, TokenStreams tokenStreams, AnalysisConfig analysisConfig)
Given the data to date as embodied by the arguments return an analysis.FTAType
getBaseType()
The underlying type we are qualifying.String
getQualifier()
The user-friendly name of the Qualifier.String
getRegExp()
The Regular Expression that most closely matches (SeeLogicalType.isRegExpComplete()
) this Logical Type.boolean
isCandidate(String trimmed, StringBuilder compressed, int[] charCounts, int[] lastIndex)
A fast check to see if the supplied String might be an instance of this logical type?boolean
isValid(String input)
Is the supplied String an instance of this logical type?String
nextRandom()
nextRandom will generate a random (secure) valid example of this Semantic Type.-
Methods inherited from class com.cobber.fta.plugins.CheckDigitLT
initialize
-
Methods inherited from class com.cobber.fta.LogicalTypeInfinite
isClosed, isRegExpComplete
-
Methods inherited from class com.cobber.fta.LogicalTypeCode
seed
-
Methods inherited from class com.cobber.fta.LogicalType
acceptsBaseType, compareTo, getConfidence, getDescription, getHeaderConfidence, getPluginDefinition, getPriority, getSignature, getThreshold, isLocaleSensitive, setThreshold
-
-
-
-
Field Detail
-
SEMANTIC_TYPE
public static final String SEMANTIC_TYPE
The Semantic type for this Plugin.- See Also:
- Constant Field Values
-
REGEXP
public static final String REGEXP
The Regular Express for this Semantic type.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CheckDigitISBN
public CheckDigitISBN(PluginDefinition plugin)
Construct a plugin to detect ISBNs (International Standard Book Numbers) with hyphens based on the Plugin Definition.- Parameters:
plugin
- The definition of this plugin.
-
-
Method Detail
-
getRegExp
public String getRegExp()
Description copied from class:LogicalType
The Regular Expression that most closely matches (SeeLogicalType.isRegExpComplete()
) this Logical Type. Note: All valid matches will match this RE, but the inverse is not necessarily true.- Overrides:
getRegExp
in classCheckDigitLT
- Returns:
- The Java Regular Expression that most closely matches this Logical Type.
-
getBaseType
public FTAType getBaseType()
Description copied from class:LogicalType
The underlying type we are qualifying.- Overrides:
getBaseType
in classCheckDigitLT
- Returns:
- The underlying type - e.g. STRING, LONG, etc.
-
isCandidate
public boolean isCandidate(String trimmed, StringBuilder compressed, int[] charCounts, int[] lastIndex)
Description copied from class:LogicalTypeInfinite
A fast check to see if the supplied String might be an instance of this logical type?- Overrides:
isCandidate
in classCheckDigitLT
- Parameters:
trimmed
- String to checkcompressed
- A compressed representation of the input string (e.g. \d{5} for 20351).charCounts
- An array of occurrence counts for characters in the input (ASCII-only).lastIndex
- An array of the last index where character is located (ASCII-only).- Returns:
- true iff the supplied String is a possible instance of this Logical type.
-
isValid
public boolean isValid(String input)
Description copied from class:LogicalType
Is the supplied String an instance of this logical type?- Overrides:
isValid
in classCheckDigitLT
- Parameters:
input
- String to check (trimmed for Numeric base Types, un-trimmed for String base Type)- Returns:
- true iff the supplied String is an instance of this Logical type.
-
analyzeSet
public PluginAnalysis analyzeSet(AnalyzerContext context, long matchCount, long realSamples, String currentRegExp, Facts facts, Map<String,Long> cardinality, Map<String,Long> outliers, TokenStreams tokenStreams, AnalysisConfig analysisConfig)
Description copied from class:LogicalType
Given the data to date as embodied by the arguments return an analysis. If we think this is an instance of this logical type then valid will be true , if invalid then valid will be false and a new Pattern will be returned.- Overrides:
analyzeSet
in classCheckDigitLT
- Parameters:
context
- The context used to interpret the Data Stream (for example, stream name, date resolution mode, etc)matchCount
- Number of samples that match so far (as determined by isValid()realSamples
- Number of real (i.e. non-blank and non-null) samples that we have processed so far.currentRegExp
- The current Regular Expression that we matched againstfacts
- Facts (min, max, sum) for the analysis to date (optional - i.e. maybe null)cardinality
- Cardinality set, up to the maximum maintainedoutliers
- Outlier set, up to the maximum maintainedtokenStreams
- Shapes observedanalysisConfig
- The Configuration of the current analysis- Returns:
- Null if we think this is an instance of this logical type (backout pattern otherwise)
-
getQualifier
public String getQualifier()
Description copied from class:LogicalType
The user-friendly name of the Qualifier. For example, EMAIL for an email address- Specified by:
getQualifier
in classLogicalType
- Returns:
- The user-friendly name of the type-qualifier.
-
nextRandom
public String nextRandom()
Description copied from interface:LTRandom
nextRandom will generate a random (secure) valid example of this Semantic Type.- Specified by:
nextRandom
in interfaceLTRandom
- Overrides:
nextRandom
in classCheckDigitLT
- Returns:
- a new valid example of the Semantic Type.
-
-