protected int getLimit ( int field , int limitType ) { switch ( field ) { case DAY_OF_WEEK : case AM_PM : case HOUR : case HOUR_OF_DAY : case MINUTE : case SECOND : case MILLISECOND : case ZONE_OFFSET : case DST_OFFSET : case DOW_LOCAL : case JULIAN_DAY : case MILLISECONDS_IN_DAY : case IS_LEAP_MONTH : return LIMITS [ field ] [ limitType ] ; case WEEK_OF_MONTH : { int limit ; if ( limitType == MINIMUM ) { limit = getMinimalDaysInFirstWeek ( ) == 1 ? 1 : 0 ; } else if ( limitType == GREATEST_MINIMUM ) { limit = 1 ; } else { int minDaysInFirst = getMinimalDaysInFirstWeek ( ) ; int daysInMonth = handleGetLimit ( DAY_OF_MONTH , limitType ) ; if ( limitType == LEAST_MAXIMUM ) { limit = ( daysInMonth + ( 7 - minDaysInFirst ) ) / 7 ; } else { // limitType == MAXIMUM limit = ( daysInMonth + 6 + ( 7 - minDaysInFirst ) ) / 7 ; } } return limit ; } } return handleGetLimit ( field , limitType ) ; }
Returns a limit for a field .