private static LocalDate parse( Matcher matcher, int year, String MONTH, String DAY, String WEEK, String DOW, String QUARTER, String DOQ, String DOY ) { String month = matcher.group( MONTH ); if ( month != null ) { return assertParsable( () -> LocalDate.of( year, parseInt( month ), optInt( matcher.group( DAY ) ) ) ); } String week = matcher.group( WEEK ); if ( week != null ) { return assertParsable( () -> localWeekDate( year, parseInt( week ), optInt( matcher.group( DOW ) ) ) ); } String quarter = matcher.group( QUARTER ); if ( quarter != null ) { return assertParsable( () -> localQuarterDate( year, parseInt( quarter ), optInt( matcher.group( DOQ ) ) ) ); } String doy = matcher.group( DOY ); if ( doy != null ) { return assertParsable( () -> LocalDate.ofYearDay( year, parseInt( doy ) ) ); } return assertParsable( () -> LocalDate.of( year, 1, 1 ) ); }
private static LocalDate parse( Matcher matcher, int year, String MONTH, String DAY, String WEEK, String DOW, String QUARTER, String DOQ, String DOY ) { String month = matcher.group( MONTH ); if ( month != null ) { return assertParsable( () -> LocalDate.of( year, parseInt( month ), optInt( matcher.group( DAY ) ) ) ); } String week = matcher.group( WEEK ); if ( week != null ) { return assertParsable( () -> localWeekDate( year, parseInt( week ), optInt( matcher.group( DOW ) ) ) ); } String quarter = matcher.group( QUARTER ); if ( quarter != null ) { return assertParsable( () -> localQuarterDate( year, parseInt( quarter ), optInt( matcher.group( DOQ ) ) ) ); } String doy = matcher.group( DOY ); if ( doy != null ) { return assertParsable( () -> LocalDate.ofYearDay( year, parseInt( doy ) ) ); } return assertParsable( () -> LocalDate.of( year, 1, 1 ) ); }