ICU-1085 incorporate Ram's review comments; sync to C

X-SVN-Rev: 12321
This commit is contained in:
Alan Liu 2003-06-05 20:00:12 +00:00
parent 67796b222d
commit f3381350ac

View File

@ -3258,10 +3258,15 @@ public abstract class Calendar implements Serializable, Cloneable {
*/ */
public void setMinimalDaysInFirstWeek(int value) public void setMinimalDaysInFirstWeek(int value)
{ {
// Values less than 1 have the same effect as 1; values greater
// than 7 have the same effect as 7. However, we normalize values
// so operator== and so forth work.
if (value < 1) {
value = 1;
} else if (value > 7) {
value = 7;
}
if (minimalDaysInFirstWeek != value) { if (minimalDaysInFirstWeek != value) {
if (value < 1 || value > 7) {
throw new IllegalArgumentException("Invalid days in first week");
}
minimalDaysInFirstWeek = value; minimalDaysInFirstWeek = value;
areFieldsSet = false; areFieldsSet = false;
} }