Remove isSet[] field from Calendar

X-SVN-Rev: 2821
This commit is contained in:
Alan Liu 2000-10-27 22:25:52 +00:00
parent ab5c42e298
commit 88693a446c
8 changed files with 112 additions and 126 deletions

View File

@ -364,7 +364,7 @@ import com.ibm.text.SimpleDateFormat;
* @see GregorianCalendar
* @see TimeZone
* @see DateFormat
* @version $Revision: 1.9 $ $Date: 2000/10/17 20:54:49 $
* @version $Revision: 1.10 $ $Date: 2000/10/27 22:25:52 $
* @author Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu, Laura Werner
* @since JDK1.1
*/
@ -764,16 +764,6 @@ public abstract class Calendar implements Serializable, Cloneable {
*/
protected int fields[]; // NOTE: Make transient when possible
/**
* The flags which tell if a specified time field for the calendar is set.
* A new object has no fields set. After the first call to a method
* which generates the fields, they all remain set after that.
* This is an array of <code>FIELD_COUNT</code> booleans, with index values
* <code>ERA</code> through <code>DST_OFFSET</code>.
* @serial
*/
protected boolean isSet[]; // NOTE: Remove when possible
/**
* Pseudo-time-stamps which specify when each field was set. There
* are two special values, UNSET and INTERNALLY_SET. Values from
@ -949,7 +939,6 @@ public abstract class Calendar implements Serializable, Cloneable {
protected Calendar(TimeZone zone, Locale aLocale)
{
fields = new int[FIELD_COUNT];
isSet = new boolean[FIELD_COUNT];
stamp = new int[FIELD_COUNT];
this.zone = zone;
@ -1113,7 +1102,6 @@ public abstract class Calendar implements Serializable, Cloneable {
fields[field] = value;
stamp[field] = nextStamp++;
areFieldsSet = false;
isSet[field] = true; // Remove later
}
/**
@ -1184,7 +1172,6 @@ public abstract class Calendar implements Serializable, Cloneable {
stamp = new int[FIELD_COUNT];
areFieldsSet = false;
areAllFieldsSet = false;
isSet = new boolean[FIELD_COUNT]; // Remove later
isTimeSet = false;
}
@ -1198,7 +1185,6 @@ public abstract class Calendar implements Serializable, Cloneable {
stamp[field] = UNSET;
areFieldsSet = false;
areAllFieldsSet = false;
isSet[field] = false; // Remove later
isTimeSet = false;
}
@ -1209,7 +1195,6 @@ public abstract class Calendar implements Serializable, Cloneable {
public final boolean isSet(int field)
{
return stamp[field] != UNSET;
// return isSet[field];
}
/**
@ -2747,10 +2732,8 @@ public abstract class Calendar implements Serializable, Cloneable {
Calendar other = (Calendar) super.clone();
other.fields = new int[FIELD_COUNT];
other.isSet = new boolean[FIELD_COUNT];
other.stamp = new int[FIELD_COUNT];
System.arraycopy(this.fields, 0, other.fields, 0, FIELD_COUNT);
System.arraycopy(this.isSet, 0, other.isSet, 0, FIELD_COUNT);
System.arraycopy(this.stamp, 0, other.stamp, 0, FIELD_COUNT);
other.zone = (TimeZone) zone.clone();
@ -2876,6 +2859,7 @@ public abstract class Calendar implements Serializable, Cloneable {
/**
* Reconstitute this object from a stream (i.e., deserialize it).
*/
/*
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
@ -2900,4 +2884,16 @@ public abstract class Calendar implements Serializable, Cloneable {
serialVersionOnStream = currentSerialVersion;
}
*/
//----------------------------------------------------------------------
// Subclass API
// For use by subclasses of Calendar
//----------------------------------------------------------------------
protected void _TEMPORARY_markAllFieldsSet() {
for (int i=0; i<stamp.length; ++i) {
stamp[i] = INTERNALLY_SET;
}
}
}

View File

