Package app.babylon.table.transform
Class DateFormatInference
java.lang.Object
app.babylon.table.transform.DateFormatInference
Heuristics for inferring a consistent date format from string columns.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DateFormatinferFormat(ColumnObject<String> column) Infers the best date format for one string column.static DateFormat[]inferFormats(ColumnObject<String>[] columns) Infers one date format per supplied column, optionally using a dominant format to fill ambiguous columns.static booleanisLikelyDate(CharSequence value) Returns whether the value looks like any recognised date.static booleanisLikelyDate(CharSequence value, boolean isDateName) Returns whether the value looks date-like, optionally biasing toward date interpretation when the column name suggests it contains dates.static booleanisStrictDecimal(CharSequence value) Returns whether the value is a strict decimal literal.static booleanisStrictInteger(CharSequence value) Returns whether the value is a strict integer literal.static Collection<DateFormat> validFormats(CharSequence value, boolean isDateName, Collection<DateFormat> result) Adds all date formats that can parse the supplied value to the result collection.static Collection<DateFormat> validFormats(CharSequence value, Collection<DateFormat> result) Adds all date formats that can parse the supplied value to the result collection.
-
Method Details
-
inferFormats
Infers one date format per supplied column, optionally using a dominant format to fill ambiguous columns.- Parameters:
columns- string columns to inspect- Returns:
- inferred formats, never
null
-
inferFormat
Infers the best date format for one string column.- Parameters:
column- string column to inspect- Returns:
- inferred format or
DateFormat.Unknown
-
isLikelyDate
Returns whether the value looks like any recognised date.- Parameters:
value- text to inspect- Returns:
truewhen the value looks date-like
-
isLikelyDate
Returns whether the value looks date-like, optionally biasing toward date interpretation when the column name suggests it contains dates.- Parameters:
value- text to inspectisDateName- whether the surrounding column name suggests date content- Returns:
truewhen the value looks date-like
-
validFormats
public static Collection<DateFormat> validFormats(CharSequence value, Collection<DateFormat> result) Adds all date formats that can parse the supplied value to the result collection. -
validFormats
public static Collection<DateFormat> validFormats(CharSequence value, boolean isDateName, Collection<DateFormat> result) Adds all date formats that can parse the supplied value to the result collection. -
isStrictInteger
Returns whether the value is a strict integer literal.- Parameters:
value- text to inspect- Returns:
truewhen the value is a strict integer
-
isStrictDecimal
Returns whether the value is a strict decimal literal.- Parameters:
value- text to inspect- Returns:
truewhen the value is a strict decimal
-