[UWS] Complete the parsing of ISO-8601 dates. It was not possible to parse
dates with no seconds, but also with no day or month. Representations in
days of year or weeks of year were not possible as well. Check out the
ISO8601Format class' Javadoc for more details.
* <p>{@link Pattern} object implementing the ISO-8601 representation.</p>
*
* <p>The regular expression used in this {@link Pattern} identifies the following groups:</p><pre>
* ( 0: everything)
* 1: year (yyyy)
* ( 2: '-' and the rest of the date (may include the time))
* ( 3: the rest of the date (may include the time))
* 4: month (MM)
* ( 5: '-' and the day of the month)
* 6: day of the month (dd)
* 7-20: TIME
* 21: day of the year (ddd)
* 22-35: TIME
* 36: week of the year (ww)
* ( 37: '-' and the day of the week)
* 38: the day of the week (d)
* 39-52: TIME</pre>
*
* <p>All groups named <code>TIME</code> refer to {@link #ISO8601_TIME_REGEX}.</p>
*
* <p>Groups in parenthesis should be ignored ; but an exception must be done for the 9th of {@link #ISO8601_TIME_REGEX} which may contain 'Z' meaning a UTC time zone.</p>
*
* <p>Separator characters ('-', '.' and ':') are optional. The separator 'T' may be replaced by a ' '.</p>
thrownewParseException("Incorrect day of year: "+dayOfYear+"! An integer between 1 and "+cal.getActualMaximum(Calendar.DAY_OF_YEAR)+" was expected.",-1);
returndayOfYear;
}
/**
* <p>Convert the given ISO-8601 day of month value into a Java day of month value.</p>
*
* <i>Note: Same representation in ISO-8601 and Java.</i>
*
* @param str Textual representation of the day of month in ISO-8601.
* @param cal The calendar in which the year and the month has already been set.
* <i>Note: This parameter is used to know the maximum number of days there are for the set month and year.
* (see {@link GregorianCalendar#getActualMaximum(int)})</i>
*
* @return The corresponding Java day of month.
*
* @throws ParseException If the given day of month is incorrect according to ISO-8601.
thrownewParseException("Incorrect day of month: "+dayOfMonth+"! An integer between 1 and "+cal.getActualMaximum(Calendar.DAY_OF_MONTH)+" was expected.",-1);
returndayOfMonth;
}
/**
* <p>Convert the given ISO-8601 day of week value into a Java day of week value.</p>
thrownewParseException("Incorrect week of year value: "+weekOfYear+"! An integer between 1 and "+cal.getActualMaximum(Calendar.WEEK_OF_YEAR)+" was expected.",-1);
returnweekOfYear;
}
/**
* <p>Convert the given ISO-8601 month index into a Java index.</p>
*
* <ul>
* <li><u>In ISO-8601</u>: January = 1, February = 2, ..., December = 12.</li>
* <li><u>In Java</u> : January = 0, February = 1, ..., December = 11.</li>
* </ul>
*
* @param str Textual representation of the month index in ISO-8601.
*
* @return The corresponding Java month index.
*
* @throws ParseException If the given month index is incorrect according to ISO-8601.