540 |
fields[DAY_OF_WEEK] = weekday; |
fields[DAY_OF_WEEK] = weekday; |
541 |
|
|
542 |
// get a first approximation of the year. This may be one |
// get a first approximation of the year. This may be one |
543 |
// year to big. |
// year too big. |
544 |
int year = 1970 + (gregorian |
int year = 1970 + (gregorian |
545 |
? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) |
? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) |
546 |
: ((day - 100) * 4) / (365 * 4 + 1)); |
: ((day - 100) * 4) / (365 * 4 + 1)); |
709 |
* it does what you expect: Jan, 25 + 10 Days is Feb, 4. |
* it does what you expect: Jan, 25 + 10 Days is Feb, 4. |
710 |
* @param field the time field. One of the time field constants. |
* @param field the time field. One of the time field constants. |
711 |
* @param amount the amount of time. |
* @param amount the amount of time. |
712 |
|
* @exception IllegalArgumentException if <code>field</code> is |
713 |
|
* <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or invalid; or |
714 |
|
* if <code>amount</code> contains an out-of-range value and the calendar |
715 |
|
* is not in lenient mode. |
716 |
*/ |
*/ |
717 |
public void add(int field, int amount) |
public void add(int field, int amount) |
718 |
{ |
{ |
789 |
areFieldsSet = false; |
areFieldsSet = false; |
790 |
break; |
break; |
791 |
case ZONE_OFFSET: |
case ZONE_OFFSET: |
|
complete(); |
|
|
fields[ZONE_OFFSET] += amount; |
|
|
time -= amount; |
|
|
break; |
|
792 |
case DST_OFFSET: |
case DST_OFFSET: |
|
complete(); |
|
|
fields[DST_OFFSET] += amount; |
|
|
isTimeSet = false; |
|
|
break; |
|
793 |
default: |
default: |
794 |
throw new IllegalArgumentException |
throw new IllegalArgumentException("Invalid or unknown field"); |
|
("Unknown Calendar field: " + field); |
|
795 |
} |
} |
796 |
} |
} |
797 |
|
|