Class TimestampPattern
Extracts a timestamp from a file-name if it exists.
A regular-expression specifies whether the file-name matches, and respective groups for year, month, day, hour, minutes, seconds.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
The index of the group inregularExpression
that encodes the day, starting from 0 for the first group.int
The index of the group inregularExpression
that encodes the hours, starting from 0 for the first group.int
The index of the group inregularExpression
that encodes the minutes, starting from 0 for the first group.int
The index of the group inregularExpression
that encodes the month, starting from 0 for the first group.int
The index of the group inregularExpression
that encodes the seconds, starting from 0 for the first group.int
The index of the group inregularExpression
that encodes the year, starting from 0 for the first group.The regular-expression that checks a match and specifies groups for the encoded date-time.match
(String fileName, ZoneOffset offset) Matches certain times.void
setIndexDay
(int indexDay) The index of the group inregularExpression
that encodes the day, starting from 0 for the first group.void
setIndexHours
(int indexHours) The index of the group inregularExpression
that encodes the hours, starting from 0 for the first group.void
setIndexMinutes
(int indexMinutes) The index of the group inregularExpression
that encodes the minutes, starting from 0 for the first group.void
setIndexMonth
(int indexMonth) The index of the group inregularExpression
that encodes the month, starting from 0 for the first group.void
setIndexSeconds
(int indexSeconds) The index of the group inregularExpression
that encodes the seconds, starting from 0 for the first group.void
setIndexYear
(int indexYear) The index of the group inregularExpression
that encodes the year, starting from 0 for the first group.void
setRegularExpression
(String regularExpression) The regular-expression that checks a match and specifies groups for the encoded date-time.Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
TimestampPattern
-
TimestampPattern
public TimestampPattern()
-
-
Method Details
-
match
Matches certain times.- Parameters:
fileName
- the fileName to try and match against the pattern.offset
- the offset to assume the time-stamp belongs in.- Returns:
- if the string matches, the number of seconds since the epoch.
-
getRegularExpression
The regular-expression that checks a match and specifies groups for the encoded date-time. -
setRegularExpression
The regular-expression that checks a match and specifies groups for the encoded date-time. -
getIndexYear
public int getIndexYear()The index of the group inregularExpression
that encodes the year, starting from 0 for the first group. -
setIndexYear
public void setIndexYear(int indexYear) The index of the group inregularExpression
that encodes the year, starting from 0 for the first group. -
getIndexMonth
public int getIndexMonth()The index of the group inregularExpression
that encodes the month, starting from 0 for the first group. -
setIndexMonth
public void setIndexMonth(int indexMonth) The index of the group inregularExpression
that encodes the month, starting from 0 for the first group. -
getIndexDay
public int getIndexDay()The index of the group inregularExpression
that encodes the day, starting from 0 for the first group. -
setIndexDay
public void setIndexDay(int indexDay) The index of the group inregularExpression
that encodes the day, starting from 0 for the first group. -
getIndexHours
public int getIndexHours()The index of the group inregularExpression
that encodes the hours, starting from 0 for the first group. -
setIndexHours
public void setIndexHours(int indexHours) The index of the group inregularExpression
that encodes the hours, starting from 0 for the first group. -
getIndexMinutes
public int getIndexMinutes()The index of the group inregularExpression
that encodes the minutes, starting from 0 for the first group. -
setIndexMinutes
public void setIndexMinutes(int indexMinutes) The index of the group inregularExpression
that encodes the minutes, starting from 0 for the first group. -
getIndexSeconds
public int getIndexSeconds()The index of the group inregularExpression
that encodes the seconds, starting from 0 for the first group. -
setIndexSeconds
public void setIndexSeconds(int indexSeconds) The index of the group inregularExpression
that encodes the seconds, starting from 0 for the first group.
-