public void add ( int theField , int theValue ) { switch ( theField ) { case Calendar . YEAR : setValue ( DateUtils . addYears ( getValue ( ) , theValue ) , getPrecision ( ) ) ; break ; case Calendar . MONTH : setValue ( DateUtils . addMonths ( getValue ( ) , theValue ) , getPrecision ( ) ) ; break ; case Calendar . DATE : setValue ( DateUtils . addDays ( getValue ( ) , theValue ) , getPrecision ( ) ) ; break ; case Calendar . HOUR : setValue ( DateUtils . addHours ( getValue ( ) , theValue ) , getPrecision ( ) ) ; break ; case Calendar . MINUTE : setValue ( DateUtils . addMinutes ( getValue ( ) , theValue ) , getPrecision ( ) ) ; break ; case Calendar . SECOND : setValue ( DateUtils . addSeconds ( getValue ( ) , theValue ) , getPrecision ( ) ) ; break ; case Calendar . MILLISECOND : setValue ( DateUtils . addMilliseconds ( getValue ( ) , theValue ) , getPrecision ( ) ) ; break ; default : throw new IllegalArgumentException ( "Unknown field constant: " + theField ) ; } }
Adds the given amount to the field specified by theField