org.das2.datum.TimeParser.FieldHandler

Interface to add custom handlers for strings with unique formats. For example, the RPWS group had files with two-hex digits indicating the ten-minute interval covered by the file name. This is also used for orbits. TODO: FieldHandler needs to report its affect on the LSD. (Autoplot gets versioning).


configure

configure( java.util.Map args ) → String

arguments for the parser are passed in.

Parameters

args - map of arguments. $(t,a1=v1,a2=v2,a3=v3)

Returns:

null if the string is parseable, an error message otherwise.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


format

format( org.das2.datum.TimeUtil.TimeStruct startTime, org.das2.datum.TimeUtil.TimeStruct timeWidth, int length, java.util.Map extra ) → String

create a string given the times, when this is possible. An IllegalArgumentException should be thrown when this is not possible, but be loose so this can be composed with other field handlers. For example, imagine the $Y field handler. This should not throw an exception when 2012-03-29 is passed in because it's not 2012-01-01, because the $m and $d might be used later. However if a time is specified for a year before the first orbit of a spacecraft, then an exception should be thrown because there is an error that the developer is going to have to deal with.

Parameters

startTime - a TimeUtil.TimeStruct
timeWidth - a TimeUtil.TimeStruct
length - an int
extra - extra data, such as version numbers, are passed in here.

Returns:

the string representing the time range specified.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getRegex

getRegex( ) → String

return a regular expression that matches valid field entries. ".*" can be used to match anything, but this limits use. TODO: where is this used? I added it because it's easy and I saw a TODO to add it.

Returns:

null to match anything, or a regular expression matching valid entries.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


parse

parse( String fieldContent, org.das2.datum.TimeUtil.TimeStruct startTime, org.das2.datum.TimeUtil.TimeStruct timeWidth, java.util.Map extra ) → void

parse the field to interpret as a time range.

Parameters

fieldContent - the field to parse, for example "2014" for $Y
startTime - the current startTime
timeWidth - the current timeWidth
extra - extra data, such as version numbers, are passed out here.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]