Package com.cobber.fta
Class LogicalTypeFinite
- Object
-
- LogicalType
-
- LogicalTypeCode
-
- LogicalTypeFinite
-
- All Implemented Interfaces:
LTRandom
,Comparable<LogicalType>
public abstract class LogicalTypeFinite extends LogicalTypeCode
All Semantic Types that consist of a constrained domain, for example, a finite (small) number of elements should subclass this abstract class.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
maxLength
protected int
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 LogicalTypeFinite(PluginDefinition plugin)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Set<String>
getIgnorable()
int
getMaxLength()
Get the maximum length of instances of this Semantic Type.abstract Set<String>
getMembers()
int
getMinLength()
Get the minimum length of instances of this Semantic Type.int
getSize()
Get the number of members in this Semantic Type.boolean
initialize(AnalysisConfig analysisConfig)
Called to perform any initialization.boolean
isClosed()
Does the set of members enumerated reflect the entire set.boolean
isRegExpComplete()
Is the returned Regular Expression a true and complete representation of the Semantic Type.boolean
isValid(String input, boolean detectMode, long count)
Is the supplied String an instance of this Semantic type?-
Methods inherited from class com.cobber.fta.LogicalTypeCode
seed
-
Methods inherited from class com.cobber.fta.LogicalType
acceptsBaseType, analyzeSet, compareTo, getBaseType, getConfidence, getDescription, getHeaderConfidence, getPluginDefinition, getPriority, getRegExp, getSemanticType, getSignature, getThreshold, isLocaleSensitive, isValid, setThreshold
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.cobber.fta.LTRandom
nextRandom
-
-
-
-
Constructor Detail
-
LogicalTypeFinite
public LogicalTypeFinite(PluginDefinition plugin)
-
-
Method Detail
-
getMembers
public abstract Set<String> getMembers()
-
isValid
public boolean isValid(String input, boolean detectMode, long count)
Description copied from class:LogicalType
Is the supplied String an instance of this Semantic type?- Specified by:
isValid
in classLogicalType
- Parameters:
input
- String to check (trimmed for Numeric base Types, un-trimmed for String base Type)detectMode
- If true then we are in the process of detection, otherwise it is a simple validity check.count
- The number of instance of this sample.- Returns:
- true iff the supplied String is an instance of this Semantic type.
-
initialize
public boolean initialize(AnalysisConfig analysisConfig) throws FTAPluginException
Description copied from class:LogicalType
Called to perform any initialization.- Overrides:
initialize
in classLogicalTypeCode
- Parameters:
analysisConfig
- The Analysis configuration used for this analysis- Returns:
- True if initialization was successful.
- Throws:
FTAPluginException
- Thrown when the plugin is incorrectly configured.
-
isRegExpComplete
public boolean isRegExpComplete()
Description copied from class:LogicalType
Is the returned Regular Expression a true and complete representation of the Semantic Type. For example, \\d{5} is not for US ZIP codes (e.g. 00000 is not a valid Zip), whereas (?i)(male|female) could be valid for a Gender.- Overrides:
isRegExpComplete
in classLogicalType
- Returns:
- The Java Regular Expression that most closely matches this Semantic Type.
-
isClosed
public boolean isClosed()
Description copied from class:LogicalType
Does the set of members enumerated reflect the entire set. For example any of the ISO sets are reference sets and hence complete, compared to FirstName and LastName where the set provided is of the common names. If isClosed() is true then isValid() false does not imply that the input is not valid just that it is not in the set of 'known' members.- Specified by:
isClosed
in classLogicalType
- Returns:
- A boolean indicating if the set is closed.
-
getSize
public int getSize()
Get the number of members in this Semantic Type.- Returns:
- The number of members
-
getIgnorable
public Set<String> getIgnorable()
-
getMinLength
public int getMinLength()
Get the minimum length of instances of this Semantic Type.- Returns:
- The minimum length of instances
-
getMaxLength
public int getMaxLength()
Get the maximum length of instances of this Semantic Type.- Returns:
- The maximum length of instances
-
-