@ -1225,10 +1225,7 @@ public class GregorianCalendar extends Calendar {
// Careful here: We are manually setting the time stamps[] flags to
// INTERNALLY_SET, so we must be sure that the above code actually does
// set all these fields.
for (int i=0; i<FIELD_COUNT; ++i) {
stamp[i] = INTERNALLY_SET;
isSet[i] = true; // Remove later
}
_TEMPORARY_markAllFieldsSet();
}
/**

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/HebrewCalendar.java,v $
* $Date: 2000/10/17 18:26:44 $
* $Revision: 1.4 $
* $Date: 2000/10/27 22:25:52 $
* $Revision: 1.5 $
*
*****************************************************************************************
*/
@ -415,7 +415,7 @@ public class HebrewCalendar extends Calendar {
*/
public int getActualMaximum(int field)
{
if (!isSet[YEAR] || !isSet[MONTH]) {
if (!isSet(YEAR) || !isSet(MONTH)) {
complete();
}
switch (field) {
@ -583,7 +583,7 @@ public class HebrewCalendar extends Calendar {
if (!isLenient() && !validateFields())
throw new IllegalArgumentException("Invalid field values for HebrewCalendar");
if (isSet[ERA] && internalGet(ERA) != 0)
if (isSet(ERA) && internalGet(ERA) != 0)
throw new IllegalArgumentException("ERA out of range in HebrewCalendar");
// The year is required. We don't have to check if it's unset,
@ -598,10 +598,10 @@ public class HebrewCalendar extends Calendar {
// The following code is somewhat convoluted. The various nested
// if's handle the different cases of what fields are present.
if (isSet[MONTH] &&
(isSet[DATE] ||
(isSet[DAY_OF_WEEK] &&
(isSet[WEEK_OF_MONTH] || isSet[DAY_OF_WEEK_IN_MONTH])
if (isSet(MONTH) &&
(isSet(DATE) ||
(isSet(DAY_OF_WEEK) &&
(isSet(WEEK_OF_MONTH) || isSet(DAY_OF_WEEK_IN_MONTH))
)))
{
// We have the month specified. Make it 1-based for the algorithm.
@ -624,7 +624,7 @@ public class HebrewCalendar extends Calendar {
dayNumber += NUM_DAYS[month][yearType(year)];
}
if (isSet[DATE])
if (isSet(DATE))
{
date = internalGet(DATE);
}
@ -647,7 +647,7 @@ public class HebrewCalendar extends Calendar {
// first week.
date = 1 - fdm + internalGet(DAY_OF_WEEK) - getFirstDayOfWeek();
if (isSet[WEEK_OF_MONTH])
if (isSet(WEEK_OF_MONTH))
{
// Adjust for minimal days in first week.
if ((7 - fdm) < getMinimalDaysInFirstWeek()) date += 7;
@ -680,10 +680,10 @@ public class HebrewCalendar extends Calendar {
}
dayNumber += date;
}
else if (isSet[DAY_OF_YEAR]) {
else if (isSet(DAY_OF_YEAR)) {
dayNumber = startOfYear(year) + internalGet(DAY_OF_YEAR);
}
else if (isSet[DAY_OF_WEEK] && isSet[WEEK_OF_YEAR])
else if (isSet(DAY_OF_WEEK) && isSet(WEEK_OF_YEAR))
{
dayNumber = startOfYear(year);
@ -722,12 +722,12 @@ public class HebrewCalendar extends Calendar {
int millisInDay = 0;
// Hours
if (isSet[HOUR_OF_DAY])
if (isSet(HOUR_OF_DAY))
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
millisInDay += internalGet(HOUR_OF_DAY);
else if (isSet[HOUR])
else if (isSet(HOUR))
{
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
@ -792,7 +792,7 @@ public class HebrewCalendar extends Calendar {
// Ignore DATE and DAY_OF_YEAR which are handled below
if (field != DATE &&
field != DAY_OF_YEAR &&
isSet[field] &&
isSet(field) &&
!boundsCheck(internalGet(field), field))
return false;
@ -800,14 +800,14 @@ public class HebrewCalendar extends Calendar {
// Values differ in Least-Maximum and Maximum should be handled
// specially.
if (isSet[DATE])
if (isSet(DATE))
{
int date = internalGet(DATE);
return (date >= getMinimum(DATE) &&
date <= monthLength(fields[YEAR], fields[MONTH]));
}
if (isSet[DAY_OF_YEAR])
if (isSet(DAY_OF_YEAR))
{
int days = internalGet(DAY_OF_YEAR);
@ -815,7 +815,7 @@ public class HebrewCalendar extends Calendar {
return false;
}
if (isSet[YEAR])
if (isSet(YEAR))
{
int year = internalGet(YEAR);
if (year < 1)
@ -824,7 +824,7 @@ public class HebrewCalendar extends Calendar {
// Handle DAY_OF_WEEK_IN_MONTH, which must not have the value zero.
// We've checked against minimum and maximum above already.
if (isSet[DAY_OF_WEEK_IN_MONTH] &&
if (isSet(DAY_OF_WEEK_IN_MONTH) &&
0 == internalGet(DAY_OF_WEEK_IN_MONTH)) return false;
return true;
@ -932,9 +932,9 @@ public class HebrewCalendar extends Calendar {
areFieldsSet = true;
// Careful here: We are manually setting the isSet[] flags to true, so we
// Careful here: We are manually setting the isSet flags to true, so we
// must be sure that the above code actually does set all these fields.
for (int i=0; i<FIELD_COUNT; ++i) isSet[i] = true;
_TEMPORARY_markAllFieldsSet();
}
//-------------------------------------------------------------------------

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/IslamicCalendar.java,v $
* $Date: 2000/10/17 18:26:45 $
* $Revision: 1.6 $
* $Date: 2000/10/27 22:25:52 $
* $Revision: 1.7 $
*
*****************************************************************************************
*/
@ -360,7 +360,7 @@ public class IslamicCalendar extends Calendar {
* @see #getLeastMaximum
*/
public int getActualMaximum(int field) {
if (!isSet[YEAR] || !isSet[MONTH]) {
if (!isSet(YEAR) || !isSet(MONTH)) {
complete();
}
switch (field) {
@ -393,7 +393,7 @@ public class IslamicCalendar extends Calendar {
if (!isLenient() && !validateFields())
throw new IllegalArgumentException();
if (isSet[ERA] && internalGet(ERA) != 0)
if (isSet(ERA) && internalGet(ERA) != 0)
throw new IllegalArgumentException();
// We need the time zone offset for some of the calculations below.
@ -414,11 +414,11 @@ public class IslamicCalendar extends Calendar {
// The following code is somewhat convoluted. The various nested
// if's handle the different cases of what fields are present.
if (isSet[MONTH] &&
(isSet[DATE] ||
(isSet[DAY_OF_WEEK] &&
(isSet[WEEK_OF_MONTH] ||
isSet[DAY_OF_WEEK_IN_MONTH])
if (isSet(MONTH) &&
(isSet(DATE) ||
(isSet(DAY_OF_WEEK) &&
(isSet(WEEK_OF_MONTH) ||
isSet(DAY_OF_WEEK_IN_MONTH))
)
))
{
@ -426,7 +426,7 @@ public class IslamicCalendar extends Calendar {
int month = internalGet(MONTH);
dayNumber = monthStart(year, month);
if (isSet[DATE])
if (isSet(DATE))
{
date = internalGet(DATE);
}
@ -450,7 +450,7 @@ public class IslamicCalendar extends Calendar {
// first week.
date = 1 - fdm + internalGet(DAY_OF_WEEK) - getFirstDayOfWeek();
if (isSet[WEEK_OF_MONTH])
if (isSet(WEEK_OF_MONTH))
{
// Adjust for minimal days in first week.
if ((7 - fdm) < getMinimalDaysInFirstWeek()) date += 7;
@ -482,10 +482,10 @@ public class IslamicCalendar extends Calendar {
}
}
}
else if (isSet[DAY_OF_YEAR]) {
else if (isSet(DAY_OF_YEAR)) {
dayNumber = yearStart(year) + internalGet(DAY_OF_YEAR);
}
else if (isSet[DAY_OF_WEEK] && isSet[WEEK_OF_YEAR])
else if (isSet(DAY_OF_WEEK) && isSet(WEEK_OF_YEAR))
{
dayNumber = yearStart(year);
@ -527,12 +527,12 @@ public class IslamicCalendar extends Calendar {
int millisInDay = 0;
// Hours
if (isSet[HOUR_OF_DAY]) {
if (isSet(HOUR_OF_DAY)) {
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
millisInDay += internalGet(HOUR_OF_DAY);
} else if (isSet[HOUR])
} else if (isSet(HOUR))
{
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
@ -588,13 +588,13 @@ public class IslamicCalendar extends Calendar {
for (int field = 0; field < FIELD_COUNT; field++)
{
// Ignore DATE and DAY_OF_YEAR which are handled below
if (isSet[field] &&
if (isSet(field) &&
!boundsCheck(internalGet(field), field))
return false;
}
if (isSet[YEAR])
if (isSet(YEAR))
{
int year = internalGet(YEAR);
if (year < 1)
@ -603,7 +603,7 @@ public class IslamicCalendar extends Calendar {
// Handle DAY_OF_WEEK_IN_MONTH, which must not have the value zero.
// We've checked against minimum and maximum above already.
if (isSet[DAY_OF_WEEK_IN_MONTH] &&
if (isSet(DAY_OF_WEEK_IN_MONTH) &&
0 == internalGet(DAY_OF_WEEK_IN_MONTH)) return false;
return true;
@ -725,9 +725,9 @@ public class IslamicCalendar extends Calendar {
areFieldsSet = true;
// Careful here: We are manually setting the isSet[] flags to true, so we
// Careful here: We are manually setting the isSet flags to true, so we
// must be sure that the above code actually does set all these fields.
for (int i=0; i<FIELD_COUNT; ++i) isSet[i] = true;
_TEMPORARY_markAllFieldsSet();
}
//-------------------------------------------------------------------------

View File

@ -364,7 +364,7 @@ import com.ibm.text.SimpleDateFormat;
* @see GregorianCalendar
* @see TimeZone
* @see DateFormat
* @version $Revision: 1.9 $ $Date: 2000/10/17 20:54:49 $
* @version $Revision: 1.10 $ $Date: 2000/10/27 22:25:52 $
* @author Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu, Laura Werner
* @since JDK1.1
*/
@ -764,16 +764,6 @@ public abstract class Calendar implements Serializable, Cloneable {
*/
protected int fields[]; // NOTE: Make transient when possible
/**
* The flags which tell if a specified time field for the calendar is set.
* A new object has no fields set. After the first call to a method
* which generates the fields, they all remain set after that.
* This is an array of <code>FIELD_COUNT</code> booleans, with index values
* <code>ERA</code> through <code>DST_OFFSET</code>.
* @serial
*/
protected boolean isSet[]; // NOTE: Remove when possible
/**
* Pseudo-time-stamps which specify when each field was set. There
* are two special values, UNSET and INTERNALLY_SET. Values from
@ -949,7 +939,6 @@ public abstract class Calendar implements Serializable, Cloneable {
protected Calendar(TimeZone zone, Locale aLocale)
{
fields = new int[FIELD_COUNT];
isSet = new boolean[FIELD_COUNT];
stamp = new int[FIELD_COUNT];
this.zone = zone;
@ -1113,7 +1102,6 @@ public abstract class Calendar implements Serializable, Cloneable {
fields[field] = value;
stamp[field] = nextStamp++;
areFieldsSet = false;
isSet[field] = true; // Remove later
}
/**
@ -1184,7 +1172,6 @@ public abstract class Calendar implements Serializable, Cloneable {
stamp = new int[FIELD_COUNT];
areFieldsSet = false;
areAllFieldsSet = false;
isSet = new boolean[FIELD_COUNT]; // Remove later
isTimeSet = false;
}
@ -1198,7 +1185,6 @@ public abstract class Calendar implements Serializable, Cloneable {
stamp[field] = UNSET;
areFieldsSet = false;
areAllFieldsSet = false;
isSet[field] = false; // Remove later
isTimeSet = false;
}
@ -1209,7 +1195,6 @@ public abstract class Calendar implements Serializable, Cloneable {
public final boolean isSet(int field)
{
return stamp[field] != UNSET;
// return isSet[field];
}
/**
@ -2747,10 +2732,8 @@ public abstract class Calendar implements Serializable, Cloneable {
Calendar other = (Calendar) super.clone();
other.fields = new int[FIELD_COUNT];
other.isSet = new boolean[FIELD_COUNT];
other.stamp = new int[FIELD_COUNT];
System.arraycopy(this.fields, 0, other.fields, 0, FIELD_COUNT);
System.arraycopy(this.isSet, 0, other.isSet, 0, FIELD_COUNT);
System.arraycopy(this.stamp, 0, other.stamp, 0, FIELD_COUNT);
other.zone = (TimeZone) zone.clone();
@ -2876,6 +2859,7 @@ public abstract class Calendar implements Serializable, Cloneable {
/**
* Reconstitute this object from a stream (i.e., deserialize it).
*/
/*
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
@ -2900,4 +2884,16 @@ public abstract class Calendar implements Serializable, Cloneable {
serialVersionOnStream = currentSerialVersion;
}
*/
//----------------------------------------------------------------------
// Subclass API
// For use by subclasses of Calendar
//----------------------------------------------------------------------
protected void _TEMPORARY_markAllFieldsSet() {
for (int i=0; i<stamp.length; ++i) {
stamp[i] = INTERNALLY_SET;
}
}
}

View File

@ -1225,10 +1225,7 @@ public class GregorianCalendar extends Calendar {
// Careful here: We are manually setting the time stamps[] flags to
// INTERNALLY_SET, so we must be sure that the above code actually does
// set all these fields.
for (int i=0; i<FIELD_COUNT; ++i) {
stamp[i] = INTERNALLY_SET;
isSet[i] = true; // Remove later
}
_TEMPORARY_markAllFieldsSet();
}
/**

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/util/Attic/HebrewCalendar.java,v $
* $Date: 2000/10/17 18:26:44 $
* $Revision: 1.4 $
* $Date: 2000/10/27 22:25:52 $
* $Revision: 1.5 $
*
*****************************************************************************************
*/
@ -415,7 +415,7 @@ public class HebrewCalendar extends Calendar {
*/
public int getActualMaximum(int field)
{
if (!isSet[YEAR] || !isSet[MONTH]) {
if (!isSet(YEAR) || !isSet(MONTH)) {
complete();
}
switch (field) {
@ -583,7 +583,7 @@ public class HebrewCalendar extends Calendar {
if (!isLenient() && !validateFields())
throw new IllegalArgumentException("Invalid field values for HebrewCalendar");
if (isSet[ERA] && internalGet(ERA) != 0)
if (isSet(ERA) && internalGet(ERA) != 0)
throw new IllegalArgumentException("ERA out of range in HebrewCalendar");
// The year is required. We don't have to check if it's unset,
@ -598,10 +598,10 @@ public class HebrewCalendar extends Calendar {
// The following code is somewhat convoluted. The various nested
// if's handle the different cases of what fields are present.
if (isSet[MONTH] &&
(isSet[DATE] ||
(isSet[DAY_OF_WEEK] &&
(isSet[WEEK_OF_MONTH] || isSet[DAY_OF_WEEK_IN_MONTH])
if (isSet(MONTH) &&
(isSet(DATE) ||
(isSet(DAY_OF_WEEK) &&
(isSet(WEEK_OF_MONTH) || isSet(DAY_OF_WEEK_IN_MONTH))
)))
{
// We have the month specified. Make it 1-based for the algorithm.
@ -624,7 +624,7 @@ public class HebrewCalendar extends Calendar {
dayNumber += NUM_DAYS[month][yearType(year)];
}
if (isSet[DATE])
if (isSet(DATE))
{
date = internalGet(DATE);
}
@ -647,7 +647,7 @@ public class HebrewCalendar extends Calendar {
// first week.
date = 1 - fdm + internalGet(DAY_OF_WEEK) - getFirstDayOfWeek();
if (isSet[WEEK_OF_MONTH])
if (isSet(WEEK_OF_MONTH))
{
// Adjust for minimal days in first week.
if ((7 - fdm) < getMinimalDaysInFirstWeek()) date += 7;
@ -680,10 +680,10 @@ public class HebrewCalendar extends Calendar {
}
dayNumber += date;
}
else if (isSet[DAY_OF_YEAR]) {
else if (isSet(DAY_OF_YEAR)) {
dayNumber = startOfYear(year) + internalGet(DAY_OF_YEAR);
}
else if (isSet[DAY_OF_WEEK] && isSet[WEEK_OF_YEAR])
else if (isSet(DAY_OF_WEEK) && isSet(WEEK_OF_YEAR))
{
dayNumber = startOfYear(year);
@ -722,12 +722,12 @@ public class HebrewCalendar extends Calendar {
int millisInDay = 0;
// Hours
if (isSet[HOUR_OF_DAY])
if (isSet(HOUR_OF_DAY))
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
millisInDay += internalGet(HOUR_OF_DAY);
else if (isSet[HOUR])
else if (isSet(HOUR))
{
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
@ -792,7 +792,7 @@ public class HebrewCalendar extends Calendar {
// Ignore DATE and DAY_OF_YEAR which are handled below
if (field != DATE &&
field != DAY_OF_YEAR &&
isSet[field] &&
isSet(field) &&
!boundsCheck(internalGet(field), field))
return false;
@ -800,14 +800,14 @@ public class HebrewCalendar extends Calendar {
// Values differ in Least-Maximum and Maximum should be handled
// specially.
if (isSet[DATE])
if (isSet(DATE))
{
int date = internalGet(DATE);
return (date >= getMinimum(DATE) &&
date <= monthLength(fields[YEAR], fields[MONTH]));
}
if (isSet[DAY_OF_YEAR])
if (isSet(DAY_OF_YEAR))
{
int days = internalGet(DAY_OF_YEAR);
@ -815,7 +815,7 @@ public class HebrewCalendar extends Calendar {
return false;
}
if (isSet[YEAR])
if (isSet(YEAR))
{
int year = internalGet(YEAR);
if (year < 1)
@ -824,7 +824,7 @@ public class HebrewCalendar extends Calendar {
// Handle DAY_OF_WEEK_IN_MONTH, which must not have the value zero.
// We've checked against minimum and maximum above already.
if (isSet[DAY_OF_WEEK_IN_MONTH] &&
if (isSet(DAY_OF_WEEK_IN_MONTH) &&
0 == internalGet(DAY_OF_WEEK_IN_MONTH)) return false;
return true;
@ -932,9 +932,9 @@ public class HebrewCalendar extends Calendar {
areFieldsSet = true;
// Careful here: We are manually setting the isSet[] flags to true, so we
// Careful here: We are manually setting the isSet flags to true, so we
// must be sure that the above code actually does set all these fields.
for (int i=0; i<FIELD_COUNT; ++i) isSet[i] = true;
_TEMPORARY_markAllFieldsSet();
}
//-------------------------------------------------------------------------

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/util/Attic/IslamicCalendar.java,v $
* $Date: 2000/10/17 18:26:45 $
* $Revision: 1.6 $
* $Date: 2000/10/27 22:25:52 $
* $Revision: 1.7 $
*
*****************************************************************************************
*/
@ -360,7 +360,7 @@ public class IslamicCalendar extends Calendar {
* @see #getLeastMaximum
*/
public int getActualMaximum(int field) {
if (!isSet[YEAR] || !isSet[MONTH]) {
if (!isSet(YEAR) || !isSet(MONTH)) {
complete();
}
switch (field) {
@ -393,7 +393,7 @@ public class IslamicCalendar extends Calendar {
if (!isLenient() && !validateFields())
throw new IllegalArgumentException();
if (isSet[ERA] && internalGet(ERA) != 0)
if (isSet(ERA) && internalGet(ERA) != 0)
throw new IllegalArgumentException();
// We need the time zone offset for some of the calculations below.
@ -414,11 +414,11 @@ public class IslamicCalendar extends Calendar {
// The following code is somewhat convoluted. The various nested
// if's handle the different cases of what fields are present.
if (isSet[MONTH] &&
(isSet[DATE] ||
(isSet[DAY_OF_WEEK] &&
(isSet[WEEK_OF_MONTH] ||
isSet[DAY_OF_WEEK_IN_MONTH])
if (isSet(MONTH) &&
(isSet(DATE) ||
(isSet(DAY_OF_WEEK) &&
(isSet(WEEK_OF_MONTH) ||
isSet(DAY_OF_WEEK_IN_MONTH))
)
))
{
@ -426,7 +426,7 @@ public class IslamicCalendar extends Calendar {
int month = internalGet(MONTH);
dayNumber = monthStart(year, month);
if (isSet[DATE])
if (isSet(DATE))
{
date = internalGet(DATE);
}
@ -450,7 +450,7 @@ public class IslamicCalendar extends Calendar {
// first week.
date = 1 - fdm + internalGet(DAY_OF_WEEK) - getFirstDayOfWeek();
if (isSet[WEEK_OF_MONTH])
if (isSet(WEEK_OF_MONTH))
{
// Adjust for minimal days in first week.
if ((7 - fdm) < getMinimalDaysInFirstWeek()) date += 7;
@ -482,10 +482,10 @@ public class IslamicCalendar extends Calendar {
}
}
}
else if (isSet[DAY_OF_YEAR]) {
else if (isSet(DAY_OF_YEAR)) {
dayNumber = yearStart(year) + internalGet(DAY_OF_YEAR);
}
else if (isSet[DAY_OF_WEEK] && isSet[WEEK_OF_YEAR])
else if (isSet(DAY_OF_WEEK) && isSet(WEEK_OF_YEAR))
{
dayNumber = yearStart(year);
@ -527,12 +527,12 @@ public class IslamicCalendar extends Calendar {
int millisInDay = 0;
// Hours
if (isSet[HOUR_OF_DAY]) {
if (isSet(HOUR_OF_DAY)) {
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
millisInDay += internalGet(HOUR_OF_DAY);
} else if (isSet[HOUR])
} else if (isSet(HOUR))
{
// Don't normalize here; let overflow bump into the next period.
// This is consistent with how we handle other fields.
@ -588,13 +588,13 @@ public class IslamicCalendar extends Calendar {
for (int field = 0; field < FIELD_COUNT; field++)
{
// Ignore DATE and DAY_OF_YEAR which are handled below
if (isSet[field] &&
if (isSet(field) &&
!boundsCheck(internalGet(field), field))
return false;
}
if (isSet[YEAR])
if (isSet(YEAR))
{
int year = internalGet(YEAR);
if (year < 1)
@ -603,7 +603,7 @@ public class IslamicCalendar extends Calendar {
// Handle DAY_OF_WEEK_IN_MONTH, which must not have the value zero.
// We've checked against minimum and maximum above already.
if (isSet[DAY_OF_WEEK_IN_MONTH] &&
if (isSet(DAY_OF_WEEK_IN_MONTH) &&
0 == internalGet(DAY_OF_WEEK_IN_MONTH)) return false;
return true;
@ -725,9 +725,9 @@ public class IslamicCalendar extends Calendar {
areFieldsSet = true;
// Careful here: We are manually setting the isSet[] flags to true, so we
// Careful here: We are manually setting the isSet flags to true, so we
// must be sure that the above code actually does set all these fields.
for (int i=0; i<FIELD_COUNT; ++i) isSet[i] = true;
_TEMPORARY_markAllFieldsSet();
}
//-------------------------------------------------------------------------