question: @ SuppressWarnings ( "fallthrough" ) private static void clearCalendarByRegEx ( Calendar calendar , String regEx ) { switch ( regEx ) { case YEAR_DATE_FORMAT : { calendar . clear ( Calendar . MONTH ) ; calendar . clear ( Calendar . DAY_OF_MONTH ) ; clearTime ( calendar ) ; break ; } case YEAR_MONTH_DATE_FORMAT : { calendar . clear ( Calendar . DAY_OF_MONTH ) ; clearTime ( calendar ) ; break ; } case MONTH_DAY_DATE_FORMAT : { calendar . clear ( Calendar . YEAR ) ; clearTime ( calendar ) ; break ; } case YEAR_MONTH_DAY_DATE_FORMAT : { clearTime ( calendar ) ; break ; } } }
target:  Clear unused calendar fields by regular expression.