[multiple changes]
2005-11-17 Mark Wielaard <mark@klomp.org> * java/text/SimpleDateFormat.java: Removed, fully merged now. * sources.am: Regenerated. * Makefile.in: Regenerated. 2005-11-17 Sven de Marothy <sven@physto.se> * java/text/SimpleDateFormat.java (computeOffset): Allow timezone to be first in the parsed String. 2005-11-17 Mark Wielaard <mark@klomp.org> * java/text/SimpleDateFormat.java (field, size): Make package private. 2005-11-17 Tom Tromey <tromey@redhat.com> * java/text/SimpleDateFormat.java (compileFormat): Correctly handle quoted single quotes. PR classspath/23183. 2005-11-17 Tom Tromey <tromey@redhat.com> * java/text/SimpleDateFormat.java (compileFormat): Reformatted. 2005-11-17 Tom Tromey <tromey@redhat.com> * java/text/DateFormat.java (serialVersionUID): New field. 2005-11-17 Mark Wielaard <mark@klomp.org> * java/text/DateFormat.java (equals): Reimplement. 2005-11-17 David Gilbert <david.gilbert@object-refinery.com> * java/text/Collator.java: API doc fixes, * java/text/DateFormat.java: likewise, * java/text/DecimalFormatSymbols.java: likewise, * java/text/DateFormatSymbols.java: likewise, * java/text/SimpleDateFormat.java: likewise. 2005-11-17 Jeroen Frijters <jeroen@frijters.net> * java/text/Collator.java (getInstance(Locale)): Added default collation pattern to handle case when resource is missing and throw InternalError instead of returning null should parsing fail. From-SVN: r107121
This commit is contained in:
parent
b424a57253
commit
035db16b87
8 changed files with 132 additions and 1293 deletions
|
@ -150,8 +150,8 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
* <code>Collator</code> and the strength and decomposition rules in
|
||||
* effect.
|
||||
*
|
||||
* @param str1 The first object to compare
|
||||
* @param str2 The second object to compare
|
||||
* @param source The first object to compare
|
||||
* @param target The second object to compare
|
||||
*
|
||||
* @return A negative integer if str1 < str2, 0 if str1 == str2, or
|
||||
* a positive integer if str1 > str2.
|
||||
|
@ -164,8 +164,8 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
* equal to, or greater than the second argument. These two objects
|
||||
* must be <code>String</code>'s or an exception will be thrown.
|
||||
*
|
||||
* @param obj1 The first object to compare
|
||||
* @param obj2 The second object to compare
|
||||
* @param o1 The first object to compare
|
||||
* @param o2 The second object to compare
|
||||
*
|
||||
* @return A negative integer if obj1 < obj2, 0 if obj1 == obj2, or
|
||||
* a positive integer if obj1 > obj2.
|
||||
|
@ -208,8 +208,8 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
* according to the collation rules for the locale of this object and
|
||||
* the current strength and decomposition settings.
|
||||
*
|
||||
* @param str1 The first <code>String</code> to compare
|
||||
* @param str2 The second <code>String</code> to compare
|
||||
* @param source The first <code>String</code> to compare
|
||||
* @param target The second <code>String</code> to compare
|
||||
*
|
||||
* @return <code>true</code> if the two strings are equal,
|
||||
* <code>false</code> otherwise.
|
||||
|
@ -256,7 +256,7 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
* comparisons against a string might be performed multiple times, such
|
||||
* as during a sort operation.
|
||||
*
|
||||
* @param str The <code>String</code> to convert.
|
||||
* @param source The <code>String</code> to convert.
|
||||
*
|
||||
* @return A <code>CollationKey</code> for the specified <code>String</code>.
|
||||
*/
|
||||
|
@ -292,7 +292,7 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
* specified locale. If no <code>Collator</code> exists for the desired
|
||||
* locale, a <code>Collator</code> for the default locale will be returned.
|
||||
*
|
||||
* @param locale The desired localed to load a <code>Collator</code> for.
|
||||
* @param loc The desired localed to load a <code>Collator</code> for.
|
||||
*
|
||||
* @return A <code>Collator</code> for the requested locale
|
||||
*/
|
||||
|
@ -308,7 +308,8 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
}
|
||||
catch (MissingResourceException x)
|
||||
{
|
||||
return null;
|
||||
pattern = "<0<1<2<3<4<5<6<7<8<9<A,a<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K" +
|
||||
"<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y<z,Z";
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -316,7 +317,7 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
}
|
||||
catch (ParseException x)
|
||||
{
|
||||
return null;
|
||||
throw (InternalError)new InternalError().initCause(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,7 +347,7 @@ public abstract class Collator implements Comparator, Cloneable
|
|||
* exception will be thrown. See the documentation for those
|
||||
* contants for an explanation of this setting.
|
||||
*
|
||||
* @param decmp The new decomposition setting.
|
||||
* @param mode The new decomposition setting.
|
||||
*
|
||||
* @exception IllegalArgumentException If the requested
|
||||
* decomposition setting is not valid.
|
||||
|
|
|
@ -58,6 +58,9 @@ import java.util.TimeZone;
|
|||
|
||||
public abstract class DateFormat extends Format implements Cloneable
|
||||
{
|
||||
private static final long serialVersionUID = 7218322306649953788L;
|
||||
|
||||
// Names fixed by serialization spec.
|
||||
protected Calendar calendar;
|
||||
protected NumberFormat numberFormat;
|
||||
|
||||
|
@ -405,8 +408,18 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* <ul>
|
||||
* <li>Is not <code>null</code>.</li>
|
||||
* <li>Is an instance of <code>DateFormat</code>.</li>
|
||||
* <li>Has the same numberFormat field value as this object.</li>
|
||||
* <li>Has equal numberFormat field as this object.</li>
|
||||
* <li>Has equal (Calendar) TimeZone rules as this object.</li>
|
||||
* <li>Has equal (Calendar) isLenient results.</li>
|
||||
* <li>Has equal Calendar first day of week and minimal days in week
|
||||
* values.</li>
|
||||
* </ul>
|
||||
* Note that not all properties of the Calendar are relevant for a
|
||||
* DateFormat. For formatting only the fact whether or not the
|
||||
* TimeZone has the same rules and whether the calendar is lenient
|
||||
* and has the same week rules is compared for this implementation
|
||||
* of equals. Other properties of the Calendar (such as the time)
|
||||
* are not taken into account.
|
||||
*
|
||||
* @param obj The object to test for equality against.
|
||||
*
|
||||
|
@ -419,8 +432,24 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
return false;
|
||||
|
||||
DateFormat d = (DateFormat) obj;
|
||||
TimeZone tz = getTimeZone();
|
||||
TimeZone tzd = d.getTimeZone();
|
||||
if (tz.hasSameRules(tzd))
|
||||
if (isLenient() == d.isLenient())
|
||||
{
|
||||
Calendar c = getCalendar();
|
||||
Calendar cd = d.getCalendar();
|
||||
if ((c == null && cd == null)
|
||||
||
|
||||
(c.getFirstDayOfWeek() == cd.getFirstDayOfWeek()
|
||||
&&
|
||||
c.getMinimalDaysInFirstWeek()
|
||||
== cd.getMinimalDaysInFirstWeek()))
|
||||
return ((numberFormat == null && d.numberFormat == null)
|
||||
|| numberFormat.equals(d.numberFormat));
|
||||
}
|
||||
|
||||
return numberFormat.equals(d.numberFormat);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -442,9 +471,9 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* thrown.
|
||||
*
|
||||
* @param obj The <code>Object</code> to format.
|
||||
* @param toAppendTo The <code>StringBuffer</code> to append the resultant
|
||||
* @param buf The <code>StringBuffer</code> to append the resultant
|
||||
* <code>String</code> to.
|
||||
* @param fieldPosition Is updated to the start and end index of the
|
||||
* @param pos Is updated to the start and end index of the
|
||||
* specified field.
|
||||
*
|
||||
* @return The <code>StringBuffer</code> supplied on input, with the
|
||||
|
@ -479,9 +508,9 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* to the specified <code>StringBuffer</code>.
|
||||
*
|
||||
* @param date The <code>Date</code> value to format.
|
||||
* @param toAppendTo The <code>StringBuffer</code> to append the resultant
|
||||
* @param buf The <code>StringBuffer</code> to append the resultant
|
||||
* <code>String</code> to.
|
||||
* @param fieldPosition Is updated to the start and end index of the
|
||||
* @param pos Is updated to the start and end index of the
|
||||
* specified field.
|
||||
*
|
||||
* @return The <code>StringBuffer</code> supplied on input, with the
|
||||
|
@ -646,7 +675,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* localed will be used in place of the default.
|
||||
*
|
||||
* @param style The type of formatting to perform.
|
||||
* @param aLocale The desired locale.
|
||||
* @param loc The desired locale.
|
||||
*
|
||||
* @return A new <code>DateFormat</code> instance.
|
||||
*/
|
||||
|
@ -747,7 +776,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* localed will be used in place of the default.
|
||||
*
|
||||
* @param style The type of formatting to perform.
|
||||
* @param aLocale The desired locale.
|
||||
* @param loc The desired locale.
|
||||
*
|
||||
* @return A new <code>DateFormat</code> instance.
|
||||
*/
|
||||
|
@ -821,7 +850,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* starting parse position on method entry and the ending parse
|
||||
* position on method exit.
|
||||
*
|
||||
* @param text The string to parse.
|
||||
* @param source The string to parse.
|
||||
* @param pos The starting parse position in entry, the ending parse
|
||||
* position on exit.
|
||||
*
|
||||
|
@ -851,7 +880,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* This method specified the <code>Calendar</code> that should be used
|
||||
* by this object to parse/format datetimes.
|
||||
*
|
||||
* @param The new <code>Calendar</code> for this object.
|
||||
* @param calendar The new <code>Calendar</code> for this object.
|
||||
*
|
||||
* @see java.util.Calendar
|
||||
*/
|
||||
|
@ -876,7 +905,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
* This method specifies the <code>NumberFormat</code> object that should
|
||||
* be used by this object to parse/format times.
|
||||
*
|
||||
* @param The <code>NumberFormat</code> in use by this object.
|
||||
* @param numberFormat The <code>NumberFormat</code> in use by this object.
|
||||
*/
|
||||
public void setNumberFormat (NumberFormat numberFormat)
|
||||
{
|
||||
|
@ -886,7 +915,7 @@ public abstract class DateFormat extends Format implements Cloneable
|
|||
/**
|
||||
* This method sets the time zone that should be used by this object.
|
||||
*
|
||||
* @param The new time zone.
|
||||
* @param timeZone The new time zone.
|
||||
*/
|
||||
public void setTimeZone (TimeZone timeZone)
|
||||
{
|
||||
|
|
|
@ -266,7 +266,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* This is a two element <code>String</code> array indexed by
|
||||
* <code>Calendar.AM</code> and <code>Calendar.PM</code>
|
||||
*
|
||||
* @param ampms The new list of AM/PM display strings.
|
||||
* @param value The new list of AM/PM display strings.
|
||||
*/
|
||||
public void setAmPmStrings (String[] value)
|
||||
{
|
||||
|
@ -279,11 +279,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* This is a two element <code>String</code>
|
||||
* array indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>.
|
||||
*
|
||||
* @param eras The new list of era disply strings.
|
||||
* @param labels The new list of era display strings.
|
||||
*/
|
||||
public void setEras (String[] value)
|
||||
public void setEras (String[] labels)
|
||||
{
|
||||
eras = value;
|
||||
eras = labels;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -317,11 +317,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* <li>17 - time zone (z)</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param localPatternChars The new format patter characters
|
||||
* @param chars The new format pattern characters
|
||||
*/
|
||||
public void setLocalPatternChars (String value)
|
||||
public void setLocalPatternChars (String chars)
|
||||
{
|
||||
localPatternChars = value;
|
||||
localPatternChars = chars;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,11 +331,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* <code>Calendar.UNDECEMBER</code>. Note that there are thirteen
|
||||
* elements because some calendars have thriteen months.
|
||||
*
|
||||
* @param months The list of month display strings.
|
||||
* @param labels The list of month display strings.
|
||||
*/
|
||||
public void setMonths (String[] value)
|
||||
public void setMonths (String[] labels)
|
||||
{
|
||||
months = value;
|
||||
months = labels;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,11 +346,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* through <code>Calendar.UNDECEMBER</code>. Note that there are thirteen
|
||||
* elements because some calendars have thirteen months.
|
||||
*
|
||||
* @param shortMonths The new list of abbreviated month display strings.
|
||||
* @param labels The new list of abbreviated month display strings.
|
||||
*/
|
||||
public void setShortMonths (String[] value)
|
||||
public void setShortMonths (String[] labels)
|
||||
{
|
||||
shortMonths = value;
|
||||
shortMonths = labels;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -361,11 +361,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* through <code>Calendar.SATURDAY</code>. Note that the first element
|
||||
* of this array is ignored.
|
||||
*
|
||||
* @param shortWeekdays This list of abbreviated weekday display strings.
|
||||
* @param labels This list of abbreviated weekday display strings.
|
||||
*/
|
||||
public void setShortWeekdays (String[] value)
|
||||
public void setShortWeekdays (String[] labels)
|
||||
{
|
||||
shortWeekdays = value;
|
||||
shortWeekdays = labels;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -375,11 +375,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* through <code>Calendar.SATURDAY</code>. Note that the first element
|
||||
* of this array is ignored.
|
||||
*
|
||||
* @param weekdays This list of weekday display strings.
|
||||
* @param labels This list of weekday display strings.
|
||||
*/
|
||||
public void setWeekdays (String[] value)
|
||||
public void setWeekdays (String[] labels)
|
||||
{
|
||||
weekdays = value;
|
||||
weekdays = labels;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -395,11 +395,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
* <li>4 - the short name of the time zone (daylight savings time).</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return The list of time zone display strings.
|
||||
* @params zones The list of time zone display strings.
|
||||
*/
|
||||
public void setZoneStrings (String[][] value)
|
||||
public void setZoneStrings (String[][] zones)
|
||||
{
|
||||
zoneStrings = value;
|
||||
zoneStrings = zones;
|
||||
}
|
||||
|
||||
/* Does a "deep" equality test - recurses into arrays. */
|
||||
|
@ -469,7 +469,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
|
|||
/**
|
||||
* Returns a new copy of this object.
|
||||
*
|
||||
* @param A copy of this object
|
||||
* @return A copy of this object
|
||||
*/
|
||||
public Object clone ()
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
|
|||
* This method initializes a new instance of
|
||||
* <code>DecimalFormatSymbols</code> for the specified locale.
|
||||
*
|
||||
* @param locale The local to load symbols for.
|
||||
* @param loc The local to load symbols for.
|
||||
*/
|
||||
public DecimalFormatSymbols (Locale loc)
|
||||
{
|
||||
|
@ -380,7 +380,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
|
|||
/**
|
||||
* This method sets the currency symbol to the specified value.
|
||||
*
|
||||
* @param currencySymbol The new currency symbol
|
||||
* @param currency The new currency symbol
|
||||
*/
|
||||
public void setCurrencySymbol (String currency)
|
||||
{
|
||||
|
@ -390,7 +390,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
|
|||
/**
|
||||
* This method sets the decimal point character to the specified value.
|
||||
*
|
||||
* @param decimalSeparator The new decimal point character
|
||||
* @param decimalSep The new decimal point character
|
||||
*/
|
||||
public void setDecimalSeparator (char decimalSep)
|
||||
{
|
||||
|
@ -417,7 +417,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
|
|||
/**
|
||||
* This method sets the character used to separate groups of digits.
|
||||
*
|
||||
* @param groupingSeparator The character used to separate groups of digits.
|
||||
* @param groupSep The character used to separate groups of digits.
|
||||
*/
|
||||
public void setGroupingSeparator (char groupSep)
|
||||
{
|
||||
|
@ -459,8 +459,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
|
|||
* This method sets the character used for the decimal point in currency
|
||||
* values.
|
||||
*
|
||||
* @param monetarySeparator The decimal point character used in
|
||||
* currency values.
|
||||
* @param decimalSep The decimal point character used in currency values.
|
||||
*/
|
||||
public void setMonetaryDecimalSeparator (char decimalSep)
|
||||
{
|
||||
|
@ -471,7 +470,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
|
|||
* This method sets the string used to represent the NaN (not a
|
||||
* number) value.
|
||||
*
|
||||
* @param NaN The string used to represent NaN
|
||||
* @param nan The string used to represent NaN
|
||||
*/
|
||||
public void setNaN (String nan)
|
||||
{
|
||||
|
@ -482,7 +481,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
|
|||
* This method sets the character used to separate positive and negative
|
||||
* subpatterns in a format pattern.
|
||||
*
|
||||
* @param patternSeparator The character used to separate positive and
|
||||
* @param patternSep The character used to separate positive and
|
||||
* negative subpatterns in a format pattern.
|
||||
*/
|
||||
public void setPatternSeparator (char patternSep)
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue