Package com.cobber.fta
Class LogicalTypeFiniteSimple
- Object
-
- LogicalType
-
- LogicalTypeCode
-
- LogicalTypeFinite
-
- LogicalTypeFiniteSimple
-
- All Implemented Interfaces:
LTRandom
,Comparable<LogicalType>
- Direct Known Subclasses:
CountryEN
,LogicalTypeFiniteSimpleExternal
,NAStateProvince
,PersonName
public abstract class LogicalTypeFiniteSimple extends LogicalTypeFinite
All Semantic Types that are backed by a simple list typically subclass this abstract class.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
backout
protected SingletonSet
memberSet
protected String
qualifier
protected java.io.Reader
reader
protected String
regExp
-
Fields inherited from class com.cobber.fta.LogicalTypeFinite
maxLength, minLength
-
Fields inherited from class com.cobber.fta.LogicalTypeCode
random
-
Fields inherited from class com.cobber.fta.LogicalType
analysisConfig, defn, locale, localeInfo, pluginLocaleEntry, priority, threshold
-
-
Constructor Summary
Constructors Constructor Description LogicalTypeFiniteSimple(PluginDefinition plugin, String backout, int threshold)
-
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, FiniteMap cardinality, FiniteMap outliers, TokenStreams tokenStreams, AnalysisConfig analysisConfig)
Given the data to date as embodied by the arguments return an analysis.Set<String>
getMembers()
String
getRegExp()
The Regular Expression that most closely matches (SeeLogicalType.isRegExpComplete()
) this Semantic Type.String
getSemanticType()
The name of the Semantic Type.boolean
initialize(AnalysisConfig analysisConfig)
Called to perform any initialization.boolean
isMember(String input)
String
nextRandom()
nextRandom will generate a random (secure) valid example of this Semantic Type.void
setContent(String contentType, String content)
-
Methods inherited from class com.cobber.fta.LogicalTypeFinite
getIgnorable, getMaxLength, getMinLength, getSize, isClosed, isRegExpComplete, isValid
-
Methods inherited from class com.cobber.fta.LogicalTypeCode
seed
-
Methods inherited from class com.cobber.fta.LogicalType
acceptsBaseType, compareTo, getBaseType, getConfidence, getDescription, getHeaderConfidence, getPluginDefinition, getPriority, getSignature, getThreshold, isLocaleSensitive, isValid, setThreshold
-
-
-
-
Field Detail
-
qualifier
protected String qualifier
-
regExp
protected String regExp
-
backout
protected String backout
-
reader
protected java.io.Reader reader
-
memberSet
protected SingletonSet memberSet
-
-
Constructor Detail
-
LogicalTypeFiniteSimple
public LogicalTypeFiniteSimple(PluginDefinition plugin, String backout, int threshold)
-
-
Method Detail
-
setContent
public void setContent(String contentType, String content)
-
getMembers
public Set<String> getMembers()
- Specified by:
getMembers
in classLogicalTypeFinite
-
isMember
public boolean isMember(String input)
-
nextRandom
public String nextRandom()
Description copied from interface:LTRandom
nextRandom will generate a random (secure) valid example of this Semantic Type.- Returns:
- a new valid example of the Semantic Type.
-
initialize
public boolean initialize(AnalysisConfig analysisConfig) throws FTAPluginException
Description copied from class:LogicalType
Called to perform any initialization.- Overrides:
initialize
in classLogicalTypeFinite
- Parameters:
analysisConfig
- The Analysis configuration used for this analysis- Returns:
- True if initialization was successful.
- Throws:
FTAPluginException
- Thrown when the plugin is incorrectly configured.
-
getSemanticType
public String getSemanticType()
Description copied from class:LogicalType
The name of the Semantic Type. For example, EMAIL for an email address.- Overrides:
getSemanticType
in classLogicalType
- Returns:
- The name of the Semantic Type.
-
getRegExp
public String getRegExp()
Description copied from class:LogicalType
The Regular Expression that most closely matches (SeeLogicalType.isRegExpComplete()
) this Semantic Type. Note: All valid matches will match this RE, but the inverse is not necessarily true.- Specified by:
getRegExp
in classLogicalType
- Returns:
- The Java Regular Expression that most closely matches this Semantic Type.
-
analyzeSet
public PluginAnalysis analyzeSet(AnalyzerContext context, long matchCount, long realSamples, String currentRegExp, Facts facts, FiniteMap cardinality, FiniteMap 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 Semantic type then valid will be true , if invalid then valid will be false and a new Pattern will be returned.- Specified by:
analyzeSet
in classLogicalType
- 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 Semantic type (backout pattern otherwise)
-
-