mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
Calendar reorg: merge IBMCalendar into com.ibm.util.Calendar
X-SVN-Rev: 2716
This commit is contained in:
parent
e5b3fb0aa1
commit
2766ee5291
9 changed files with 62 additions and 53 deletions
|
@ -1475,11 +1475,16 @@ public class CalendarRegression extends com.ibm.test.TestFmwk {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WEEK_OF_YEAR computed incorrectly. A failure of this test can indicate
|
||||
* a problem in several different places in the
|
||||
*/
|
||||
public void Test4288792() throws Exception
|
||||
{
|
||||
TimeZone savedTZ = TimeZone.getDefault();
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
|
||||
GregorianCalendar cal = new GregorianCalendar();
|
||||
|
||||
for (int i = 1900; i < 2100; i++) {
|
||||
for (int j1 = 1; j1 <= 7; j1++) {
|
||||
// Loop for MinimalDaysInFirstWeek: 1..7
|
||||
|
@ -1488,6 +1493,14 @@ public class CalendarRegression extends com.ibm.test.TestFmwk {
|
|||
cal.clear();
|
||||
cal.setMinimalDaysInFirstWeek(j1);
|
||||
cal.setFirstDayOfWeek(j);
|
||||
// Set the calendar to the first day of the last week
|
||||
// of the year. This may overlap some of the start of
|
||||
// the next year; that is, the last week of 1999 may
|
||||
// include some of January 2000. Use the add() method
|
||||
// to advance through the week. For each day, call
|
||||
// get(WEEK_OF_YEAR). The result should be the same
|
||||
// for the whole week. Note that a bug in
|
||||
// getActualMaximum() will break this test.
|
||||
cal.set(Calendar.YEAR, i);
|
||||
int maxWeek = cal.getActualMaximum(Calendar.WEEK_OF_YEAR);
|
||||
cal.set(Calendar.WEEK_OF_YEAR, maxWeek);
|
||||
|
@ -1501,6 +1514,8 @@ public class CalendarRegression extends com.ibm.test.TestFmwk {
|
|||
+ ",min=" + j1 + ",first=" + j);
|
||||
}
|
||||
}
|
||||
// Now advance the calendar one more day. This should
|
||||
// put it at the first day of week 1 of the next year.
|
||||
cal.add(Calendar.DATE, 1);
|
||||
int WOY = cal.get(Calendar.WEEK_OF_YEAR);
|
||||
if (WOY != 1) {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/calendar/CalendarTest.java,v $
|
||||
* $Date: 2000/05/12 23:19:12 $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2000/10/17 18:32:50 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -63,7 +63,7 @@ public class CalendarTest extends TestFmwk {
|
|||
|
||||
// Get a format to use for printing dates in the calendar system we're testing
|
||||
// TODO: This is kind of ugly right now .
|
||||
DateFormat format = IBMCalendar.getDateTimeFormat(cal, DateFormat.SHORT, -1, Locale.getDefault());
|
||||
DateFormat format = Calendar.getDateTimeFormat(cal, DateFormat.SHORT, -1, Locale.getDefault());
|
||||
|
||||
((SimpleDateFormat)format).applyPattern(pattern);
|
||||
DateFormat testFmt = (DateFormat)format.clone();
|
||||
|
@ -136,7 +136,7 @@ public class CalendarTest extends TestFmwk {
|
|||
* @param roll <code>true</code> or <code>ROLL</code> to test the <code>roll</code> method;
|
||||
* <code>false</code> or <code>ADD</code> to test the <code>add</code method
|
||||
*/
|
||||
public void doRollAdd(boolean roll, IBMCalendar cal, int[][] tests)
|
||||
public void doRollAdd(boolean roll, Calendar cal, int[][] tests)
|
||||
{
|
||||
String name = roll ? "rolling" : "adding";
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/calendar/IBMCalendarTest.java,v $
|
||||
* $Date: 2000/03/21 02:51:43 $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2000/10/17 18:32:50 $
|
||||
* $Revision: 1.3 $
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.test.calendar;
|
||||
|
@ -70,16 +70,16 @@ public class IBMCalendarTest extends TestFmwk {
|
|||
// Test days of the week
|
||||
Object[] DATA2 = {
|
||||
Locale.US, new int[] {
|
||||
Calendar.MONDAY, IBMCalendar.WEEKDAY,
|
||||
Calendar.FRIDAY, IBMCalendar.WEEKDAY,
|
||||
Calendar.SATURDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.SUNDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.MONDAY, Calendar.WEEKDAY,
|
||||
Calendar.FRIDAY, Calendar.WEEKDAY,
|
||||
Calendar.SATURDAY, Calendar.WEEKEND,
|
||||
Calendar.SUNDAY, Calendar.WEEKEND,
|
||||
},
|
||||
new Locale("ar", "BH"), new int[] { // Thursday:Friday
|
||||
Calendar.WEDNESDAY,IBMCalendar.WEEKDAY,
|
||||
Calendar.SATURDAY, IBMCalendar.WEEKDAY,
|
||||
Calendar.THURSDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.FRIDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.WEDNESDAY,Calendar.WEEKDAY,
|
||||
Calendar.SATURDAY, Calendar.WEEKDAY,
|
||||
Calendar.THURSDAY, Calendar.WEEKEND,
|
||||
Calendar.FRIDAY, Calendar.WEEKEND,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/calendar/TestCase.java,v $
|
||||
* $Date: 2000/05/12 23:19:12 $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2000/10/17 18:32:50 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -197,7 +197,6 @@ public class TestCase extends Calendar {
|
|||
// declares all of these abstract methods....
|
||||
protected void computeTime() {}
|
||||
protected void computeFields() {}
|
||||
public void roll(int field, boolean up) {}
|
||||
public void add(int field, int amt) {}
|
||||
public int getMinimum(int field) { return 0; }
|
||||
public int getMaximum(int field) { return 0; }
|
||||
|
|
|
@ -1475,11 +1475,16 @@ public class CalendarRegression extends com.ibm.test.TestFmwk {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WEEK_OF_YEAR computed incorrectly. A failure of this test can indicate
|
||||
* a problem in several different places in the
|
||||
*/
|
||||
public void Test4288792() throws Exception
|
||||
{
|
||||
TimeZone savedTZ = TimeZone.getDefault();
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
|
||||
GregorianCalendar cal = new GregorianCalendar();
|
||||
|
||||
for (int i = 1900; i < 2100; i++) {
|
||||
for (int j1 = 1; j1 <= 7; j1++) {
|
||||
// Loop for MinimalDaysInFirstWeek: 1..7
|
||||
|
@ -1488,6 +1493,14 @@ public class CalendarRegression extends com.ibm.test.TestFmwk {
|
|||
cal.clear();
|
||||
cal.setMinimalDaysInFirstWeek(j1);
|
||||
cal.setFirstDayOfWeek(j);
|
||||
// Set the calendar to the first day of the last week
|
||||
// of the year. This may overlap some of the start of
|
||||
// the next year; that is, the last week of 1999 may
|
||||
// include some of January 2000. Use the add() method
|
||||
// to advance through the week. For each day, call
|
||||
// get(WEEK_OF_YEAR). The result should be the same
|
||||
// for the whole week. Note that a bug in
|
||||
// getActualMaximum() will break this test.
|
||||
cal.set(Calendar.YEAR, i);
|
||||
int maxWeek = cal.getActualMaximum(Calendar.WEEK_OF_YEAR);
|
||||
cal.set(Calendar.WEEK_OF_YEAR, maxWeek);
|
||||
|
@ -1501,6 +1514,8 @@ public class CalendarRegression extends com.ibm.test.TestFmwk {
|
|||
+ ",min=" + j1 + ",first=" + j);
|
||||
}
|
||||
}
|
||||
// Now advance the calendar one more day. This should
|
||||
// put it at the first day of week 1 of the next year.
|
||||
cal.add(Calendar.DATE, 1);
|
||||
int WOY = cal.get(Calendar.WEEK_OF_YEAR);
|
||||
if (WOY != 1) {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/test/calendar/Attic/CalendarTest.java,v $
|
||||
* $Date: 2000/05/12 23:19:12 $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2000/10/17 18:32:50 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -63,7 +63,7 @@ public class CalendarTest extends TestFmwk {
|
|||
|
||||
// Get a format to use for printing dates in the calendar system we're testing
|
||||
// TODO: This is kind of ugly right now .
|
||||
DateFormat format = IBMCalendar.getDateTimeFormat(cal, DateFormat.SHORT, -1, Locale.getDefault());
|
||||
DateFormat format = Calendar.getDateTimeFormat(cal, DateFormat.SHORT, -1, Locale.getDefault());
|
||||
|
||||
((SimpleDateFormat)format).applyPattern(pattern);
|
||||
DateFormat testFmt = (DateFormat)format.clone();
|
||||
|
@ -136,7 +136,7 @@ public class CalendarTest extends TestFmwk {
|
|||
* @param roll <code>true</code> or <code>ROLL</code> to test the <code>roll</code> method;
|
||||
* <code>false</code> or <code>ADD</code> to test the <code>add</code method
|
||||
*/
|
||||
public void doRollAdd(boolean roll, IBMCalendar cal, int[][] tests)
|
||||
public void doRollAdd(boolean roll, Calendar cal, int[][] tests)
|
||||
{
|
||||
String name = roll ? "rolling" : "adding";
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/test/calendar/Attic/IBMCalendarTest.java,v $
|
||||
* $Date: 2000/03/21 02:51:43 $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2000/10/17 18:32:50 $
|
||||
* $Revision: 1.3 $
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.test.calendar;
|
||||
|
@ -70,16 +70,16 @@ public class IBMCalendarTest extends TestFmwk {
|
|||
// Test days of the week
|
||||
Object[] DATA2 = {
|
||||
Locale.US, new int[] {
|
||||
Calendar.MONDAY, IBMCalendar.WEEKDAY,
|
||||
Calendar.FRIDAY, IBMCalendar.WEEKDAY,
|
||||
Calendar.SATURDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.SUNDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.MONDAY, Calendar.WEEKDAY,
|
||||
Calendar.FRIDAY, Calendar.WEEKDAY,
|
||||
Calendar.SATURDAY, Calendar.WEEKEND,
|
||||
Calendar.SUNDAY, Calendar.WEEKEND,
|
||||
},
|
||||
new Locale("ar", "BH"), new int[] { // Thursday:Friday
|
||||
Calendar.WEDNESDAY,IBMCalendar.WEEKDAY,
|
||||
Calendar.SATURDAY, IBMCalendar.WEEKDAY,
|
||||
Calendar.THURSDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.FRIDAY, IBMCalendar.WEEKEND,
|
||||
Calendar.WEDNESDAY,Calendar.WEEKDAY,
|
||||
Calendar.SATURDAY, Calendar.WEEKDAY,
|
||||
Calendar.THURSDAY, Calendar.WEEKEND,
|
||||
Calendar.FRIDAY, Calendar.WEEKEND,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/test/calendar/Attic/TestCase.java,v $
|
||||
* $Date: 2000/05/12 23:19:12 $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2000/10/17 18:32:50 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -197,7 +197,6 @@ public class TestCase extends Calendar {
|
|||
// declares all of these abstract methods....
|
||||
protected void computeTime() {}
|
||||
protected void computeFields() {}
|
||||
public void roll(int field, boolean up) {}
|
||||
public void add(int field, int amt) {}
|
||||
public int getMinimum(int field) { return 0; }
|
||||
public int getMaximum(int field) { return 0; }
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2000, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/util/Attic/IBMCalendar.java,v $
|
||||
* $Date: 2000/10/17 18:26:45 $
|
||||
* $Revision: 1.11 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
package com.ibm.util;
|
||||
|
||||
/**
|
||||
* OBSOLETE. This class is no longer used; it has been merged into
|
||||
* com.ibm.util.Calendar.
|
||||
*/
|
||||
abstract class IBMCalendar {}
|
Loading…
Add table
Reference in a new issue