ICU-3348 tags cleanup

X-SVN-Rev: 13911
This commit is contained in:
Doug Felt 2003-12-01 21:33:37 +00:00
parent 99f2ec50f9
commit 912a7c0933
4 changed files with 60 additions and 49 deletions

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/DateRule.java,v $
* $Date: 2002/12/04 16:38:52 $
* $Revision: 1.4 $
* $Date: 2003/12/01 21:29:48 $
* $Revision: 1.5 $
*
*****************************************************************************************
*/
@ -22,7 +22,7 @@ import java.util.Date;
* Daylight Savings Time rules, and other events such as meetings.
*
* @see SimpleDateRule
* @draft ICU 2.2
* @draft ICU 2.8
*/
public interface DateRule
{
@ -36,7 +36,7 @@ public interface DateRule
* does not occur on or after the start date.
*
* @see #firstBetween
* @draft ICU 2.2
* @draft ICU 2.8
*/
abstract public Date firstAfter(Date start);
@ -52,7 +52,7 @@ public interface DateRule
* does not occur between the start and end dates.
*
* @see #firstAfter
* @draft ICU 2.2
* @draft ICU 2.8
*/
abstract public Date firstBetween(Date start, Date end);
@ -65,14 +65,14 @@ public interface DateRule
*
* @param date The date to check.
* @return true if this event occurs on the given date.
* @draft ICU 2.2
* @draft ICU 2.8
*/
abstract public boolean isOn(Date date);
/**
* Check whether this event occurs at least once between the two
* dates given.
* @draft ICU 2.2
* @draft ICU 2.8
*/
abstract public boolean isBetween(Date start, Date end);
};

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/Holiday.java,v $
* $Date: 2002/12/04 01:03:39 $
* $Revision: 1.6 $
* $Date: 2003/12/01 21:30:06 $
* $Revision: 1.7 $
*
*****************************************************************************************
*/
@ -21,15 +21,13 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* An abstract class representing a holiday. This class simply adds
* a holiday name to the DateRule interface for calculating the date
* of an event.
* @draft ICU 2.2
* An abstract class representing a holiday.
* @draft ICU 2.8
*/
public abstract class Holiday implements DateRule
{
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public static Holiday[] getHolidays()
{
@ -37,7 +35,7 @@ public abstract class Holiday implements DateRule
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public static Holiday[] getHolidays(Locale locale)
{
@ -62,7 +60,7 @@ public abstract class Holiday implements DateRule
* does not occur on or after the start date.
*
* @see #firstBetween
* @draft ICU 2.2
* @draft ICU 2.8
*/
public Date firstAfter(Date start) {
return rule.firstAfter(start);
@ -79,7 +77,7 @@ public abstract class Holiday implements DateRule
* does not occur between the start and end dates.
*
* @see #firstAfter
* @draft ICU 2.2
* @draft ICU 2.8
*/
public Date firstBetween(Date start, Date end) {
return rule.firstBetween(start, end);
@ -92,7 +90,7 @@ public abstract class Holiday implements DateRule
*
* @param date The date to check.
* @return true if this holiday occurs on the given date.
* @draft ICU 2.2
* @draft ICU 2.8
*
*/
public boolean isOn(Date date) {
@ -103,7 +101,7 @@ public abstract class Holiday implements DateRule
/**
* Check whether this holiday occurs at least once between the two
* dates given.
* @draft ICU 2.2
* @draft ICU 2.8
*/
public boolean isBetween(Date start, Date end) {
return rule.isBetween(start, end);
@ -120,7 +118,7 @@ public abstract class Holiday implements DateRule
* @param rule The date rules used for determining when this holiday
* falls. Holiday's implementation of the DateRule inteface
* simply delegates to this DateRule object.
* @draft ICU 2.2
* @draft ICU 2.8
*/
protected Holiday(String name, DateRule rule)
{
@ -130,7 +128,7 @@ public abstract class Holiday implements DateRule
/**
* Return the name of this holiday in the language of the default locale
* @draft ICU 2.2
* @draft ICU 2.8
*/
public String getDisplayName() {
return getDisplayName(Locale.getDefault());
@ -145,7 +143,7 @@ public abstract class Holiday implements DateRule
* @param loc A locale specifying the language in which the name is desired.
*
* @see ResourceBundle
* @draft ICU 2.2
* @draft ICU 2.8
*/
public String getDisplayName(Locale locale)
{
@ -162,14 +160,14 @@ public abstract class Holiday implements DateRule
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public DateRule getRule() {
return rule;
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public void setRule(DateRule rule) {
this.rule = rule;

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/RangeDateRule.java,v $
* $Date: 2002/12/18 21:20:52 $
* $Revision: 1.7 $
* $Date: 2003/12/01 21:29:33 $
* $Revision: 1.8 $
*
*****************************************************************************************
*/
@ -18,12 +18,12 @@ import java.util.Vector;
/**
* Implementation of DateRule that takes a range.
* @draft ICU 2.2
* @draft ICU 2.8
*/
public class RangeDateRule implements DateRule
{
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public RangeDateRule()
{
@ -41,7 +41,7 @@ public class RangeDateRule implements DateRule
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public void add(DateRule rule)
{
@ -49,7 +49,7 @@ public class RangeDateRule implements DateRule
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public void add(Date start, DateRule rule)
{
@ -61,12 +61,15 @@ public class RangeDateRule implements DateRule
//-----------------------------------------------------------------------
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public Date firstAfter(Date start)
{
// Find the range that I should look at
int index = startIndex(start);
if (index == ranges.size()) {
index = 0;
}
Date result = null;
Range r = rangeAt(index);
@ -84,7 +87,7 @@ public class RangeDateRule implements DateRule
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public Date firstBetween(Date start, Date end)
{
@ -109,17 +112,18 @@ public class RangeDateRule implements DateRule
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public boolean isOn(Date date)
{
return false;
Range r = rangeAt(startIndex(date));
return r != null && r.rule != null && r.rule.isOn(date);
}
/**
* Check whether this event occurs at least once between the two
* dates given.
* @draft ICU 2.2
* @draft ICU 2.8
*/
public boolean isBetween(Date start, Date end)
{

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/SimpleDateRule.java,v $
* $Date: 2003/10/02 20:50:27 $
* $Revision: 1.10 $
* $Date: 2003/12/01 21:33:37 $
* $Revision: 1.11 $
*
*****************************************************************************************
*/
@ -17,7 +17,7 @@ import java.util.Date;
/**
* Simple implementation of DateRule.
* @draft ICU 2.2
* @draft ICU 2.8
*/
public class SimpleDateRule implements DateRule
{
@ -26,7 +26,7 @@ public class SimpleDateRule implements DateRule
*
* @param month The month in which this rule occurs (0-based).
* @param dayOfMonth The date in that month (1-based).
* @draft ICU 2.2
* @draft ICU 2.8
*/
public SimpleDateRule(int month, int dayOfMonth)
{
@ -35,6 +35,15 @@ public class SimpleDateRule implements DateRule
this.dayOfWeek = 0;
}
// temporary
/* package */SimpleDateRule(int month, int dayOfMonth, Calendar cal)
{
this.month = month;
this.dayOfMonth = dayOfMonth;
this.dayOfWeek = 0;
this.calendar = cal;
}
/**
* Construct a rule for a weekday within a month, e.g. the first Monday.
*
@ -44,7 +53,7 @@ public class SimpleDateRule implements DateRule
* @param after If true, this rule selects the first dayOfWeek
* on or after dayOfMonth. If false, the rule selects
* the first dayOfWeek on or before dayOfMonth.
* @draft ICU 2.2
* @draft ICU 2.8
*/
public SimpleDateRule(int month, int dayOfMonth, int dayOfWeek, boolean after)
{
@ -63,7 +72,7 @@ public class SimpleDateRule implements DateRule
* does not occur on or after the start date.
*
* @see #firstBetween
* @draft ICU 2.2
* @draft ICU 2.8
*/
public Date firstAfter(Date start)
{
@ -85,7 +94,7 @@ public class SimpleDateRule implements DateRule
* does not occur between the start and end dates.
*
* @see #firstAfter
* @draft ICU 2.2
* @draft ICU 2.8
*/
public Date firstBetween(Date start, Date end)
{
@ -108,7 +117,7 @@ public class SimpleDateRule implements DateRule
*
* @param date The date to check.
* @return true if this event occurs on the given date.
* @draft ICU 2.2
* @draft ICU 2.8
*
*/
public boolean isOn(Date date)
@ -129,8 +138,8 @@ public class SimpleDateRule implements DateRule
c.setTime(computeInYear(c.get(Calendar.YEAR), c));
//System.out.println(" isOn: dayOfYear = " + dayOfYear);
//System.out.println(" holiday = " + c.get(Calendar.DAY_OF_YEAR));
// System.out.println(" isOn: dayOfYear = " + dayOfYear);
// System.out.println(" holiday = " + c.get(Calendar.DAY_OF_YEAR));
return c.get(Calendar.DAY_OF_YEAR) == dayOfYear;
}
@ -139,7 +148,7 @@ public class SimpleDateRule implements DateRule
/**
* Check whether this event occurs at least once between the two
* dates given.
* @draft ICU 2.2
* @draft ICU 2.8
*/
public boolean isBetween(Date start, Date end)
{
@ -218,15 +227,15 @@ public class SimpleDateRule implements DateRule
}
/**
* @draft ICU 2.2
* @draft ICU 2.8
*/
public void setCalendar(Calendar c) {
calendar = c;
}
static GregorianCalendar gCalendar = new GregorianCalendar(new SimpleTimeZone(0, "UTC"));
private static GregorianCalendar gCalendar = new GregorianCalendar();
Calendar calendar = gCalendar;
private Calendar calendar = gCalendar;
private int month;
private int dayOfMonth;