Package com.cobber.fta
Class LogicalTypeFinite
- Object
-
- LogicalType
-
- LogicalTypeCode
-
- LogicalTypeFinite
-
- All Implemented Interfaces:
LTRandom
,Comparable<LogicalType>
public abstract class LogicalTypeFinite extends LogicalTypeCode
All Logical 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 int
getMaxLength()
Get the maximum length of instances of this Logical Type.abstract Set<String>
getMembers()
int
getMinLength()
Get the minimum length of instances of this Logical Type.int
getSize()
Get the number of members in this Logical 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 Logical Type.boolean
isValid(String input)
Is the supplied String an instance of this logical 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, getQualifier, getRegExp, getSignature, getThreshold, isLocaleSensitive, 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)
Description copied from class:LogicalType
Is the supplied String an instance of this logical type?- Specified by:
isValid
in classLogicalType
- 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.
-
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 Logical 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 Logical 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 Logical Type.- Returns:
- The number of members
-
getMinLength
public int getMinLength()
Get the minimum length of instances of this Logical Type.- Returns:
- The minimum length of instances
-
getMaxLength
public int getMaxLength()
Get the maximum length of instances of this Logical Type.- Returns:
- The maximum length of instances
-
-